/* ===========================================================
   taqom — shared design system (light, modern, RTL-aware)
   =========================================================== */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e6e8ee;
  --border-strong: #d6dae3;
  --text: #111827;
  --muted: #6b7280;
  --faint: #9ca3af;

  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;

  --danger: #dc2626;
  --danger-50: #fef2f2;
  --ok: #16a34a;
  --ok-50: #f0fdf4;
  --warn: #d97706;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.08);
  --shadow: 0 4px 12px rgba(16,24,40,.06), 0 2px 6px rgba(16,24,40,.05);
  --shadow-lg: 0 16px 40px rgba(16,24,40,.14);
  --sidebar-w: 264px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Cairo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font-family: inherit; }
[hidden] { display: none !important; }

/* Snappy touch feedback: skip the browser's default ~300ms tap delay /
   double-tap-zoom gesture detection on interactive controls, and give
   immediate visual feedback on press instead of relying on :hover (which
   touch screens never trigger). */
button, .btn, a.btn, .cat-chip, .nav button, .menu-btn, .filter-btn, .pw-toggle, .check-row, input[type="checkbox"] {
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.btn, .cat-chip, .nav button, .menu-btn, .filter-btn, .icon-picker-btn { transition: background .15s, border-color .15s, color .15s, transform .08s; }
.btn:active, .cat-chip:active, .menu-btn:active, .filter-btn:active, .icon-picker-btn:active { transform: scale(.96); }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary) 0%, #7c6cff 100%);
  display: grid; place-items: center; overflow: hidden;
  box-shadow: 0 4px 12px rgba(79, 70, 229, .35);
}
.logo-letter {
  font-size: 20px; font-weight: 900; color: #fff; line-height: 1;
  letter-spacing: -.5px; user-select: none;
}
.brand h1 { font-size: 20px; margin: 0; font-weight: 800; letter-spacing: -.2px; line-height: 1; }

/* ---------- Buttons ---------- */
.btn {
  border: 0; border-radius: var(--radius-sm); padding: 11px 18px;
  font-weight: 700; font-size: 14px; cursor: pointer;
  background: var(--primary); color: #fff; transition: .15s; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  text-decoration: none;
}
.btn:hover { background: var(--primary-600); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--faint); }
.btn.danger { background: var(--surface); color: var(--danger); border: 1px solid var(--border-strong); }
.btn.danger:hover { background: var(--danger-50); border-color: var(--danger); }
.btn.block { width: 100%; }
.btn.sm { padding: 8px 12px; font-size: 13px; }

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; font-weight: 600; }
input, select {
  width: 100%; background: var(--surface); border: 1px solid var(--border-strong);
  color: var(--text); padding: 11px 13px; border-radius: var(--radius-sm);
  font-size: 14px; outline: none; transition: .15s;
}
input::placeholder { color: var(--faint); }
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
input:disabled { background: var(--surface-2); color: var(--muted); }
input[type="color"] { padding: 4px; width: 100%; height: 46px; box-sizing: border-box; cursor: pointer; }
.check-row {
  display: flex; align-items: center; gap: 10px; margin: 14px 0 6px;
  color: var(--text); font-size: 14px; font-weight: 700; cursor: pointer;
}
.check-row input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); flex: 0 0 auto; }
.divider {
  margin: 22px 0 4px; padding-top: 18px; border-top: 1px solid var(--border);
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--faint);
}
.form-msg { font-size: 13px; min-height: 18px; margin-top: 14px; text-align: center; color: var(--muted); }
.form-msg.error { color: var(--danger); }
.form-msg.ok { color: var(--ok); }

/* ---------- Auth (login) pages ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; padding-bottom: 84px; position: relative; z-index: 1; }

/* animated login backdrop — soft flowing aurora (light/luster feel, no gold color) */
.login-bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; background: var(--bg); }
.login-bg .blob { position: absolute; filter: blur(74px); opacity: .55; mix-blend-mode: multiply; will-change: transform; }
.login-bg .b1 { width: 480px; height: 480px; top: -130px; inset-inline-start: -120px;
  background: radial-gradient(circle at 35% 35%, rgba(99,102,241,.55), transparent 68%);
  border-radius: 47% 53% 60% 40% / 45% 46% 54% 55%; animation: float1 22s ease-in-out infinite; }
.login-bg .b2 { width: 440px; height: 440px; bottom: -150px; inset-inline-end: -120px;
  background: radial-gradient(circle at 50% 50%, rgba(139,92,246,.5), transparent 68%);
  border-radius: 60% 40% 45% 55% / 55% 48% 52% 45%; animation: float2 27s ease-in-out infinite; }
.login-bg .b3 { width: 380px; height: 380px; top: 28%; inset-inline-start: 56%;
  background: radial-gradient(circle at 50% 50%, rgba(56,189,248,.42), transparent 70%);
  border-radius: 50%; animation: float3 19s ease-in-out infinite; }
.login-bg .b4 { width: 320px; height: 320px; top: 60%; inset-inline-start: 6%;
  background: radial-gradient(circle at 50% 50%, rgba(45,212,191,.38), transparent 70%);
  border-radius: 50%; animation: float1 25s ease-in-out infinite reverse; }
@keyframes float1 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(60px,44px) scale(1.12); } }
@keyframes float2 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-52px,-32px) scale(1.08); } }
@keyframes float3 { 0%,100% { transform: translate(0,0) scale(1); } 33% { transform: translate(-44px,30px) scale(.9); } 66% { transform: translate(34px,-26px) scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .login-bg .blob { animation: none; } }

/* reveal-password toggle */
.pw-wrap { position: relative; }
.pw-wrap input { padding-inline-end: 46px; }
.pw-toggle {
  position: absolute; inset-inline-end: 8px; top: 50%; transform: translateY(-50%);
  background: transparent; border: 0; cursor: pointer; color: var(--muted);
  padding: 6px; border-radius: 8px; display: grid; place-items: center;
}
.pw-toggle:hover { color: var(--text); background: var(--surface-2); }
.pw-toggle .ic { width: 18px; height: 18px; }
.auth-card {
  width: 100%; max-width: 410px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 20px; padding: 34px 30px;
  box-shadow: var(--shadow-lg);
  animation: authCardIn .5s cubic-bezier(.16,1,.3,1);
}
@keyframes authCardIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .auth-card { animation: none; } }
.auth-tag { color: var(--muted); font-size: 14px; margin: 14px 0 22px; font-weight: 600; }
.auth-foot { margin-top: 18px; text-align: center; }

/* ---------- Site credits bar (login pages) ---------- */
.site-credits {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  flex-wrap: wrap;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.78);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.site-credits-logo { width: 28px; height: 28px; object-fit: contain; flex-shrink: 0; }
.site-credits-body { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.site-credits-brand { font-weight: 800; font-size: 13px; color: var(--text); }
.site-credits-brand-btn { background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit; }
.site-credits-brand-btn:hover { color: var(--primary); }
.site-credits-brand-en { font-weight: 600; color: var(--muted); font-size: 11px; margin-inline-start: 4px; }
.site-credits-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); flex-shrink: 0; }
.site-credits-copy { font-size: 12px; color: var(--muted); }

/* ---------- Interested-in-a-store modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(16, 24, 40, .45);
  display: grid; place-items: center; padding: 20px;
  animation: modalFadeIn .18s ease-out;
}
.modal-card {
  background: var(--surface); border-radius: var(--radius); padding: 26px;
  max-width: 360px; width: 100%; text-align: center; box-shadow: var(--shadow-lg);
  animation: modalCardIn .22s cubic-bezier(.16,1,.3,1);
}
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalCardIn { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .modal-overlay, .modal-card { animation: none; } }
.modal-card h2 { margin: 0 0 10px; font-size: 18px; font-weight: 800; }
.modal-card p { margin: 0 0 18px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.modal-card .btn { margin-bottom: 10px; }

/* ---------- Language toggle ---------- */
.lang-btn {
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--muted);
  padding: 7px 14px; border-radius: 999px; cursor: pointer; font-weight: 700; font-size: 13px; transition: .15s;
}
.lang-btn:hover { color: var(--text); border-color: var(--faint); }
.lang-fixed { position: fixed; top: 20px; inset-inline-end: 20px; z-index: 60; }

/* ---------- App shell: topbar + sidebar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar-l { display: flex; align-items: center; gap: 14px; }
.topbar-r { display: flex; align-items: center; gap: 10px; }
.menu-btn {
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--text);
  width: 40px; height: 40px; border-radius: var(--radius-sm); cursor: pointer; font-size: 18px;
  display: grid; place-items: center; transition: .15s;
}
.menu-btn:hover { background: var(--surface-2); }

.sidebar {
  position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--sidebar-w);
  background: var(--surface); border-inline-end: 1px solid var(--border);
  transform: translateX(-100%); transition: transform .24s ease; z-index: 40;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
}
[dir="rtl"] .sidebar { transform: translateX(100%); }
.sidebar.open { transform: translateX(0) !important; }
.sidebar .s-head {
  display: flex; align-items: center; gap: 14px; padding: 24px 20px 22px;
  border-bottom: 1px solid var(--border);
}
.sidebar .s-head h1 { font-size: 19px; margin: 0; font-weight: 800; letter-spacing: -.3px; line-height: 1; }
.nav { padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav button {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: start;
  background: transparent; border: 0; color: var(--muted); padding: 12px 14px;
  border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; font-weight: 700; transition: .15s;
}
.nav button:hover { background: var(--surface-2); color: var(--text); }
.nav button.active { background: var(--primary-50); color: var(--primary); }
.nav .ico { width: 20px; display: inline-flex; align-items: center; justify-content: center; }

/* line icons inherit text color and match the theme */
.ic { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.menu-btn .ic { width: 20px; height: 20px; }

.overlay {
  position: fixed; inset: 0; background: rgba(17,24,39,.4);
  opacity: 0; pointer-events: none; transition: opacity .24s; z-index: 30;
}
.overlay.show { opacity: 1; pointer-events: auto; }

/* ---------- User menu ---------- */
.user-menu { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 10px; background: var(--surface);
  border: 1px solid var(--border-strong); color: var(--text); padding: 6px 14px 6px 6px;
  border-radius: 999px; cursor: pointer; font-weight: 700; font-size: 14px; transition: .15s;
}
[dir="rtl"] .user-btn { padding: 6px 6px 6px 14px; }
.user-btn:hover { background: var(--surface-2); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7c6cff);
  display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 13px; flex: 0 0 auto;
}
.caret { color: var(--faint); font-size: 10px; }
.dropdown {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  min-width: 200px; padding: 6px; box-shadow: var(--shadow-lg); display: none; z-index: 25;
}
.dropdown.show { display: block; }
.dropdown .dd-head { padding: 10px 12px 8px; }
.dropdown .dd-name { font-weight: 800; font-size: 14px; }
.dropdown .dd-sub { color: var(--muted); font-size: 12px; }
.dropdown button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: start;
  background: transparent; border: 0; color: var(--text); padding: 10px 12px;
  border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600;
}
.dropdown button:hover { background: var(--surface-2); }
.dropdown .danger { color: var(--danger); }
.dropdown hr { border: 0; border-top: 1px solid var(--border); margin: 6px 4px; }

/* ---------- Content ---------- */
main { padding: 32px 28px; max-width: 1040px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page-title { font-size: 26px; font-weight: 800; margin: 0 0 4px; letter-spacing: -.3px; }
.page-sub { color: var(--muted); margin: 0 0 26px; font-size: 14px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- Cards / lists ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.form-card { max-width: 500px; padding: 24px; }
.front-settings { max-width: 820px; display: flex; flex-direction: column; gap: 18px; }
.settings-section-group { max-width: 820px; display: flex; flex-direction: column; gap: 18px; margin-top: 22px; }
.front-url-row { display: flex; gap: 10px; margin: 20px 0; align-items: center; max-width: 820px; }
.front-url-row input { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.color-grid { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)); gap: 12px; }
.color-grid.color-grid-4 { grid-template-columns: repeat(4, minmax(110px, 1fr)); margin-top: 16px; }
.color-grid label { margin-top: 0; }
.color-field { display: flex; flex-direction: column; }
.color-hint { font-size: 11.5px; line-height: 1.4; color: var(--muted); margin: 2px 0 8px; min-height: 31px; }
.color-field input[type="color"] { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
@media (max-width: 620px) {
  .front-url-row { align-items: stretch; flex-direction: column; }
  .color-grid, .color-grid.color-grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 380px) {
  .color-grid, .color-grid.color-grid-4 { grid-template-columns: 1fr; }
}

/* ---------- Settings sections (Website / Store) ---------- */
.settings-section { padding: 22px 24px; }
.settings-section-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.settings-section-icon {
  width: 42px; height: 42px; flex: 0 0 auto; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, #7c6cff 100%);
  color: #fff; display: grid; place-items: center;
  box-shadow: 0 4px 10px rgba(79, 70, 229, .3);
}
.settings-section-icon .ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.settings-section-head h3 { margin: 0 0 2px; font-size: 16px; font-weight: 800; }
.settings-section-head p { margin: 0; color: var(--muted); font-size: 13px; }
.settings-section-body label:first-child { margin-top: 0; }
.front-save-actions { max-width: 320px; margin-inline-start: auto; }
@media (max-width: 620px) { .front-save-actions { max-width: none; margin-inline-start: 0; } }

/* ---------- Website editor header + live preview pane ---------- */
.website-editor-head {
  padding: 22px 26px; margin-bottom: 22px; border-radius: var(--radius);
  background: linear-gradient(120deg, var(--primary-100), var(--primary-50) 55%, var(--surface) 100%);
  border: 1px solid var(--primary-100);
}
.website-editor-head .page-title { background: linear-gradient(120deg, var(--primary), #7c6cff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.website-editor-head .page-sub { margin-bottom: 0; }
.website-open-site-row { display: flex; justify-content: flex-end; margin: 0 0 6px; }

.icon-btn-ghost {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border-strong); flex: 0 0 auto;
  background: var(--surface); color: var(--muted); display: grid; place-items: center; cursor: pointer; transition: .15s;
}
.icon-btn-ghost:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-50); }
.icon-btn-ghost .ic { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.website-preview-pane { display: none; } /* shown only at the min-width:1000px breakpoint below */
.website-preview-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.website-preview-live { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: 0 0 auto; animation: liveDotPulse 1.8s infinite; }
@keyframes liveDotPulse {
  0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .45); }
  70% { box-shadow: 0 0 0 7px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

/* Not a literal device illustration — just a clean frame sized like a phone
   viewport, so the iframe inside renders the site's real mobile layout. */
.phone-mockup {
  width: 100%; margin: 0 auto; padding: 8px;
  border-radius: 24px; background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 0 0 1px rgba(79, 70, 229, .08), 0 24px 50px -22px rgba(79, 70, 229, .4), 0 8px 20px rgba(16, 24, 40, .12);
}
.phone-mockup-frame { display: block; width: 100%; height: min(840px, 78vh); border: 0; border-radius: 18px; background: #fff; }

/* Website editor: settings split into tabs instead of one long scroll, at
   every screen size. On wide screens the tabs wrap; on narrow screens there's
   no room to wrap without eating vertical space, so the strip scrolls
   horizontally instead (swipeable, scrollbar hidden). */
.website-settings-tabs {
  display: flex; gap: 6px; margin: 18px 0 6px;
  padding: 5px; border-radius: 999px;
  background: linear-gradient(120deg, var(--primary-50), #fff);
  border: 1px solid var(--primary-100);
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.website-settings-tabs::-webkit-scrollbar { display: none; }
@media (min-width: 1000px) {
  .website-settings-tabs { flex-wrap: wrap; overflow-x: visible; }
}
.ws-tab {
  border: 0; background: none; padding: 9px 16px; border-radius: 999px;
  font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; transition: .15s;
  flex: 0 0 auto; white-space: nowrap;
}
.ws-tab:hover { color: var(--text); }
.ws-tab.active { background: linear-gradient(135deg, var(--primary), #7c6cff); color: #fff; box-shadow: 0 4px 10px rgba(79, 70, 229, .3); }

@media (min-width: 1000px) {
  main:has(.view.active[data-view="frontstore"]) { max-width: 1480px; }
  .website-editor-layout { display: grid; grid-template-columns: 1fr clamp(360px, 34vw, 460px); gap: 32px; align-items: start; }
  .website-settings-pane { order: 1; min-width: 0; }
  .website-preview-pane { order: 2; display: block; position: sticky; top: 86px; }
}

/* Theme presets */
.theme-presets { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 4px; }
.theme-preset {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: none; border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 8px; cursor: pointer; transition: .15s;
}
.theme-preset:hover { background: var(--surface-2); border-color: var(--border); }
.theme-preset-swatch { width: 40px; height: 40px; border-radius: 50%; box-shadow: 0 2px 6px rgba(16,24,40,.18); display: block; }
.theme-preset-name { font-size: 11px; font-weight: 700; color: var(--muted); }

/* Social link rows */
.social-edit-rows { display: flex; flex-direction: column; gap: 10px; }
.social-edit-row { display: flex; gap: 8px; align-items: center; }
.social-edit-row .social-platform-select { flex: 0 0 150px; }
.social-edit-row .social-url-input { flex: 1; min-width: 0; }
.social-row-remove {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--danger);
  cursor: pointer; font-size: 15px; transition: .15s;
}
.social-row-remove:hover { background: var(--danger-50); }
.social-empty-hint { color: var(--muted); font-size: 13px; margin: 0; }

/* generic on/off switch (social icon visibility, etc.) */
.switch { position: relative; display: inline-flex; align-items: center; flex-shrink: 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  width: 38px; height: 22px; border-radius: 999px; background: var(--border-strong);
  position: relative; transition: background-color .15s; flex-shrink: 0;
}
.switch-track::before {
  content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track::before { transform: translateX(16px); }
html[dir="rtl"] .switch input:checked + .switch-track::before { transform: translateX(-16px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px var(--primary-50); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13.5px; font-weight: 600; color: var(--text); }

@media (max-width: 560px) {
  .social-edit-row { flex-wrap: wrap; }
  .social-edit-row .social-platform-select { flex: 1 1 100%; }
  .social-edit-row .social-url-input { flex: 1 1 calc(100% - 48px); }
}

/* Category display style cards */
.cat-style-grid { display: grid; grid-template-columns: repeat(2, minmax(180px, 1fr)); gap: 14px; }
@media (max-width: 560px) { .cat-style-grid { grid-template-columns: 1fr; } }
.cat-style-card {
  text-align: center; background: var(--surface-2); border: 2px solid var(--border);
  border-radius: var(--radius); padding: 18px 14px; cursor: pointer; transition: .15s;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.cat-style-card:hover { border-color: var(--border-strong); }
.cat-style-card.active { border-color: var(--primary); background: var(--primary-50); }
.cat-style-preview { display: flex; gap: 6px; align-items: center; justify-content: center; height: 40px; }
.csp-pill { width: 34px; height: 14px; border-radius: 999px; background: var(--border-strong); }
.csp-pill-active { background: var(--primary); }
.csp-circle {
  width: 30px; height: 30px; border-radius: 50%; background: var(--primary-100);
  color: var(--primary); display: grid; place-items: center;
}
.csp-circle svg { width: 16px; height: 16px; }
.cat-style-name { font-weight: 800; font-size: 14px; }
.cat-style-desc { font-size: 12px; color: var(--muted); margin: 0; }

/* Products layout cards (flat list vs category containers) */
.products-layout-grid { display: grid; grid-template-columns: repeat(2, minmax(180px, 1fr)); gap: 14px; }
@media (max-width: 560px) { .products-layout-grid { grid-template-columns: 1fr; } }
.products-layout-card {
  text-align: center; background: var(--surface-2); border: 2px solid var(--border);
  border-radius: var(--radius); padding: 18px 14px; cursor: pointer; transition: .15s;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.products-layout-card:hover { border-color: var(--border-strong); }
.products-layout-card.active { border-color: var(--primary); background: var(--primary-50); }
.plc-preview { display: flex; flex-direction: column; gap: 5px; width: 100%; height: 40px; justify-content: center; }
.plc-row { height: 8px; border-radius: 4px; background: var(--border-strong); width: 100%; }
.plc-row:nth-child(2) { width: 80%; }
.plc-row:nth-child(3) { width: 60%; }
.plc-preview:has(.plc-tile) { flex-direction: row; flex-wrap: wrap; gap: 5px; align-content: center; }
.plc-tile { width: 17px; height: 17px; border-radius: 5px; background: var(--primary-100); border: 1px solid var(--primary-100); }
.plc-preview:has(.plc-tile2) { flex-direction: row; flex-wrap: wrap; gap: 4px; align-content: center; justify-content: center; }
.plc-tile2 { width: 26px; height: 18px; border-radius: 4px; background: var(--primary-100); border: 1px solid var(--primary-100); }

/* Upper-area layout pickers (header style / logo position / shape) — visual, click-to-apply */
.layout-option-grid { display: grid; grid-template-columns: repeat(3, minmax(96px, 1fr)); gap: 10px; margin: 6px 0 18px; }
.layout-option-grid.shape-grid,
.layout-option-grid.style-grid { grid-template-columns: repeat(2, minmax(96px, 1fr)); max-width: 280px; }
@media (max-width: 480px) { .layout-option-grid { grid-template-columns: repeat(3, 1fr); } }
.layout-option-card {
  -webkit-appearance: none; appearance: none;
  background: var(--surface-2); border: 2px solid var(--border); border-radius: var(--radius);
  padding: 12px 8px; cursor: pointer; transition: .15s;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.layout-option-card:hover { border-color: var(--border-strong); }
.layout-option-card.active { border-color: var(--primary); background: var(--primary-50); }
.layout-option-name { font-size: 12px; font-weight: 700; color: var(--text); }

/* Logo position mock — adapts to the chosen header style so the little
   preview always matches what the real storefront will actually do. */
.lop-mock {
  position: relative; width: 100%; height: 46px; border-radius: 9px; overflow: visible;
  background: linear-gradient(135deg, var(--primary), #7c6cff);
}
/* Inline-style preview: logo + a little name bar. Pinned with literal
   left/right (not flex-start/end or DOM order), so "Right" always lands
   physically right and "Left" always lands physically left — no
   dependency on the button's effective text direction. */
.lop-mock.style-inline {
  overflow: hidden; padding: 0 8px;
  background: var(--surface); border: 1px solid var(--border);
}
.lop-mock.style-inline::after {
  content: ""; position: absolute; top: 50%; transform: translateY(-50%);
  height: 6px; border-radius: 3px; background: var(--border-strong);
  left: 8px; right: 32px;
}
.lop-mock.style-inline.pos-left::after { left: 32px; right: 8px; }
.lop-mock.style-inline.pos-center::after { left: 28%; right: 28%; }
.lop-logo {
  position: absolute; bottom: -9px; width: 22px; height: 22px;
  background: #fff; border: 2px solid var(--surface-2); box-shadow: 0 2px 5px rgba(16,24,40,.2);
}
.lop-logo.shape-square { border-radius: 6px; }
.lop-logo.shape-circle { border-radius: 50%; }
.lop-logo.pos-center { left: 50%; transform: translateX(-50%); }
.lop-logo.pos-left { left: 8px; }
.lop-logo.pos-right { left: auto; right: 8px; }
/* In the inline style, the logo sits statically (vertically centered)
   beside the name bar instead of straddling the mock's bottom edge. */
.lop-logo.style-inline {
  bottom: auto; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px;
  background: var(--primary-100); border-color: var(--surface);
}
.lop-logo.style-inline.pos-center { transform: translate(-50%, -50%); }

.los-mock {
  width: 42px; height: 42px; background: #fff;
  border: 2px solid var(--border-strong); box-shadow: var(--shadow-sm);
}
.los-mock.shape-square { border-radius: 11px; }
.los-mock.shape-circle { border-radius: 50%; }

/* Header style mock (overlap vs inline) */
.los2-mock {
  position: relative; width: 100%; height: 46px; border-radius: 9px; overflow: visible;
  background: linear-gradient(135deg, var(--primary), #7c6cff);
  display: flex; align-items: center;
}
.los2-logo { background: #fff; box-shadow: 0 2px 5px rgba(16,24,40,.2); flex: 0 0 auto; }
.los2-name { height: 6px; border-radius: 3px; background: rgba(255,255,255,.85); }
.los2-mock.style-overlap {
  justify-content: center;
}
.los2-mock.style-overlap .los2-logo {
  position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%);
  width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--surface-2);
}
.los2-mock.style-overlap .los2-name { display: none; }
.los2-mock.style-inline {
  background: var(--surface); border: 1px solid var(--border);
  padding: 0 10px; gap: 7px; justify-content: flex-start;
}
.los2-mock.style-inline .los2-logo { width: 18px; height: 18px; border-radius: 5px; }
.los2-mock.style-inline .los2-name { width: 40%; }

/* Social icons display mock (in a container vs bare icons) */
.sd-mock {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 46px; border-radius: 9px;
  background: var(--surface); border: 1px solid var(--border-strong);
}
.sd-mock.plain { background: transparent; border-color: transparent; gap: 12px; }
.sd-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--primary); }

/* Layouts: section subhead used to introduce a group of cards without
   wrapping them in another nested card. */
.layouts-subhead { display: flex; gap: 14px; align-items: flex-start; margin: 26px 0 16px; }
.layouts-subhead h3 { margin: 0 0 2px; font-size: 16px; font-weight: 800; }
.layouts-subhead p { margin: 0; color: var(--muted); font-size: 13px; }

/* Recommended layouts — whole-site template cards, each with a tiny
   composite preview of header + categories + products so customers can
   see the result before applying it. Every card holds a fixed phone-sized
   thumbnail (see .rl-phone below) at every screen size, so the grid just
   auto-fills as many columns as fit — 1 on narrow phones, more as space allows. */
.rl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
@media (min-width: 1000px) {
  .rl-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
}

/* Recommended-layout subcategories — group the cards above into labeled
   sections (Classic / Bold / No-banner) so a growing template list stays
   scannable instead of one long undifferentiated grid. */
.rl-groups { display: flex; flex-direction: column; gap: 26px; }
.rl-category + .rl-category { padding-top: 24px; border-top: 1px solid var(--border); }
.rl-category-head { margin-bottom: 12px; }
.rl-category-name { margin: 0 0 2px; font-size: 12.5px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; color: var(--text); }
.rl-category-desc { margin: 0; font-size: 12px; color: var(--muted); }

/* Phone-sized iframe thumbnail for recommended-layout cards, at every screen size. */
.rl-phone {
  display: block; width: 170px; height: 290px; margin: 14px auto 0;
  overflow: hidden; border-radius: 14px; border: 1px solid var(--border);
  background: #fff; position: relative;
}
.rl-phone-frame {
  position: absolute; top: 0; left: 0;
  width: 375px; height: 640px; border: 0; pointer-events: none;
  transform: scale(0.4533); transform-origin: top left;
}

/* Recommended-layout cards — a real miniature of the storefront (your own
   logo, store name, category names/icons, product photos and colors), not
   abstract gray placeholder shapes. */
.rl-card {
  -webkit-appearance: none; appearance: none;
  text-align: start; background: var(--surface); border: 2px solid var(--border);
  border-radius: var(--radius); padding: 0; cursor: pointer; transition: .15s; overflow: hidden;
  display: flex; flex-direction: column;
}
.rl-card:hover { border-color: var(--border-strong); }
.rl-card.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.rl-preview { display: flex; flex-direction: column; background: var(--surface-2); }
.rl-head { position: relative; height: 40px; flex: 0 0 auto; }
.rl-head.style-inline { background: var(--surface) !important; border-bottom: 1px solid var(--border); }
/* Logo position (left/center/right) is a fixed physical choice on the live
   storefront, independent of the admin dashboard's own language direction —
   so this is literal left/right positioning, not logical/flex alignment
   (which would silently flip under RTL and misrepresent the real layout). */
.rl-head-inner { position: absolute; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 8px; max-width: calc(100% - 24px); }
.rl-head.style-overlap .rl-head-inner { bottom: -13px; top: auto; left: 50%; transform: translateX(-50%); z-index: 2; }
.rl-head.style-overlap.pos-left .rl-head-inner { left: 12px; transform: none; }
.rl-head.style-overlap.pos-right .rl-head-inner { left: auto; right: 12px; transform: none; }
.rl-head.style-inline.pos-left .rl-head-inner { left: 12px; }
.rl-head.style-inline.pos-center .rl-head-inner { left: 50%; transform: translate(-50%, -50%); }
.rl-head.style-inline.pos-right .rl-head-inner { left: auto; right: 12px; }
/* Flat variant — used when bannerHeight is "none": no cover at all, just a
   plain top navbar strip with the logo + name centered as one lockup. Own
   markup/classes (not style-overlap/style-inline) since there's no cover to
   overlap/inline into — and always centered, matching the real storefront. */
.rl-head.rl-head-flat { height: 38px; background: var(--surface) !important; border-bottom: 1px solid var(--border); }
.rl-head-flat-inner { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 100%; padding: 0 12px; overflow: hidden; }
.rl-head.rl-head-flat + .rl-body { padding-top: 10px; }
/* Navbar variant — used when bannerHeight is "navbar": icon top bar with a
   hamburger, centered brand (logo or name), and two placeholder icons on
   the other side (search + account — no cart, no language toggle). */
.rl-head.rl-head-navbar {
  height: 38px; background: var(--surface) !important; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 6px; padding: 0 10px; overflow: hidden;
}
.rl-navbar-burger { display: flex; flex-direction: column; gap: 3px; width: 15px; flex: 0 0 auto; }
.rl-navbar-burger span { display: block; height: 1.6px; background: var(--muted); border-radius: 1px; }
.rl-navbar-brand { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 6px; overflow: hidden; }
.rl-navbar-icons { display: flex; gap: 6px; flex: 0 0 auto; }
.rl-navbar-icon { width: 13px; height: 13px; border-radius: 50%; border: 1.6px solid var(--muted); }
.rl-head.rl-head-navbar + .rl-body { padding-top: 10px; }
.rl-head-logo {
  width: 26px; height: 26px; flex: 0 0 auto; overflow: hidden;
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(16, 24, 40, .25); background: var(--surface);
}
.rl-head-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rl-logo-fallback { width: 100%; height: 100%; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; }
.rl-head-logo.shape-square, .rl-head-logo.shape-square .rl-logo-fallback { border-radius: 7px; }
.rl-head-logo.shape-circle, .rl-head-logo.shape-circle .rl-logo-fallback { border-radius: 50%; }
.rl-head-name { font-size: 12px; font-weight: 800; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rl-body { flex: 1; min-height: 0; padding: 10px 10px 12px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.rl-head.style-overlap + .rl-body { padding-top: 18px; }
.rl-cats { display: flex; gap: 5px; align-items: center; justify-content: center; flex-wrap: wrap; min-height: 20px; }
.rl-cats-empty { font-size: 10.5px; color: var(--faint); }
.rl-cat-pill {
  font-size: 9px; font-weight: 700; padding: 4px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); max-width: 64px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rl-cat-circle { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.rl-cat-circle svg { width: 11px; height: 11px; }
.rl-products { flex: 1; display: flex; gap: 4px; min-height: 34px; }
.rl-products.rl-tiles { flex-wrap: wrap; }
.rl-row { flex: 1; border-radius: 5px; background-size: cover; background-position: center; min-height: 0; }
.rl-tile { width: calc(50% - 2px); border-radius: 5px; background-size: cover; background-position: center; min-height: 34px; }
/* "grid" products layout = browse via category cards only (no tab bar, no
   product photos at this level) — matches renderCategoryGrid() exactly. */
.rl-cat-grid { flex: 1; display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; align-content: start; }
.rl-cat-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 10px 4px; border-radius: 8px; background: var(--rl-cat-tile-bg, var(--surface-2));
}
.rl-cat-tile-icon { width: 18px; height: 18px; color: var(--rl-cat-tile-fg, var(--muted)); }
.rl-cat-tile-icon svg { width: 100%; height: 100%; }
.rl-cat-tile-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.rl-cat-tile-name { font-size: 9px; font-weight: 700; color: var(--text); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rl-name { font-weight: 800; font-size: 14px; padding: 12px 14px 0; }
.rl-desc { font-size: 12px; color: var(--muted); margin: 0; padding: 4px 14px 14px; }

/* Social icon order — draggable horizontal chip list */
.social-order-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; }
.social-order-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 12px 5px 6px;
}
.social-order-chip.dragging { box-shadow: var(--shadow-lg); cursor: grabbing; }
.social-order-drag {
  display: grid; place-items: center; width: 20px; height: 20px; color: var(--faint);
  cursor: grab; touch-action: none;
}
.drop-placeholder { border: 2px dashed var(--primary) !important; background: var(--primary-50) !important; box-shadow: none !important; }
.social-order-drag:active { cursor: grabbing; }
.social-order-drag .ic { width: 16px; height: 16px; }
.social-order-icon { display: grid; place-items: center; width: 18px; height: 18px; color: var(--primary); }
.social-order-icon svg { width: 100%; height: 100%; }
.social-order-name { font-size: 12px; font-weight: 700; color: var(--text); }

/* Per-category icon rows */
.cat-icon-list { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.cat-icon-list-hint { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.cat-icon-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; background: var(--surface); }
.cat-icon-row + .cat-icon-row { border-top: 1px solid var(--border); }
.cat-icon-row.dragging { box-shadow: var(--shadow-lg); border-radius: var(--radius-sm); cursor: grabbing; }
.cat-drag-handle {
  flex: 0 0 auto; width: 22px; height: 22px; color: var(--faint);
  cursor: grab; touch-action: none; display: grid; place-items: center;
}
.cat-drag-handle:active { cursor: grabbing; }
.cat-drag-handle .ic { width: 18px; height: 18px; }
.cat-icon-row-preview {
  width: 38px; height: 38px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; overflow: hidden;
}
.cat-icon-row-preview svg { width: 19px; height: 19px; }
.cat-icon-row-preview img { width: 100%; height: 100%; object-fit: cover; }

/* category custom photo (catIconModal) */
.cat-photo-row { display: flex; gap: 12px; align-items: center; margin: 4px 0 14px; }
.cat-photo-preview {
  width: 64px; height: 64px; border-radius: 10px; flex-shrink: 0; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--border);
}
.cat-photo-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cat-photo-actions { display: flex; flex-direction: column; gap: 8px; }
.cat-icon-row-name { flex: 1; font-weight: 700; font-size: 14px; }

/* manage categories modal (products page) — same row shape as the
   front-store icon picker, plus rename/delete actions */
.cat-add-row { display: flex; gap: 8px; }
.cat-add-row input { flex: 1; }
.cat-manage-rows { max-height: 280px; overflow-y: auto; margin: 4px 0 6px; }
.cat-manage-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; }
.cat-manage-row + .cat-manage-row { border-top: 1px solid var(--border); }
.cat-manage-row.dragging { box-shadow: var(--shadow-lg); border-radius: var(--radius-sm); cursor: grabbing; }
.cat-manage-name { flex: 1; min-width: 0; font-weight: 700; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-manage-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }

/* product video (admin form) */
.video-mode-panel { margin: 10px 0 14px; }
.video-file-preview-wrap, .video-yt-preview-wrap { margin-top: 10px; }
.video-file-preview-wrap video { width: 100%; max-height: 220px; border-radius: var(--radius-sm); background: #000; display: block; }
.video-yt-preview-wrap img { width: 100%; max-width: 280px; border-radius: var(--radius-sm); display: block; }
.video-file-preview-wrap .btn { margin-top: 8px; }

/* Icon picker grid (modal) */
.icon-picker-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 6px; }
@media (max-width: 480px) { .icon-picker-grid { grid-template-columns: repeat(5, 1fr); } }
.icon-picker-btn {
  aspect-ratio: 1; border-radius: var(--radius-sm); border: 1.5px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer; display: grid; place-items: center;
  transition: .15s;
}
.icon-picker-btn svg { width: 20px; height: 20px; }
.icon-picker-btn:hover { background: var(--surface-2); }
.icon-picker-btn.active { border-color: var(--primary); background: var(--primary-50); color: var(--primary); }

/* ---------- Prices board (in-store gold rate screen) ---------- */
.price-board {
  --pb-bg: #0b1320;
  --pb-fg: #ffffff;
  --pb-accent: #d4af37;
  --pb-cols: auto;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  padding: 32px 30px;
  color: var(--pb-fg);
  background: linear-gradient(160deg, var(--pb-bg) 0%, color-mix(in srgb, var(--pb-bg) 80%, #fff 8%) 55%, var(--pb-bg) 100%);
  box-shadow: var(--shadow-lg);
}
.price-board::before {
  content: "";
  position: absolute;
  width: 460px; height: 460px;
  top: -220px; inset-inline-end: -160px;
  background: radial-gradient(circle, color-mix(in srgb, var(--pb-accent) 35%, transparent), transparent 70%);
  pointer-events: none;
}
.price-board-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; position: relative; z-index: 1; flex-wrap: wrap; }
.price-board-brand { display: flex; align-items: center; gap: 14px; }
.price-board-logo {
  width: 54px; height: 54px; border-radius: 16px; flex-shrink: 0;
  background: color-mix(in srgb, var(--pb-fg) 8%, transparent); overflow: hidden;
  display: grid; place-items: center; font-weight: 800; font-size: 18px;
}
.price-board-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.price-board-name { font-size: 21px; font-weight: 800; letter-spacing: -0.2px; }
.price-board-clock { text-align: end; }
.price-board-time { font-size: 25px; font-weight: 800; font-family: var(--pb-num-font, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace); letter-spacing: 0.4px; }
.price-board-date { font-size: 13px; color: color-mix(in srgb, var(--pb-fg) 55%, transparent); margin-top: 2px; }

.price-board-live {
  display: flex; align-items: center; gap: 8px; margin: 24px 0 18px;
  font-size: 13px; color: color-mix(in srgb, var(--pb-fg) 65%, transparent); position: relative; z-index: 1;
}
.price-board-live strong { color: var(--pb-fg); font-weight: 800; }
.price-board-sep { opacity: 0.4; }
.price-live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #3ddc73; flex-shrink: 0;
  animation: priceLivePulse 1.6s infinite;
}
@keyframes priceLivePulse {
  0% { box-shadow: 0 0 0 0 rgba(61, 220, 115, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(61, 220, 115, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 220, 115, 0); }
}

.price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; position: relative; z-index: 1; }
.price-grid.pb-cols-2 { grid-template-columns: repeat(2, 1fr); }
.price-grid.pb-cols-3 { grid-template-columns: repeat(3, 1fr); }
.price-grid.pb-cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 760px) { .price-grid.pb-cols-3, .price-grid.pb-cols-4 { grid-template-columns: repeat(2, 1fr); } }
.price-card {
  background: color-mix(in srgb, var(--pb-fg) 5%, transparent); border: 1px solid color-mix(in srgb, var(--pb-fg) 8%, transparent);
  border-radius: 18px; padding: 22px 16px; text-align: center;
}
.price-card.highlight {
  background: linear-gradient(160deg, color-mix(in srgb, var(--pb-accent) 22%, transparent), color-mix(in srgb, var(--pb-accent) 5%, transparent));
  border-color: color-mix(in srgb, var(--pb-accent) 45%, transparent);
}
.price-board.cardstyle-solid .price-card {
  background: color-mix(in srgb, var(--pb-bg) 60%, #000 15%); border-color: transparent;
}
.price-board.cardstyle-solid .price-card.highlight {
  background: color-mix(in srgb, var(--pb-accent) 28%, var(--pb-bg) 60%); border-color: transparent;
}
.price-board.cardstyle-outline .price-card {
  background: transparent; border-color: color-mix(in srgb, var(--pb-fg) 20%, transparent);
}
.price-board.cardstyle-outline .price-card.highlight {
  background: transparent; border-color: var(--pb-accent);
}
.price-card-carat {
  display: inline-block; font-size: clamp(18px, 3vw, 22px); font-weight: 800; letter-spacing: .2px;
  color: color-mix(in srgb, var(--pb-fg) 75%, transparent);
  background: color-mix(in srgb, var(--pb-fg) 10%, transparent);
  padding: 5px 16px; border-radius: 999px; margin-bottom: 14px;
}
.price-card.highlight .price-card-carat { color: var(--pb-bg); background: var(--pb-accent); }
.price-board.cardstyle-outline .price-card-carat { background: transparent; border: 1px solid color-mix(in srgb, var(--pb-fg) 25%, transparent); }
.price-board.cardstyle-outline .price-card.highlight .price-card-carat { color: var(--pb-accent); background: transparent; border-color: var(--pb-accent); }
.price-card-value { font-size: clamp(26px, 4vw, 38px); font-weight: 800; font-family: var(--pb-num-font, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace); letter-spacing: -0.5px; }
.price-card-unit { font-size: 12px; color: color-mix(in srgb, var(--pb-fg) 45%, transparent); margin-top: 6px; }

.price-board-foot { margin-top: 26px; text-align: center; font-size: 12px; color: color-mix(in srgb, var(--pb-fg) 35%, transparent); position: relative; z-index: 1; }

/* Font presets */
.price-board.font-elegant { font-family: Georgia, 'Times New Roman', serif; }
.price-board.font-elegant .price-board-time, .price-board.font-elegant .price-card-value { --pb-num-font: Georgia, 'Times New Roman', serif; }
.price-board.font-modern { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.price-board.font-modern .price-board-time, .price-board.font-modern .price-card-value { --pb-num-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.price-board.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.price-markup-card { margin-top: 16px; padding: 18px 22px; max-width: 460px; }
.price-markup-card label { margin-top: 0; }
.price-markup-hint { font-size: 12px; color: var(--muted); margin: 0 0 4px; }
.price-markup-row { display: flex; gap: 10px; align-items: flex-start; }
.price-markup-row input { flex: 1; }
.set-pw-row { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; }
.set-pw-row input { flex: 1; }

.price-board-settings-card { margin-top: 16px; padding: 22px 24px; max-width: 640px; }
.price-board-settings-card label { margin-top: 0; }
.price-board-settings-card .settings-block { margin-top: 18px; }
.price-board-settings-card .settings-block:first-of-type { margin-top: 0; }
.field-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.field-row-3 > div label { margin: 0 0 6px; }
@media (max-width: 560px) { .field-row-3 { grid-template-columns: 1fr; } }
.toggle-row { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 14px; }

.price-exit-btn {
  display: none;
  position: absolute; top: 18px; inset-inline-end: 18px; z-index: 5;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.08);
  color: #fff; align-items: center; justify-content: center; cursor: pointer;
}
.price-exit-btn:hover { background: rgba(255, 255, 255, 0.16); }

/* Presentation / kiosk mode — fills the whole screen, hides dashboard chrome */
body.price-kiosk #sidebar,
body.price-kiosk .topbar,
body.price-kiosk section[data-view="prices"] > .row-between { display: none !important; }
body.price-kiosk main { padding: 0; margin: 0; max-width: none; }
body.price-kiosk .price-board {
  position: fixed; inset: 0; z-index: 999; border-radius: 0;
  padding: 5vh 6vw; display: flex; flex-direction: column; justify-content: center;
}
body.price-kiosk .price-exit-btn { display: flex; }
body.price-kiosk .price-grid { gap: 22px; }
body.price-kiosk .price-card { padding: 32px 20px; }
body.price-kiosk .price-card-value { font-size: clamp(34px, 5.6vw, 60px); }
body.price-kiosk .price-card-carat { font-size: clamp(20px, 2.4vw, 28px); padding: 7px 22px; }
body.price-kiosk .price-board-name { font-size: clamp(22px, 2.6vw, 30px); }
body.price-kiosk .price-board-time { font-size: clamp(24px, 3vw, 34px); }
.list { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }
.item-card {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); transition: .15s;
}
.item-card.clickable { cursor: pointer; }
.item-card.clickable:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-1px); }
.item-card .av {
  width: 44px; height: 44px; border-radius: 50%; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--primary), #7c6cff);
  display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 15px;
}
.item-card .meta { flex: 1; min-width: 0; }
.item-card .nm { font-weight: 700; font-size: 15px; }
.item-card .sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.grid { margin-top: 22px; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.store-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; cursor: pointer; box-shadow: var(--shadow-sm); transition: .15s;
}
.store-card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-2px); }
.store-card .s-ico {
  width: 46px; height: 46px; border-radius: 12px; margin-bottom: 14px;
  background: var(--primary-50); color: var(--primary); display: grid; place-items: center; font-size: 22px;
}
.store-card .s-name { font-weight: 800; font-size: 17px; margin-bottom: 4px; }
.store-card .s-meta { color: var(--muted); font-size: 13px; }
.store-card .s-foot { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.store-card .s-id { color: var(--faint); font-size: 11px; font-family: ui-monospace, monospace; }

/* full-page store view */
.store-hero { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 6px; }
.store-hero .hero-ico { width: 64px; height: 64px; border-radius: 16px; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; flex: 0 0 auto; }
.store-hero .hero-meta { flex: 1; min-width: 200px; }
.store-hero .hero-name { font-size: 27px; font-weight: 800; letter-spacing: -.3px; }
.store-hero .hero-sub { color: var(--muted); font-size: 14px; margin-top: 3px; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin: 22px 0; }
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px 20px; }
.stat-tile .num { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-tile .lbl { color: var(--muted); font-size: 13px; font-weight: 600; margin-top: 8px; }

/* store logo + crop editor */
.logo-edit { display: flex; align-items: center; gap: 16px; margin-top: 6px; }
.logo-preview { width: 84px; height: 84px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; display: grid; place-items: center; color: var(--faint); flex: 0 0 auto; }
.logo-preview img { width: 100%; height: 100%; object-fit: cover; }
.cropper { width: 300px; height: 300px; max-width: 100%; aspect-ratio: 1; margin: 10px auto 0; border-radius: 50%; overflow: hidden; position: relative; background: var(--surface-2); cursor: grab; touch-action: none; box-shadow: inset 0 0 0 2px var(--border); }
.cropper.square { border-radius: 14px; }
.cropper.dragging { cursor: grabbing; }
.cropper img { position: absolute; top: 0; inset-inline-start: 0; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.zoom-row { display: flex; align-items: center; gap: 12px; width: 300px; max-width: 100%; margin: 16px auto 0; }
.zoom-row input[type=range] { flex: 1; accent-color: var(--primary); }
.zoom-row .ic-zoom { color: var(--muted); font-weight: 800; width: 14px; text-align: center; font-size: 18px; }

/* ---------- Pills / status ---------- */
.pill { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill.indigo { background: var(--primary-50); color: var(--primary); }
.pill.gray { background: #f1f3f7; color: var(--muted); }
.pill.green { background: var(--ok-50); color: var(--ok); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-50); }
.dot.off { background: var(--faint); }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---------- Info rows ---------- */
.info-row { display: flex; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.info-row:last-child { border-bottom: 0; }
.info-row .k { color: var(--muted); font-size: 14px; }
.info-row .v { font-weight: 700; font-size: 14px; text-align: end; word-break: break-word; }
.panel { padding: 4px 20px; }

/* ---------- Modal ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(17,24,39,.45); backdrop-filter: blur(2px);
  display: none; place-items: center; z-index: 50; padding: 20px;
}
.modal-bg.show { display: grid; animation: fade .15s ease; }
.modal {
  width: 100%; max-width: 440px; background: var(--surface);
  border-radius: 18px; padding: 26px; box-shadow: var(--shadow-lg);
  max-height: calc(100vh - 40px); overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.modal h3 { margin: 0 0 4px; font-size: 20px; font-weight: 800; }
.modal .sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.modal-actions { display: flex; gap: 10px; margin-top: 24px; }
.modal-actions .btn { flex: 1; }
.pop { max-width: 340px; }
.pop .modal-actions { flex-direction: column; }

/* Side panel variant — a full-height drawer sliding in from the edge,
   instead of a centered popup. Used for the category icon/photo editor,
   which has enough sub-controls (photo, color, icon grid) to deserve more
   room than a small modal. */
#catIconModal.show { display: flex; justify-items: stretch; align-items: stretch; justify-content: flex-end; padding: 0; }
[dir="rtl"] #catIconModal.show { justify-content: flex-start; }
.side-panel {
  width: 440px; max-width: 100vw; max-height: none; height: 100%;
  border-radius: 0; padding: 26px; display: flex; flex-direction: column;
  animation: sidePanelIn .22s ease;
}
.side-panel .modal-actions { margin-top: auto; padding-top: 18px; }
@keyframes sidePanelIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
[dir="rtl"] .side-panel { animation-name: sidePanelInRtl; }
@keyframes sidePanelInRtl { from { transform: translateX(-100%); } to { transform: translateX(0); } }
@media (max-width: 560px) { .side-panel { width: 100%; } }
.empty, .loading-txt { color: var(--muted); padding: 22px 0; text-align: center; }
.section-label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--faint); margin: 22px 0 10px; }

/* ---------- Save bar — floating centered pill ---------- */
.dirty-bar {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 45;
  display: flex; align-items: center; gap: 10px;
  background: var(--text); color: #fff;
  padding: 8px 8px 8px 20px;
  border-radius: 999px;
  box-shadow: 0 8px 32px rgba(16, 24, 40, .38), 0 2px 8px rgba(16, 24, 40, .18);
  white-space: nowrap; max-width: calc(100vw - 32px);
  animation: dirtyBarIn .22s cubic-bezier(.34,1.26,.64,1);
}
.dirty-bar-text { font-size: 13px; font-weight: 700; flex-shrink: 1; overflow: hidden; text-overflow: ellipsis; }
.dirty-bar-actions { display: flex; gap: 6px; flex-shrink: 0; }
.dirty-bar .btn { border-radius: 999px; padding: 9px 18px; font-size: 13px; }
.dirty-bar .btn.ghost { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.22); color: #fff; }
.dirty-bar .btn.ghost:hover { background: rgba(255,255,255,.2); }
.dirty-bar .btn:not(.ghost) { background: linear-gradient(135deg, var(--primary), #7c6cff); border: 0; }
.dirty-bar .btn:not(.ghost):hover { background: linear-gradient(135deg, var(--primary-600), #6a5cf0); }
@keyframes dirtyBarIn {
  from { transform: translateX(-50%) translateY(16px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);   opacity: 1; }
}
@media (max-width: 560px) {
  .dirty-bar { bottom: calc(16px + env(safe-area-inset-bottom)); left: 50%; right: auto; }
}

/* ---------- Save summary modal ---------- */
.save-summary-list { max-height: 50vh; overflow-y: auto; margin: 4px 0 6px; }
.save-summary-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.save-summary-row:last-child { border-bottom: 0; }
.save-summary-row span:first-child { color: var(--muted); font-weight: 600; flex-shrink: 0; }
.save-summary-row b { font-weight: 700; text-align: end; word-break: break-word; }
.save-summary-row.save-add b, .save-summary-row.save-add span:first-child { color: var(--ok); }
.save-summary-row.save-remove span:first-child { color: var(--danger); font-weight: 700; }
.save-summary-swatches { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; color: var(--faint); }
.save-summary-swatch { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--border-strong); flex-shrink: 0; }
.save-summary-gap { width: 6px; flex-shrink: 0; }
.save-summary-actions { flex-wrap: wrap; }
.save-summary-actions .btn { flex: 1 1 calc(50% - 5px); }
.save-summary-actions #saveSummaryConfirm { flex: 1 1 100%; order: -1; }

#loading { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }

/* ---------- Receipt builder ---------- */
.builder { max-width: 980px; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 22px 24px; margin-bottom: 18px; }
.step.locked { opacity: .55; pointer-events: none; filter: grayscale(.3); }
.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.step-num {
  width: 26px; height: 26px; border-radius: 50%; background: var(--primary-50); color: var(--primary);
  display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: 0 0 auto;
}
.step-head h3 { margin: 0; font-size: 16px; font-weight: 800; }
.seg { display: flex; gap: 10px; flex-wrap: wrap; }
.seg .btn { flex: 1; min-width: 140px; }
.lock-note { color: var(--faint); font-size: 13px; margin: 6px 0 0; }
.scan-box {
  border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 26px;
  text-align: center; color: var(--muted); margin-top: 12px;
}
.scan-box .pulse { font-size: 30px; animation: pulse 1.1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.cust-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.items-wrap { overflow-x: auto; }
/* multi-field item block */
.item-block { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; background: var(--surface-2); }
.item-block .ib-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.item-block .ib-title { font-weight: 800; font-size: 12px; color: var(--muted); letter-spacing: .5px; }
.item-block .rm { border: 1px solid var(--border-strong); background: var(--surface); color: var(--danger); width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.item-block .rm:hover { background: var(--danger-50); }
.item-block .ib-num { background: var(--primary-50); color: var(--primary); font-weight: 800; padding: 4px 12px; border-radius: 999px; font-size: 12px; }
.ig-group { margin-top: 18px; }
.ig-group.ig-item { display: grid; grid-template-columns: 1fr 2fr; gap: 8px 14px; margin-top: 2px; }
@media (max-width: 560px) { .ig-group.ig-item { grid-template-columns: 1fr; } }
.ig-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--faint); margin-bottom: 10px; padding-bottom: 7px; border-bottom: 1px solid var(--border); }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 14px; }
.field-grid .fg { display: flex; flex-direction: column; }
.field-grid label { margin: 0 0 4px; font-size: 11px; }
.field-grid input, .field-grid select { padding: 9px 10px; font-size: 13px; }
.field-grid input[readonly] { background: var(--primary-50); color: var(--primary); font-weight: 800; border-color: var(--primary-100); }
.input-scan { display: flex; gap: 8px; align-items: stretch; }
.input-scan input { flex: 1; min-width: 0; }
.scan-qr { flex: 0 0 auto; width: 42px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); border-radius: var(--radius-sm); cursor: pointer; display: grid; place-items: center; transition: .15s; }
.scan-qr:hover { border-color: var(--primary); color: var(--primary); }
.scan-qr.scanning { background: var(--primary-50); border-color: var(--primary); color: var(--primary); }
.scan-qr .ic { width: 18px; height: 18px; }
.item-row {
  display: grid; grid-template-columns: 1.1fr 1.6fr .9fr .9fr 36px; gap: 10px; align-items: end;
  padding: 10px 0; border-bottom: 1px dashed var(--border);
}
.item-row label { margin: 0 0 4px; font-size: 11px; }
.item-row .rm {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--danger);
  width: 36px; height: 40px; border-radius: var(--radius-sm); cursor: pointer; font-size: 16px;
}
.item-row .rm:hover { background: var(--danger-50); }
@media (max-width: 640px) { .item-row { grid-template-columns: 1fr 1fr; } .item-row .rm { grid-column: span 2; width: 100%; } }
.totals { display: flex; gap: 28px; flex-wrap: wrap; align-items: center; margin-top: 18px; padding: 16px 20px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.totals .t { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.totals .t b { display: block; color: var(--text); font-size: 18px; margin-top: 4px; letter-spacing: 0; }
.totals .t.main { margin-inline-start: auto; text-align: end; }
.totals .t.main b { color: var(--primary); font-size: 24px; }

/* receipt list rows reuse .item-card; add a status pill colors via .pill */
.receipt-meta { text-align: end; }
.receipt-meta .amt { font-weight: 800; }
.receipt-meta .when { color: var(--muted); font-size: 12px; }

/* ---------- Finance ---------- */
.finance-heading { align-items: flex-start; }
.finance-heading .page-sub { margin-bottom: 0; }
.finance-filters { padding: 18px 20px; margin: 22px 0; }
.finance-filter-grid { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); gap: 12px; align-items: end; }
.finance-filter-grid label { margin-top: 0; }
.finance-search-field { grid-column: span 2; }
.finance-filter-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; color: var(--muted); font-size: 12px; }
.finance-stats { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)); gap: 14px; margin: 20px 0; }
.finance-stats .stat-tile { min-width: 0; }
.finance-stats .num { font-size: 24px; overflow-wrap: anywhere; }
.finance-stats .danger-num { color: var(--danger); }
.finance-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.finance-panel { padding: 20px; min-width: 0; }
.finance-section { margin-top: 16px; }
.finance-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.finance-panel-head h3 { margin: 0; font-size: 17px; }
.finance-panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.finance-panel-head > span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.statement-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.statement-row:last-child { border-bottom: 0; }
.statement-row span { color: var(--muted); }
.statement-row.total { margin: 4px -8px; padding: 12px 8px; border: 0; border-radius: 8px; background: var(--primary-50); color: var(--primary); font-size: 15px; }
.statement-row.total span { color: var(--primary); font-weight: 800; }
.table-scroll { overflow-x: auto; }
.finance-table { width: 100%; border-collapse: collapse; font-size: 12.5px; white-space: nowrap; }
.finance-table th { padding: 10px 12px; text-align: start; color: var(--faint); font-size: 10px; text-transform: uppercase; letter-spacing: .4px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.finance-table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.finance-table tbody tr:last-child td { border-bottom: 0; }
.finance-table .empty-cell { text-align: center; color: var(--muted); padding: 24px; }
.clickable-row { cursor: pointer; transition: background .15s; }
.clickable-row:hover { background: var(--primary-50); }
.cell-sub { display: block; color: var(--faint); font-size: 11px; margin-top: 2px; }
.month-bars { display: flex; flex-direction: column; gap: 12px; }
.month-row { display: grid; grid-template-columns: 92px minmax(100px, 1fr) 210px; gap: 14px; align-items: center; }
.month-label { font-size: 12px; font-weight: 800; }
.month-track { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.month-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #7c6cff); }
.month-values { display: flex; flex-direction: column; align-items: flex-end; }
.month-values b { font-size: 13px; }
.month-values span { color: var(--muted); font-size: 10px; }

@media (max-width: 900px) {
  .finance-filter-grid { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
  .finance-search-field { grid-column: span 2; }
  .finance-two-col { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .finance-heading .btn { width: 100%; }
  .finance-filter-grid, .finance-stats { grid-template-columns: 1fr; }
  .finance-search-field { grid-column: auto; }
  .finance-filter-foot { align-items: stretch; flex-direction: column; }
  .month-row { grid-template-columns: 78px 1fr; }
  .month-values { grid-column: 1 / -1; align-items: flex-start; }
}

/* ---------- PDF template (rendered off-screen) ---------- */
#pdfStage { position: fixed; inset-inline-start: -10000px; top: 0; }
.receipt-doc {
  width: 794px; min-height: 1123px; background: #fff; color: #111827; padding: 54px 56px;
  font-family: 'Cairo', sans-serif; box-sizing: border-box;
}
.receipt-doc .rd-top { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid #4f46e5; padding-bottom: 22px; }
.receipt-doc .rd-store { font-size: 30px; font-weight: 800; color: #111827; }
.receipt-doc .rd-sub { color: #6b7280; font-size: 14px; margin-top: 6px; }
.receipt-doc .rd-badge { text-align: end; }
.receipt-doc .rd-badge .lbl { color: #4f46e5; font-weight: 800; letter-spacing: 2px; font-size: 22px; }
.receipt-doc .rd-badge .no { color: #6b7280; font-size: 13px; margin-top: 6px; }
.receipt-doc .rd-grid { display: flex; justify-content: space-between; gap: 24px; margin: 26px 0; }
.receipt-doc .rd-block .h { font-size: 11px; font-weight: 800; letter-spacing: 1px; color: #9ca3af; text-transform: uppercase; margin-bottom: 6px; }
.receipt-doc .rd-block .v { font-size: 15px; font-weight: 700; }
.receipt-doc .rd-block .vv { font-size: 13px; color: #374151; }
.receipt-doc table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.receipt-doc th { background: #f3f4f8; color: #374151; font-size: 10px; text-transform: uppercase; letter-spacing: .3px; padding: 8px 7px; text-align: start; white-space: nowrap; }
.receipt-doc td { padding: 9px 7px; border-bottom: 1px solid #eceef3; font-size: 11.5px; }
.receipt-doc tfoot td { font-weight: 800; border-top: 2px solid #111827; border-bottom: 0; }
.receipt-doc .rd-pay { margin-top: 26px; display: flex; justify-content: space-between; align-items: center; }
.receipt-doc .rd-chip { background: #eef2ff; color: #4f46e5; font-weight: 800; padding: 8px 16px; border-radius: 999px; font-size: 14px; }
.receipt-doc .rd-remarks { margin-top: 22px; background: #f9fafb; border: 1px solid #eceef3; border-radius: 10px; padding: 14px 16px; font-size: 13px; color: #374151; }
.receipt-doc .rd-foot { margin-top: 48px; padding-top: 18px; border-top: 1px solid #eceef3; text-align: center; color: #9ca3af; font-size: 13px; }

/* ---------- Products ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; margin: 18px 0; flex-wrap: wrap; }
.toolbar .search { flex: 1; min-width: 200px; }

/* search + circular filter button + popovers */
.search-wrap { position: relative; display: flex; gap: 10px; align-items: center; margin: 18px 0; }
.search-wrap .search { flex: 1; }
.filter-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); display: grid; place-items: center; cursor: pointer; flex: 0 0 auto; position: relative; transition: .15s; }
.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active { background: var(--primary-50); border-color: var(--primary); color: var(--primary); }
.filter-btn .badge-dot { position: absolute; top: 3px; inset-inline-end: 3px; width: 9px; height: 9px; border-radius: 50%; background: var(--primary); border: 2px solid var(--surface); display: none; }
.filter-btn.active .badge-dot { display: block; }
.filter-panel { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; width: 250px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 16px; z-index: 25; display: none; }
.filter-panel.show { display: block; }
.filter-panel label { margin: 14px 0 6px; }
.filter-panel label:first-child { margin-top: 0; }

.suggest { position: absolute; top: calc(100% + 8px); inset-inline-start: 0; inset-inline-end: 54px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 26; display: none; max-height: 300px; overflow-y: auto; }
.suggest.show { display: block; }
.suggest-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.suggest-item:hover, .suggest-item.active { background: var(--surface-2); }
.suggest-item .sval { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-item .stype { font-size: 10px; color: var(--faint); font-weight: 800; text-transform: uppercase; letter-spacing: .4px; flex: 0 0 auto; }
mark.hl { background: var(--primary-100); color: var(--primary-600); padding: 0 2px; border-radius: 3px; }
.cat-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 18px; }
.cat-chip { border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); padding: 8px 16px; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 700; transition: .15s; }
.cat-chip:hover { border-color: var(--primary); color: var(--primary); }
.cat-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.products-header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.product-card { overflow: hidden; padding: 0; }
.product-card .thumb {
  width: 100%; height: 168px; object-fit: cover; display: block; background: var(--surface-2);
}
.product-card .thumb.ph { display: grid; place-items: center; font-size: 40px; color: var(--faint); }
.product-card .pc-body { padding: 14px 16px; }
.product-card .pc-name { font-weight: 800; font-size: 15px; margin-bottom: 4px; }
.product-card .pc-meta { color: var(--muted); font-size: 13px; }
.product-card .pc-foot { margin-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.product-card .pc-code { font-family: ui-monospace, monospace; font-size: 11px; color: var(--faint); }

/* photo upload + gallery */
.photo-grid { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.photo-thumb { width: 86px; height: 86px; border-radius: 10px; object-fit: cover; border: 1px solid var(--border); position: relative; }
.photo-add {
  width: 86px; height: 86px; border-radius: 10px; border: 2px dashed var(--border-strong);
  display: grid; place-items: center; cursor: pointer; color: var(--muted); font-size: 24px; background: var(--surface-2);
}
.photo-add:hover { border-color: var(--primary); color: var(--primary); }
.photo-hint { font-size: 11.5px; color: var(--muted); margin: -4px 0 8px; }
.thumb-wrap {
  position: relative; touch-action: none; cursor: grab; border-radius: 10px;
  transition: box-shadow .15s, transform .15s;
}
.thumb-wrap.dragging {
  cursor: grabbing; z-index: 30; box-shadow: var(--shadow-lg); transform-origin: center;
}
.thumb-wrap.dragging .photo-thumb { opacity: .9; }
.photo-drop-placeholder { border: 2px dashed var(--border-strong); background: var(--surface-2); border-radius: 10px; }

/* order section (set display position among category siblings) */
.order-section { margin: 4px 0 14px; }
.order-list { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; padding: 2px; }
.order-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); touch-action: none; cursor: grab;
  transition: box-shadow .15s;
}
.order-row.dragging { cursor: grabbing; z-index: 30; box-shadow: var(--shadow-lg); }
.order-row.current { border-color: var(--primary); background: var(--primary-50); }
.order-thumb { width: 36px; height: 36px; border-radius: 8px; background: var(--surface-2); flex-shrink: 0; overflow: hidden; }
.order-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.order-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-row.current .order-name { font-weight: 800; color: var(--primary-600); }
.order-current-badge {
  flex-shrink: 0; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .3px;
  color: #fff; background: var(--primary); padding: 3px 8px; border-radius: 999px;
}
.order-drop-placeholder { border: 2px dashed var(--primary); background: var(--primary-50); }
.thumb-wrap .x {
  position: absolute; top: -6px; inset-inline-end: -6px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--danger); color: #fff; border: 0; cursor: pointer; font-size: 12px; line-height: 1; z-index: 1;
}
.cover-badge {
  position: absolute; bottom: 4px; inset-inline-start: 4px; inset-inline-end: 4px;
  background: rgba(17, 24, 39, .72); color: #fff; font-size: 9.5px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .4px; text-align: center; padding: 3px 2px;
  border-radius: 5px; pointer-events: none;
}

/* sizes editor — each size is its own card with a label, weight, barcode
   and stock, since every size can have a different physical weight (and
   therefore price) and needs its own scannable barcode. */
.sizes-editor { margin: 2px 0 14px; }
.size-rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.size-row {
  padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
}
.size-row-head { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.size-row .size-label { flex: 1; min-width: 0; }
.size-row .x {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--danger); cursor: pointer; font-size: 13px;
}
.size-row .x:hover { background: var(--danger-50); }
.size-row-grid { grid-template-columns: repeat(3, 1fr); gap: 8px 10px; }
.size-row-grid .fg { gap: 0; }
@media (max-width: 480px) {
  .size-row-grid { grid-template-columns: 1fr 1fr; }
  .size-row-grid .size-code-fg { grid-column: 1 / -1; }
}

/* product detail: per-size weight/barcode/stock table */
.pv-sizes { margin-top: 14px; }
.pv-sizes-head { font-weight: 800; font-size: 13.5px; margin-bottom: 10px; }
.pv-sizes-table { display: flex; flex-direction: column; }
.pv-sizes-row {
  display: grid; grid-template-columns: 1fr 1fr 1.4fr .7fr; gap: 8px;
  padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.pv-sizes-row:last-child { border-bottom: 0; }
.pv-sizes-row-head { color: var(--muted); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.pv-sizes-row .mono { font-family: ui-monospace, monospace; font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
.gallery { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.gallery img { width: 130px; height: 130px; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); flex: 0 0 auto; }
.gallery .ph { width: 130px; height: 130px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-size: 34px; color: var(--faint); }
.pill.amber { background: #fff7ed; color: var(--warn); }
.pill.red { background: var(--danger-50); color: var(--danger); }

/* ---------- Admin impersonation banner (platform admin browsing a store) ---------- */
.admin-impersonation-banner {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  background: var(--text); color: #fff;
  padding: 10px 22px; font-size: 13px; font-weight: 700;
}
.admin-impersonation-banner a, .admin-impersonation-banner button.link {
  color: #fff; text-decoration: underline; background: none; border: 0; cursor: pointer; font: inherit; padding: 0;
}

/* ---------- Billing (platform-admin only) ---------- */
.billing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 14px; }
.billing-stat { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); padding: 16px 18px; }
.billing-stat .lbl { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 8px; }
.billing-stat .val { font-size: 18px; font-weight: 800; }
.billing-stat .val.danger { color: var(--danger); }
.billing-countdown { display: flex; gap: 10px; flex-wrap: wrap; }
.billing-countdown .seg { text-align: center; min-width: 56px; }
.billing-countdown .seg b { display: block; font-size: 22px; font-weight: 800; }
.billing-countdown .seg span { font-size: 11px; color: var(--muted); font-weight: 700; }
.billing-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.btn.danger-solid { background: var(--danger); color: #fff; border: 0; }
.btn.danger-solid:hover { background: #b91c1c; }
.btn.ok-solid { background: var(--ok); color: #fff; border: 0; }
.btn.ok-solid:hover { background: #15803d; }

/* ---------- Subscription-ended lock (shown to the real store account) ---------- */
.sub-lock-overlay {
  position: fixed; inset: 0; z-index: 9000; pointer-events: none;
  box-shadow: inset 0 0 0 6px var(--danger);
}
.sub-banner {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; text-align: center;
  background: var(--danger); color: #fff;
  padding: 14px 22px; box-shadow: 0 -8px 24px rgba(16, 24, 40, .25);
}
.sub-banner .btn { background: #fff; color: var(--danger); border: 0; flex-shrink: 0; }
.sub-banner .btn:hover { background: #fff5f5; }
body.subscription-locked main { padding-bottom: 110px; }
@media (max-width: 560px) {
  .sub-banner { flex-direction: column; }
}

/* ---------- Prices locked (subscription unpaid) ---------- */
.prices-locked-card { text-align: center; padding: 46px 20px; }
.prices-locked-card .ic-wrap {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%;
  background: var(--danger-50); display: grid; place-items: center; color: var(--danger);
}
.prices-locked-card h3 { margin: 0 0 6px; font-size: 18px; }
.prices-locked-card p { margin: 0; color: var(--muted); }

/* ---------- Stats (storefront analytics) ---------- */
.stats-kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); gap: 14px; margin: 20px 0; }
.stats-kpi-grid .stat-tile { min-width: 0; }
.stats-kpi-grid .num { font-size: 24px; overflow-wrap: anywhere; }
.stats-empty-card { text-align: center; padding: 22px 20px; color: var(--muted); font-size: 13.5px; margin-bottom: 20px; }
.stats-empty-card p { margin: 0; }
.stats-charts-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; margin-bottom: 20px; }
.stats-chart-card { padding: 20px 22px; }
.stats-chart-card h3 { margin: 0; font-size: 15px; font-weight: 800; }
.stats-chart-sub { margin: 4px 0 14px; color: var(--muted); font-size: 12px; }
.stats-period-group { display: flex; gap: 8px; flex-wrap: wrap; }
.stats-period-group .cat-chip { padding: 6px 13px; font-size: 12px; }
.stats-bars { display: flex; align-items: flex-end; gap: 4px; height: 150px; }
.stats-bar { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.stats-bar-fill { width: 100%; max-width: 22px; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, var(--primary), #7c6cff); min-height: 2px; transition: height .3s ease; }
.stats-bar-label { font-size: 10px; color: var(--faint); font-weight: 700; white-space: nowrap; }
.stats-bars-hourly .stats-bar-fill { max-width: 10px; background: linear-gradient(180deg, #7c6cff, var(--primary)); }
.stats-products-card { padding: 20px 22px; }
.stats-products-card h3 { margin: 0 0 14px; font-size: 15px; font-weight: 800; }
.stats-product-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.stats-product-row:last-child { border-bottom: 0; }
.stats-product-thumb { width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); flex-shrink: 0; overflow: hidden; }
.stats-product-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stats-product-name { flex: 1; min-width: 0; font-weight: 700; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-product-views { color: var(--muted); font-size: 12.5px; font-weight: 700; flex-shrink: 0; }
@media (max-width: 900px) {
  .stats-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-charts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stats-kpi-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- Dashboard mobile polish (admin + store dashboards; storefront pages are untouched) ---------- */
@media (max-width: 760px) {
  main { padding: 18px 14px; }
  .page-title { font-size: 21px; }
  .card { border-radius: 12px; }
  .form-card, .price-board-settings-card { padding: 18px; }
  .price-board { padding: 22px 18px; }
  .modal-bg { padding: 12px; align-items: flex-end; }
  .modal { border-radius: 16px 16px 0 0; max-height: 88vh; }
  .modal-actions { flex-wrap: wrap; }
  /* iOS Safari zooms the whole page on focus when a field's font is under
     16px — bump it up just on small screens so tapping a field doesn't
     trigger that jarring zoom/scroll jump. */
  input, select, textarea { font-size: 16px; }
  .toolbar .search, .search-wrap .search { min-width: 0; }

  /* More breathing room between stacked sections — the main fix for a
     "crowded" feel is spacing, not less content. */
  .page-sub { margin: 0 0 22px; font-size: 13px; }
  .section-label { margin: 26px 0 12px; }
  .toolbar { margin: 20px 0; }
  .search-wrap { margin: 16px 0; }
  .cat-chips { margin: 0 0 20px; }
  .list, .grid { margin-top: 18px; }
  .stats-charts-grid, .stats-products-card { margin-top: 18px; }

  /* Topbar: tighter padding and a truncated store name so it doesn't feel
     squeezed next to the language toggle on narrow screens. */
  .topbar { padding: 8px 12px; }
  .user-btn span:not(.avatar):not(.caret) { max-width: 88px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Stat tiles: lighter, less "boxed" card — shadow instead of a heavy
     border, tighter padding, calmer label. */
  .stats-kpi-grid { gap: 10px; margin: 16px 0; }
  .stat-tile { border: 0; box-shadow: var(--shadow-sm); padding: 14px 16px; border-radius: 12px; }
  .stat-tile .num { font-size: 22px; }
  .stat-tile .lbl { font-size: 11.5px; letter-spacing: .2px; opacity: .85; margin-top: 6px; }

  /* Products page header: keep both actions readable, just tighter. */
  .products-header-actions { gap: 8px; }
  .products-header-actions .btn { padding: 9px 14px; font-size: 13px; }

  /* Product cards: a compact horizontal row (thumbnail beside the text)
     instead of a tall stacked card, so more fits without feeling bulky. */
  .grid { grid-template-columns: 1fr; gap: 10px; }
  .product-card { display: flex; align-items: stretch; }
  .product-card .thumb { width: 84px; height: 84px; flex: 0 0 auto; }
  .product-card .pc-body { flex: 1; min-width: 0; padding: 10px 12px; display: flex; flex-direction: column; justify-content: center; }
  .product-card .pc-foot { margin-top: 6px; }

  /* Add/edit product: full-screen takeover instead of a cramped popup —
     this form (photos, sizes, etc.) is too long for a bottom sheet. */
  #productModal.show { padding: 0; align-items: stretch; }
  #productModal .modal {
    width: 100%; max-width: none; height: 100%; max-height: none;
    border-radius: 0; padding: 16px; display: flex; flex-direction: column;
  }
  #productModal #productForm { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  #productModal .modal-scroll-body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  #productModal .modal-actions { flex-shrink: 0; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }

  /* Adjust photo (crop): also full-screen, with a bigger crop area since
     there's a whole screen of room instead of a cramped popup. */
  #cropModal.show { padding: 0; align-items: stretch; }
  #cropModal .modal {
    width: 100%; max-width: none; height: 100%; max-height: none;
    border-radius: 0; display: flex; flex-direction: column; justify-content: center;
  }
  #cropModal .cropper { width: min(86vw, 420px); height: min(86vw, 420px); }
  #cropModal .zoom-row { width: min(86vw, 420px); }
}
@media (max-width: 380px) {
  .sidebar { width: min(var(--sidebar-w), 84vw); }
}
