/* ============================================================================
   HuluTerra — Shared design system
   Plain CSS layered on top of Tailwind utilities. Component classes keep the
   page HTML terse and the look consistent across all four interfaces.
   ============================================================================ */

/* ---------- Base ---------- */
html { scroll-behavior: smooth; }
/* Typography — two language tracks via per-glyph font fallback:
   English renders in Manrope (body) / Sora (headings); Amharic/Ethiopic
   glyphs fall through to Noto Sans Ethiopic (body) / Noto Serif Ethiopic
   (headings) automatically, since the Latin faces have no Ethiopic glyphs. */
body {
  font-family: 'Manrope', 'Noto Sans Ethiopic', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}
h1, h2, h3, h4, h5, h6 {
  font-family: 'Sora', 'Noto Serif Ethiopic', 'Manrope', 'Noto Sans Ethiopic', ui-sans-serif, system-ui, sans-serif;
}
/* Ethiopic script is wide — never let utility letter-spacing (tracking-tight
   etc.) cramp Amharic headings. Applied whenever the document is in Amharic. */
html[lang="am"] h1, html[lang="am"] h2, html[lang="am"] h3, html[lang="am"] h4,
html[lang="am"] h5, html[lang="am"] h6 { letter-spacing: normal; }

/* Same rule for any element whose text was actually translated to Amharic
   (i18n.js stamps data-i18n-t on the tracking-styled ancestor when it swaps
   an English node for Ethiopic glyphs). Micro-labels like "Parties" or
   "For the Platform" carry tracking-wider/tracking-[0.2em] for Latin
   uppercase looks — on Ethiopic those gaps stretch the wide glyphs apart.
   The tag is precise: Latin-only labels keep their intended tracking. */
html[lang="am"] [data-i18n-t] { letter-spacing: normal; }

/* Page fade-in on load. IMPORTANT: opacity-only — a transform (even an
   identity matrix held by animation-fill-mode) on <body> becomes the
   containing block for position:fixed descendants, which breaks modal
   centering (the overlay sizes to the document, not the viewport). */
@keyframes pageFade { from { opacity: 0; } to { opacity: 1; } }
.app-body { animation: pageFade .45s ease both; }

/* Staggered rise for card grids */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.stagger > * { animation: rise .5s ease both; }
.stagger > *:nth-child(1) { animation-delay: .03s; }
.stagger > *:nth-child(2) { animation-delay: .07s; }
.stagger > *:nth-child(3) { animation-delay: .11s; }
.stagger > *:nth-child(4) { animation-delay: .15s; }
.stagger > *:nth-child(5) { animation-delay: .19s; }
.stagger > *:nth-child(6) { animation-delay: .23s; }
.stagger > *:nth-child(7) { animation-delay: .27s; }
.stagger > *:nth-child(8) { animation-delay: .31s; }
.stagger > *:nth-child(9) { animation-delay: .35s; }
.stagger > *:nth-child(10){ animation-delay: .39s; }

.text-gradient { background: linear-gradient(90deg, #4f46e5, #7c3aed); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Navigation ---------- */
.nav-link {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .5rem .85rem; border-radius: .75rem;
  font-size: .875rem; font-weight: 600; color: #475569;
  transition: all .15s ease; cursor: pointer;
}
.nav-link:hover { background: #eef2ff; color: #4f46e5; }
.nav-link.active { background: #eef2ff; color: #4f46e5; }

/* Admin is the platform back office, not a merchant workspace — it gets its
   own divider and bordered chip so it reads as a separate zone from
   Storefront / Stores / Seller / Promoter instead of one more role link. */
.nav-divider {
  display: inline-block; width: 1px; height: 1.5rem;
  margin: 0 .45rem; background: #e2e8f0; flex-shrink: 0;
}
.nav-admin { border: 1px solid #e2e8f0; background: #f8fafc; }
.nav-admin:hover, .nav-admin.active { border-color: #c7d2fe; background: #eef2ff; color: #4f46e5; }
[data-mobile-nav] .nav-divider {
  width: auto; height: 1px; margin: .4rem .95rem;
}

/* Brand — the logo mark and the wordmark are deliberately separated: the
   rounded logo square stands on its own, while a thin Ethiopian-tricolor
   (green/yellow/red) bar sits under the name and stretches on hover. */
.brand-mark { position: relative; display: inline-flex; border-radius: .9rem; }
.brand-mark::after {
  content: ''; position: absolute; inset: -3px; border-radius: 1rem;
  border: 1.5px solid #c7d2fe; opacity: 0; transform: scale(.9);
  transition: opacity .2s ease, transform .2s ease; pointer-events: none;
}
.brand:hover .brand-mark::after { opacity: 1; transform: scale(1); }
.brand-text { display: flex; flex-direction: column; line-height: 1; min-width: 0; }
.brand-text > span:first-child {
  max-width: 11rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-tricolor {
  display: flex; height: 3px; width: 1.5rem; border-radius: 999px;
  overflow: hidden; margin-top: .3rem;
  transition: width .28s cubic-bezier(.16, 1, .3, 1);
}
.brand:hover .brand-tricolor { width: 3.3rem; }
.brand-tricolor i { flex: 1; height: 100%; }
.brand-tricolor .t-g { background: #078930; }
.brand-tricolor .t-y { background: #fcdd09; }
.brand-tricolor .t-r { background: #da121a; }
.dark .brand-mark::after { border-color: #6d28d9; }

/* Role links become icon-only buttons on desktop; the label reveals as a CSS
   tooltip on hover / keyboard focus. Mobile keeps the full labels (hamburger
   menu), where a hover tooltip can't exist. */
@media (min-width: 768px) {
  .nav-link {
    position: relative; width: 2.5rem; height: 2.5rem;
    justify-content: center; gap: 0; padding: 0; font-size: 1.05rem;
  }
  .nav-link:hover { transform: translateY(-1px); }
  .nav-link .nav-label { display: none; } /* aria-label carries the accessible name on desktop */
  .nav-link::after {
    content: attr(data-label);
    position: absolute; left: 50%; top: calc(100% + .7rem);
    transform: translateX(-50%) translateY(-3px) scale(.95);
    padding: .32rem .62rem; border-radius: .55rem;
    background: #0f172a; color: #fff;
    font-size: .72rem; font-weight: 700; line-height: 1.3; white-space: nowrap;
    box-shadow: 0 10px 24px -8px rgba(15, 23, 42, .45);
    opacity: 0; pointer-events: none; z-index: 60;
    transition: opacity .15s ease, transform .15s ease;
  }
  .nav-link::before {
    content: ''; position: absolute; left: 50%; top: calc(100% + .42rem);
    transform: translateX(-50%) rotate(45deg);
    width: .46rem; height: .46rem; background: #0f172a;
    opacity: 0; pointer-events: none; z-index: 60;
    transition: opacity .15s ease;
  }
  .nav-link:hover::after, .nav-link:focus-visible::after,
  .nav-link:hover::before, .nav-link:focus-visible::before { opacity: 1; }
  .nav-link:hover::after, .nav-link:focus-visible::after {
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

/* Language toggle — segmented pill, active side lifts with the accent color. */
.lang-toggle {
  display: inline-flex; align-items: center; gap: .1rem;
  padding: .2rem; border-radius: 9999px; flex-shrink: 0; line-height: 1;
  background: #f1f5f9; border: 1px solid #e2e8f0;
  transition: border-color .15s ease, background .15s ease;
}
.lang-toggle:hover { border-color: #c7d2fe; background: #eef2ff; }
.lang-toggle:active { transform: scale(.96); }
.lang-toggle .lt-opt {
  padding: .34rem .52rem; border-radius: 9999px;
  font-size: .7rem; font-weight: 800; letter-spacing: .04em;
  color: #94a3b8; transition: all .18s ease;
}
/* The አማ option is Ethiopic in BOTH languages — it must never carry the
   Latin-style tracking that suits the EN capsule. */
.lang-toggle .lt-opt:last-child { letter-spacing: normal; }
.lang-toggle .lt-opt.on {
  background: #fff; color: #4f46e5;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .2);
}
.dark .lang-toggle { background: #1e293b; border-color: #334155; }
.dark .lang-toggle:hover { border-color: #6366f1; background: #312e81; }
.dark .lang-toggle .lt-opt.on { background: #4338ca; color: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }

.ref-strip {
  background: linear-gradient(90deg, #4f46e5, #7c3aed);
  color: #fff; font-size: .8125rem; padding: .45rem 1rem; text-align: center;
}

/* ---------- Cards ---------- */
.card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 1rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.card-hover { transition: all .2s ease; }
.card-hover:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 32px -12px rgba(15, 23, 42, .14);
  border-color: #c7d2fe;
}

.stat-card { display: flex; flex-direction: column; gap: .3rem; }
.stat-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #94a3b8; }
.stat-value { font-size: 1.6rem; font-weight: 800; color: #0f172a; line-height: 1.1; letter-spacing: -0.02em; }

.icon-chip { width: 2.75rem; height: 2.75rem; border-radius: .85rem; display: grid; place-items: center; font-size: 1.15rem; flex-shrink: 0; }
.chip-indigo  { background: #eef2ff; color: #4f46e5; }
.chip-violet  { background: #f5f3ff; color: #7c3aed; }
.chip-emerald { background: #ecfdf5; color: #059669; }
.chip-amber   { background: #fffbeb; color: #d97706; }
.chip-rose    { background: #fff1f2; color: #e11d48; }
.chip-sky     { background: #f0f9ff; color: #0284c7; }
.chip-slate   { background: #f1f5f9; color: #475569; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-weight: 600; border-radius: .75rem; padding: .6rem 1.2rem;
  font-size: .875rem; line-height: 1.4; border: 1px solid transparent;
  transition: all .15s ease; cursor: pointer; white-space: nowrap;
  text-decoration: none; /* buttons are never underlined, even off the Tailwind preflight */
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-primary  { background: #4f46e5; color: #fff; box-shadow: 0 4px 12px -2px rgba(79, 70, 229, .4); }
.btn-primary:hover { background: #4338ca; }
.btn-soft     { background: #eef2ff; color: #4f46e5; }
.btn-soft:hover { background: #e0e7ff; }
.btn-outline  { border-color: #e2e8f0; background: #fff; color: #334155; }
.btn-outline:hover { border-color: #c7d2fe; background: #eef2ff; color: #4f46e5; }
.btn-success  { background: #059669; color: #fff; box-shadow: 0 4px 12px -2px rgba(5, 150, 105, .35); }
.btn-success:hover { background: #047857; }
.btn-amber    { background: #f59e0b; color: #fff; box-shadow: 0 4px 12px -2px rgba(245, 158, 11, .4); }
.btn-amber:hover { background: #d97706; }
.btn-danger   { background: #e11d48; color: #fff; box-shadow: 0 4px 12px -2px rgba(225, 29, 72, .35); }
.btn-danger:hover { background: #be123c; }
.btn-dark     { background: #0f172a; color: #fff; }
.btn-dark:hover { background: #1e293b; }
.btn-ghost    { background: transparent; color: #64748b; }
.btn-ghost:hover { background: #f1f5f9; color: #334155; }
.btn-sm { padding: .38rem .8rem; font-size: .75rem; border-radius: .55rem; }
.btn-lg { padding: .85rem 1.7rem; font-size: .95rem; }
.btn-block { width: 100%; }

/* ---------- Status pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .24rem .6rem; border-radius: 9999px;
  font-size: .675rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  white-space: nowrap;
}
.pill-dot::before { content: ''; width: 6px; height: 6px; border-radius: 9999px; background: currentColor; }
.pill-emerald  { background: #ecfdf5; color: #047857; }
.pill-amber    { background: #fffbeb; color: #b45309; }
.pill-rose     { background: #fff1f2; color: #be123c; }
.pill-slate    { background: #f1f5f9; color: #475569; }
.pill-indigo   { background: #eef2ff; color: #4338ca; }
.pill-sky      { background: #f0f9ff; color: #0369a1; }
.pill-violet   { background: #f5f3ff; color: #6d28d9; }
.pill-white    { background: rgba(255,255,255,.92); color: #334155; }

/* ---------- Tables ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: .875rem; }
.tbl thead th {
  text-align: left; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em;
  color: #94a3b8; font-weight: 700; padding: .8rem 1rem; border-bottom: 1px solid #e2e8f0;
  background: #fafafa; white-space: nowrap;
}
.tbl tbody td { padding: .9rem 1rem; border-bottom: 1px solid #f1f5f9; color: #334155; vertical-align: middle; }
.tbl tbody tr { transition: background .15s ease; }
.tbl tbody tr:hover { background: #f8fafc; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tr.flag-row { background: #fff1f2; }
.tbl tr.flag-row:hover { background: #ffe4e6; }

/* ---------- Forms ---------- */
.label { display: block; font-size: .8125rem; font-weight: 600; color: #334155; margin-bottom: .4rem; }
.input, .select, .textarea {
  width: 100%; border: 1px solid #e2e8f0; border-radius: .75rem;
  padding: .6rem .875rem; font-size: .875rem; background: #fff; color: #0f172a;
  transition: border .15s ease, box-shadow .15s ease; outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: #818cf8; box-shadow: 0 0 0 3px rgba(129, 140, 248, .22); }
.input::placeholder, .textarea::placeholder { color: #94a3b8; }

/* Custom dropdowns — native arrow removed, branded chevron drawn in. */
.select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .85rem center; background-size: .8rem;
  padding-right: 2.4rem; cursor: pointer;
}
.select:hover { border-color: #c7d2fe; }
.dark .select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
}

/* Phase 4 (item 23) — dark-mode form fields: the request modal and product
   form share these classes, and the light-only colors were unreadable on
   dark cards. */
.dark .label { color: #cbd5e1; }
.dark .input, .dark .select, .dark .textarea {
  background: #0f172a; border-color: #334155; color: #e2e8f0;
}
.dark .input::placeholder, .dark .textarea::placeholder { color: #64748b; }
.dark .field-hint { color: #64748b; }

/* Description / info boxes — taller by default, branded resize grip. */
.textarea { resize: vertical; min-height: 5.5rem; line-height: 1.55; }
.textarea::-webkit-resizer {
  background: linear-gradient(135deg, transparent 0 45%, #cbd5e1 45% 55%, transparent 55% 70%, #cbd5e1 70% 80%, transparent 80%);
  border-radius: 0 0 .75rem 0;
}
.dark .textarea::-webkit-resizer {
  background: linear-gradient(135deg, transparent 0 45%, #475569 45% 55%, transparent 55% 70%, #475569 70% 80%, transparent 80%);
}
.field { margin-bottom: 1rem; }
.field-hint { font-size: .75rem; color: #94a3b8; margin-top: .3rem; }

/* ---------- Progress bars ---------- */
.progress { height: .5rem; background: #e2e8f0; border-radius: 9999px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 9999px; background: linear-gradient(90deg, #4f46e5, #7c3aed); transition: width .6s ease; }
.progress-fill.emerald { background: linear-gradient(90deg, #10b981, #34d399); }
.progress-fill.amber   { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.progress-fill.rose    { background: linear-gradient(90deg, #e11d48, #fb7185); }

/* ---------- Modals ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  padding: 1rem; background: rgba(15, 23, 42, .55); backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-card {
  width: 100%; max-width: 30rem; max-height: 90vh; overflow-y: auto;
  background: #fff; border-radius: 1.25rem;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, .45);
  transform: translateY(14px) scale(.97);
  transition: transform .22s cubic-bezier(.16, 1, .3, 1);
}
.dark .modal-card { background: #0f172a; border: 1px solid #1e293b; }
.modal-overlay.open .modal-card { transform: none; }
.modal-card.wide { max-width: 42rem; }

/* ---------- Image lightbox (product detail) — the full photo, never cropped ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center;
  padding: 1.25rem; background: rgba(2, 6, 23, .9); backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.lightbox.open { opacity: 1; pointer-events: auto; }
.lightbox-img {
  max-width: 100%; max-height: 100%; width: auto; height: auto;
  object-fit: contain; border-radius: .75rem;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, .65);
}
.lightbox-close {
  position: absolute; top: 1rem; right: 1rem; width: 2.75rem; height: 2.75rem;
  display: grid; place-items: center; border-radius: 999px;
  background: rgba(255, 255, 255, .14); color: #fff; font-size: 1.25rem;
  transition: background .2s ease;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .28); }

/* ---------- Toasts ---------- */
.toast-wrap { position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 80; display: flex; flex-direction: column; gap: .6rem; }
.toast {
  display: flex; gap: .75rem; align-items: flex-start; min-width: 17rem; max-width: 24rem;
  background: #0f172a; color: #fff; padding: .85rem 1rem; border-radius: .9rem;
  box-shadow: 0 14px 30px -8px rgba(15, 23, 42, .4);
  animation: toastIn .28s ease both;
}
.toast.success { border-left: 4px solid #10b981; }
.toast.error   { border-left: 4px solid #f43f5e; }
.toast.info    { border-left: 4px solid #6366f1; }
.toast.warning { border-left: 4px solid #f59e0b; }
.toast .t-icon { margin-top: .1rem; }
.toast .t-title { font-weight: 700; font-size: .85rem; }
.toast .t-msg { font-size: .78rem; color: #cbd5e1; margin-top: .1rem; }
.toast.hide { opacity: 0; transform: translateY(8px); transition: all .25s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Misc ---------- */
.avatar-initials {
  width: 2.25rem; height: 2.25rem; border-radius: 9999px; flex-shrink: 0;
  display: grid; place-items: center; font-size: .8rem; font-weight: 800; color: #fff;
}

/* Category chip on product cards — the category icon takes the slot where the
   store's initials used to sit, so the meta line reads "[category icon] store
   name" instead of a text category. Sized like the initials circle it
   replaces (20px); the category name stays reachable via the title tooltip. */
.cat-chip {
  width: 1.25rem; height: 1.25rem; border-radius: 9999px; flex-shrink: 0;
  display: grid; place-items: center;
  background: #eef2ff; color: #6366f1; font-size: .6rem; line-height: 1;
}
.dark .cat-chip { background: #1e1b4b; color: #a5b4fc; }
.divider-dash { border-top: 1px dashed #e2e8f0; }

/* ---------- Footer ---------- */
/* The storefront footer's links + @telegram group is ~460px on one line —
   wider than a phone viewport. Wrapping keeps it inside the page instead of
   spilling horizontally; row-gap keeps wrapped lines tidy on desktop too. */
.footer-links { flex-wrap: wrap; row-gap: .4rem; }
.otp-input {
  width: 3.4rem; height: 3.6rem; text-align: center; font-size: 1.5rem; font-weight: 800;
  border: 1px solid #e2e8f0; border-radius: .9rem; color: #0f172a; outline: none; transition: all .15s;
}
.otp-input:focus { border-color: #818cf8; box-shadow: 0 0 0 3px rgba(129,140,248,.25); }
.otp-input.error { border-color: #f43f5e; animation: shake .3s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-4px)} 75%{transform:translateX(4px)} }

/* ---------- Dashboard shell & sidebar ---------- */
.dash-shell { display: flex; min-height: calc(100vh - 4rem); }
.dash-main { flex: 1; min-width: 0; }
.dash-sidebar {
  width: 15.5rem; flex-shrink: 0; display: flex; flex-direction: column;
  border-right: 1px solid #e2e8f0; background: #fff;
  position: sticky; top: 4rem; height: calc(100vh - 4rem); overflow-y: auto;
  z-index: 30;
}
.side-section-label {
  font-size: .65rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  color: #94a3b8; padding: 0 .75rem; margin-bottom: .5rem;
}
.side-link {
  display: flex; align-items: center; gap: .65rem;
  padding: .55rem .75rem; border-radius: .7rem;
  font-size: .85rem; font-weight: 600; color: #475569;
  transition: all .15s ease; text-decoration: none;
}
.side-link i { width: 1.15rem; text-align: center; color: #94a3b8; font-size: .9rem; }
.side-link:hover { background: #f1f5f9; color: #0f172a; }
.side-link.active { background: #eef2ff; color: #4f46e5; }
.side-link.active i { color: #4f46e5; }
.side-badge {
  margin-left: auto; font-size: .6rem; font-weight: 800;
  padding: .12rem .45rem; border-radius: 9999px;
  background: #eef2ff; color: #4338ca;
}
.side-badge.rose { background: #fff1f2; color: #be123c; }
.side-badge.amber { background: #fffbeb; color: #b45309; }
.dash-backdrop { display: none; }

@media (max-width: 1023px) {
  .dash-sidebar {
    position: fixed; top: 4rem; bottom: 0; left: 0; height: auto;
    transform: translateX(-105%); transition: transform .25s ease;
    box-shadow: 0 20px 40px -12px rgba(15, 23, 42, .35);
  }
  .dash-sidebar.open { transform: none; }
  .dash-backdrop {
    display: block; position: fixed; inset: 4rem 0 0 0;
    background: rgba(15, 23, 42, .45); z-index: 25;
    opacity: 0; pointer-events: none; transition: opacity .25s ease;
  }
  .dash-backdrop.open { opacity: 1; pointer-events: auto; }
}

/* Collapsible sidebar — desktop only. The mobile drawer (max-width 1023px) must
   never render collapsed, even if the state persists from a desktop session. */
@media (min-width: 1024px) {
  .dash-sidebar.collapsed { width: 4.5rem; }
  .dash-sidebar.collapsed .side-label,
  .dash-sidebar.collapsed .side-badge,
  .dash-sidebar.collapsed .side-sub,
  .dash-sidebar.collapsed .side-user-text { display: none; }
  .dash-sidebar.collapsed .side-link { justify-content: center; padding: .55rem 0; }
  .dash-sidebar.collapsed .side-link i { margin: 0; }
  .dash-sidebar.collapsed .side-title-block { justify-content: center; padding: 0; }
  .dash-sidebar.collapsed .side-toggle i { transform: rotate(180deg); }
  .dash-sidebar.collapsed .side-actions .btn { width: 2.5rem; padding: 0; justify-content: center; }
}

/* ---------- Command palette (⌘K) ---------- */
.nav-search {
  display: inline-flex; align-items: center; gap: .5rem;
  border: 1px solid #e2e8f0; border-radius: .75rem;
  background: #f8fafc; color: #64748b;
  padding: .45rem .8rem; font-size: .8125rem; font-weight: 600;
  transition: all .15s ease; cursor: pointer;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, .04);
}
.nav-search:hover { border-color: #c7d2fe; background: #fff; color: #334155; }
.nav-search .kbd { border-color: #e2e8f0; }
.dark .nav-search { background: #0f172a; border-color: #334155; color: #94a3b8; }
.dark .nav-search:hover { border-color: #6366f1; background: #1e293b; color: #e2e8f0; }
.dark .nav-search .kbd { border-color: #334155; background: #1e293b; }

.palette-overlay {
  position: fixed; inset: 0; z-index: 70; display: flex; justify-content: center;
  padding: 12vh 1rem 1rem; background: rgba(15, 23, 42, .55); backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity .18s ease;
}
.palette-overlay.open { opacity: 1; pointer-events: auto; }
.palette-box {
  width: 100%; max-width: 34rem; max-height: 70vh; display: flex; flex-direction: column;
  background: #fff; border-radius: 1.25rem; overflow: hidden;
  box-shadow: 0 25px 60px -12px rgba(15, 23, 42, .5);
  transform: translateY(-10px) scale(.98); transition: transform .18s cubic-bezier(.16,1,.3,1);
}
.palette-overlay.open .palette-box { transform: none; }
.dark .palette-box { background: #0f172a; }
.palette-results { overflow-y: auto; padding: .5rem; }
.palette-group-label {
  font-size: .65rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
  color: #94a3b8; padding: .6rem .75rem .2rem;
}
.palette-item {
  display: flex; align-items: center; gap: .7rem; width: 100%; text-align: left;
  padding: .6rem .75rem; border-radius: .7rem; font-size: .875rem; font-weight: 600; color: #334155;
}
.palette-item i { width: 1.1rem; text-align: center; color: #94a3b8; }
.palette-item:hover, .palette-item.hl { background: #eef2ff; color: #4f46e5; }
.palette-item.hl i { color: #4f46e5; }
.dark .palette-item { color: #cbd5e1; }
.dark .palette-item:hover, .dark .palette-item.hl { background: #1e293b; color: #a5b4fc; }
.dark .palette-item.hl i { color: #a5b4fc; }
.kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .65rem;
  padding: .12rem .4rem; border: 1px solid #e2e8f0; border-bottom-width: 2px; border-radius: .35rem;
  background: #f8fafc; color: #475569; white-space: nowrap;
}
.dark .kbd { background: #1e293b; border-color: #334155; color: #94a3b8; }

/* ---------- Notification dropdown ---------- */
.nav-pop {
  position: absolute; right: 0; top: calc(100% + .5rem); width: 22rem; max-width: calc(100vw - 2rem);
  background: #fff; border: 1px solid #e2e8f0; border-radius: 1rem;
  box-shadow: 0 20px 45px -12px rgba(15, 23, 42, .25); z-index: 50;
  opacity: 0; pointer-events: none; transform: translateY(6px); transition: all .18s ease;
}
.nav-pop.open { opacity: 1; pointer-events: auto; transform: none; }
.dark .nav-pop { background: #0f172a; border-color: #1e293b; }
.nav-bell-dot {
  position: absolute; top: -2px; right: -2px; min-width: 1.05rem; height: 1.05rem;
  border-radius: 9999px; background: #f43f5e; color: #fff; font-size: .6rem; font-weight: 800;
  display: grid; place-items: center; padding: 0 .2rem; border: 2px solid #fff;
}
.dark .nav-bell-dot { border-color: #0f172a; }

/* ---------- Skeleton shimmer ---------- */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 37%, #f1f5f9 63%);
  background-size: 400% 100%; border-radius: .45rem;
  animation: shimmer 1.4s ease infinite;
}
.dark .skeleton {
  background: linear-gradient(90deg, #1e293b 25%, #334155 37%, #1e293b 63%);
  background-size: 400% 100%;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* Loading skeletons for the live storefront grid — shapes mirror the product
   card (4:3 photo box + title/seller bars + price) so a filter swap never
   shifts layout. The blocks reuse .skeleton, so dark mode and the global
   reduced-motion rule apply automatically. */
.sk-card { pointer-events: none; }
.sk-img {
  aspect-ratio: 4 / 3; border-radius: 0; /* the card photo box is square-cornered */
}
.sk-line { height: .95rem; border-radius: .45rem; }
.sk-line-sm { height: .8rem; }
.sk-price { height: 1.5rem; border-radius: .45rem; }
/* Dim the region (count + pagination stay put) while cards are loading. */
#results-region.is-loading {
  opacity: .55; transition: opacity .18s ease;
}

/* ---------- Product image upload ---------- */
.upload-zone {
  border: 2px dashed #c7d2fe; border-radius: 1rem;
  background: #f8fafc; cursor: pointer; overflow: hidden;
  display: grid; place-items: center; text-align: center;
  aspect-ratio: 4 / 3; position: relative;
  transition: all .18s ease;
}
.upload-zone:hover, .upload-zone.drag, .upload-zone.focus {
  border-color: #6366f1; background: #eef2ff;
}
.upload-zone .up-empty { padding: 1.5rem; }
.upload-zone .up-empty i { color: #818cf8; font-size: 1.9rem; margin-bottom: .55rem; }
.upload-zone.has-img { border-style: solid; border-color: #a5b4fc; background: #fff; }
.upload-zone .up-img { width: 100%; height: 100%; object-fit: cover; }
.upload-zone .up-overlay {
  position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; gap: .5rem;
  padding: .75rem; background: linear-gradient(to top, rgba(2,6,23,.55), transparent 45%);
  opacity: 0; transition: opacity .18s ease;
}
.upload-zone:hover .up-overlay { opacity: 1; }
.upload-zone .up-overlay .btn { box-shadow: 0 4px 12px rgba(2,6,23,.35); }
.dark .upload-zone { background: #0f172a; border-color: #334155; }
.dark .upload-zone:hover, .dark .upload-zone.drag, .dark .upload-zone.focus { border-color: #818cf8; background: #1e1b4b; }
.dark .upload-zone.has-img { background: #0f172a; border-color: #4338ca; }

/* Upload progress shimmer line shown while a photo is being processed. */
@keyframes upProgress { from { width: 0; } to { width: 100%; } }
.up-progress {
  position: absolute; left: 0; bottom: 0; height: 3px;
  background: linear-gradient(90deg, #6366f1, #a78bfa);
  animation: upProgress 1.1s ease forwards;
}

/* ---------- Photo crop editor (Cropper.js) ---------- */
.up-actions { display: flex; gap: .5rem; margin-top: .6rem; }
.up-actions.hidden { display: none; }

.img-editor {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column;
  background: rgba(2, 6, 23, 0.94);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  animation: imgEditorIn .16s ease;
}
.img-editor.hidden { display: none; }
@keyframes imgEditorIn { from { opacity: 0; } to { opacity: 1; } }
body.img-editor-open { overflow: hidden; }

.img-editor-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.5rem; flex: 0 0 auto;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}
.img-editor-head h3 { font-weight: 800; font-size: 1.05rem; color: #fff; letter-spacing: -0.01em; }
.img-editor-head p { font-size: 0.72rem; color: #94a3b8; margin-top: 2px; }
.img-editor-close {
  width: 2.25rem; height: 2.25rem; display: grid; place-items: center;
  border-radius: 9999px; color: #cbd5e1; background: rgba(148, 163, 184, 0.12);
  transition: all .15s ease; flex: 0 0 auto;
}
.img-editor-close:hover { background: rgba(148, 163, 184, 0.24); color: #fff; }

.img-editor-body { flex: 1; display: flex; min-height: 0; }
.img-editor-stage {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center;
  padding: 1.25rem; overflow: hidden;
  background: radial-gradient(120% 120% at 50% 0%, #0b1220 0%, #020617 70%);
}
/* BS-4 — the Cropper container must have a DEFINITE size (not just max-
   width/max-height). Cropper reads offsetWidth/offsetHeight once at init and
   stamps them inline; a content-driven box measured the full stage (padding
   included) and then got capped smaller by the max-* rules, so the canvas and
   the crop frame overflowed the clip viewport — the crop box's bottom edge
   and resize handles were cut off on narrow/short screens. 100%/100% makes
   the init measurement equal the rendered box at every viewport size. */
.img-editor-stage .cropper-container { width: 100%; height: 100%; flex: none; }
#img-editor-src { max-width: 100%; max-height: 100%; }

.img-editor-side {
  width: 250px; flex: 0 0 auto; display: flex; flex-direction: column; gap: 1.1rem;
  padding: 1.1rem; border-left: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.55);
}
.img-editor-side-label {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: #94a3b8; margin-bottom: 0.45rem;
}
.img-editor-live {
  aspect-ratio: 4 / 3; border-radius: 0.75rem; overflow: hidden;
  background: #0b1220; border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.5);
}
.img-editor-live img { width: 100%; height: 100%; object-fit: contain; }
.img-editor-tools { display: flex; flex-direction: column; gap: 0.6rem; }
.img-editor-row { display: flex; gap: 0.45rem; align-items: center; }
.img-editor-btn {
  width: 2.3rem; height: 2.3rem; display: grid; place-items: center;
  border-radius: 0.6rem; color: #e2e8f0; background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.14); font-size: 0.8rem;
  transition: all .15s ease;
}
.img-editor-btn:hover { background: rgba(99, 102, 241, 0.35); border-color: #6366f1; color: #fff; }
.img-editor-zoom {
  min-width: 3.2rem; text-align: center; font-size: 0.72rem; font-weight: 700;
  color: #cbd5e1; font-variant-numeric: tabular-nums;
}
.img-editor-reset {
  align-self: flex-start; font-size: 0.72rem; font-weight: 600; color: #a5b4fc;
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0.4rem;
  border-radius: 0.5rem; transition: all .15s ease;
}
.img-editor-reset:hover { color: #fff; background: rgba(99, 102, 241, 0.22); }
.img-editor-note { font-size: 0.68rem; line-height: 1.45; color: #64748b; margin-top: auto; }
.img-editor-note i { color: #818cf8; }

.img-editor-foot {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; gap: 0.75rem;
  padding: 0.9rem 1.5rem; border-top: 1px solid rgba(148, 163, 184, 0.16);
}
.img-editor-foot .btn-ghost { color: #cbd5e1; }
.img-editor-foot .btn-ghost:hover { background: rgba(148, 163, 184, 0.14); color: #fff; }

/* Cropper theming — indigo crop box, crisp white handles, subtle grid. */
.img-editor .cropper-modal { background-color: #020617; opacity: 0.62; }
.img-editor .cropper-view-box {
  outline: 1.5px solid #818cf8; outline-color: rgba(129, 140, 248, 0.95);
  border-radius: 10px;
}
.img-editor .cropper-face { background-color: transparent; }
.img-editor .cropper-line { background-color: #a5b4fc; opacity: 0.85; }
.img-editor .cropper-dashed { border-color: #c7d2fe; opacity: 0.6; }
.img-editor .cropper-center { opacity: 0.9; }
.img-editor .cropper-point {
  background-color: #fff; width: 7px; height: 7px; border-radius: 50%;
  box-shadow: 0 0 0 1.5px rgba(79, 70, 229, 0.9), 0 1px 3px rgba(2, 6, 23, 0.6);
}

@media (max-width: 767px), (hover: none) and (pointer: coarse) {
  .img-editor-body { flex-direction: column; overflow-y: auto; }
  .img-editor-stage { min-height: 46vh; }
  .img-editor-side {
    width: 100%; border-left: none; border-top: 1px solid rgba(148, 163, 184, 0.16);
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.9rem;
  }
  .img-editor-live-block { width: 130px; flex: 0 0 auto; }
  .img-editor-row { flex-wrap: wrap; justify-content: center; }
  .img-editor-note { display: none; }
}

/* ---------- Photo gallery strip (catalog v3) ---------- */
/* The photos column is a grid item — grid items default to min-width:auto,
   i.e. they refuse to shrink below their content. The strip holds up to 8
   thumbnails (~900px), so without this the whole PAGE grew wider on mobile
   instead of the strip scrolling inside it. min-width:0 lets the column
   shrink to the viewport and the strip's own overflow-x:auto take over. */
.gallery-col { min-width: 0; }
.gallery-strip {
  display: flex; gap: .6rem; margin-top: .75rem;
  overflow-x: auto; padding-bottom: .25rem;
}
.g-item {
  position: relative; flex: 0 0 auto; width: 108px;
  aspect-ratio: 4 / 3; border-radius: .65rem; overflow: hidden;
  border: 2px solid #e2e8f0; background: #f1f5f9;
  transition: border-color .15s ease;
}
.dark .g-item { border-color: #334155; background: #0f172a; }
.g-item.is-primary { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99, 102, 241, .18); }
.g-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.g-badge {
  position: absolute; top: .3rem; left: .3rem; display: none;
  align-items: center; gap: .25rem; font-size: .55rem; font-weight: 800;
  letter-spacing: .04em; text-transform: uppercase; color: #fff;
  background: rgba(99, 102, 241, .92); border-radius: 999px; padding: .15rem .45rem;
}
.g-item.is-primary .g-badge { display: inline-flex; }
.g-controls {
  position: absolute; inset: auto 0 0 0; display: flex; justify-content: center; gap: .2rem;
  padding: .3rem; background: linear-gradient(to top, rgba(2, 6, 23, .72), transparent);
  opacity: 0; transition: opacity .15s ease;
}
.g-item:hover .g-controls, .g-item:focus-within .g-controls { opacity: 1; }
.g-btn {
  width: 1.55rem; height: 1.55rem; display: grid; place-items: center;
  border-radius: .45rem; background: rgba(255, 255, 255, .92); color: #334155;
  font-size: .62rem; transition: all .13s ease;
}
.g-btn:hover { background: #fff; color: #4f46e5; transform: translateY(-1px); }
.g-btn.g-del:hover { color: #e11d48; }
.g-item.is-primary [data-g-primary] { color: #6366f1; }
/* Long-press on a photo must not open the browser's image callout or select
   text — the gesture is a drag pickup on touch devices. The callout can also
   trigger on the <img> itself, so it is set on the thumbnail AND its image;
   the tap-highlight flash is killed so a press gives no browser flash. */
.g-item, .g-item img { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
/* Grab-to-reorder: the lifted thumbnail casts a shadow so it reads as
   "held". The transform (scale + finger-follow translate) is owned by JS so
   the photo can ride the finger; on release JS transitions it back into the
   slot. No transform transition here — it would lag every pointermove. */
.g-item.dragging {
  z-index: 6;
  opacity: .92;
  border-color: #6366f1;
  box-shadow: 0 14px 28px rgba(2, 6, 23, .35);
  will-change: transform;
}

/* Phase 4 (item 18) — mobile: one big "Edit" target per thumbnail instead of
   five tiny icon buttons; it opens the bottom edit sheet. Desktop keeps the
   hover icon row. */
.g-edit-btn {
  position: absolute; inset: auto 0 0 0; display: none;
  align-items: center; justify-content: center; gap: .3rem;
  padding: .5rem .4rem; font-size: .64rem; font-weight: 800; letter-spacing: .04em;
  color: #fff; background: linear-gradient(to top, rgba(2, 6, 23, .78), transparent);
  border: 0; cursor: pointer;
}
.g-edit-btn i { color: #a5b4fc; }
.g-edit-btn { -webkit-tap-highlight-color: transparent; }
.g-recrop-badge {
  position: absolute; top: .3rem; right: .3rem; display: inline-flex; align-items: center; gap: .25rem;
  font-size: .55rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase;
  color: #4f46e5; background: rgba(255, 255, 255, .95); border-radius: 999px; padding: .15rem .45rem;
  pointer-events: none;
}
/* Touch devices of ANY width get the one-tap Edit target: the hover-only
   icon row is unreachable without a hover (landscape phones and tablets
   are wider than 639px, so a width-only breakpoint left them with NO
   visible controls at all). Desktop keeps the hover icon row. */
@media (max-width: 767px), (hover: none) and (pointer: coarse) {
  .g-controls { display: none; }
  .g-edit-btn { display: flex; }
}

/* Mobile photo edit sheet (Phase 4 — item 18) */
.g-sheet { position: fixed; inset: 0; z-index: 75; display: none; }
.g-sheet.open { display: block; }
.g-sheet-scrim { position: absolute; inset: 0; background: rgba(2, 6, 23, .55); }
.g-sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: min(80vh, 34rem); overflow-y: auto;
  background: #fff; border-radius: 1.25rem 1.25rem 0 0;
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .22s cubic-bezier(.16, 1, .3, 1);
}
.g-sheet.open .g-sheet-panel { transform: none; }
.dark .g-sheet-panel { background: #0f172a; border-top: 1px solid #1e293b; }
.g-sheet-title {
  font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  color: #94a3b8; text-align: center; margin-bottom: .5rem;
}
.g-sheet-row {
  display: flex; align-items: center; gap: .75rem; width: 100%;
  padding: .9rem 1rem; border-radius: .75rem; font-weight: 700; font-size: .9rem;
  color: #334155; background: transparent; text-align: left; cursor: pointer;
}
.g-sheet-row:hover { background: #f1f5f9; }
.dark .g-sheet-row { color: #e2e8f0; }
.dark .g-sheet-row:hover { background: #1e293b; }
.g-sheet-row i { width: 1.15rem; text-align: center; color: #6366f1; }
.g-sheet-row.g-sheet-danger, .g-sheet-row.g-sheet-danger i { color: #e11d48; }
.g-sheet-cancel {
  display: block; width: 100%; margin-top: .4rem; padding: .9rem; border-radius: .75rem;
  font-weight: 700; color: #64748b; background: transparent; cursor: pointer;
}
.g-sheet-cancel:hover { background: #f1f5f9; }
.dark .g-sheet-cancel:hover { background: #1e293b; }

/* ---------- Storefront gallery thumbnails (catalog v3) ---------- */
.gallery-thumbs {
  display: flex; gap: .5rem; padding: .6rem;
  overflow-x: auto; border-top: 1px solid #eef2f7;
}
.dark .gallery-thumbs { border-top-color: #1e293b; }
.g-thumb {
  flex: 0 0 auto; width: 64px; aspect-ratio: 4 / 3; border-radius: .5rem;
  overflow: hidden; border: 2px solid transparent; opacity: .75;
  transition: all .15s ease;
}
.g-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.g-thumb:hover { opacity: 1; }
.g-thumb.active { border-color: #6366f1; opacity: 1; box-shadow: 0 0 0 3px rgba(99, 102, 241, .18); }

/* ---------- Storefront product gallery: swipe + arrows + counter ----------
   The main photo area is a touch-swipe carousel (horizontal swipes belong to
   the gallery via touch-action: pan-y; vertical stays the page's scroll).
   Prev/next arrows overlay the photo; the counter sits bottom-left. */
[data-gallery-swipe] { touch-action: pan-y; }
[data-gallery-swipe] img {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none; -webkit-user-drag: none;
}
.g-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 12;
  width: 2.5rem; height: 2.5rem; border-radius: 999px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .92); color: #334155;
  box-shadow: 0 4px 12px rgba(2, 6, 23, .18);
  border: 0; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.g-arrow:hover { background: #fff; color: #4f46e5; }
.g-arrow:active { transform: translateY(-50%) scale(.92); }
.g-arrow-left { left: .75rem; }
.g-arrow-right { right: .75rem; }
/* Small/touch screens — smaller + subtler arrows: the swipe is the
   primary gesture there, the arrow is just a cue. Placed AFTER the base
   rules so the cascade favors it (same specificity, later source wins). */
@media (max-width: 767px), (hover: none) and (pointer: coarse) {
  .g-arrow {
    width: 2rem; height: 2rem; font-size: .72rem;
    background: rgba(255, 255, 255, .72); color: #475569;
    box-shadow: 0 2px 8px rgba(2, 6, 23, .14);
  }
  .g-arrow:hover { background: rgba(255, 255, 255, .85); }
}
.g-counter {
  position: absolute; left: .75rem; bottom: .75rem; z-index: 12;
  font-size: .68rem; font-weight: 800; letter-spacing: .05em;
  color: #fff; background: rgba(2, 6, 23, .55);
  border-radius: 999px; padding: .22rem .6rem;
  pointer-events: none;
}

/* ---------- Tables: sticky headers ---------- */
.tbl thead th { position: sticky; top: 0; z-index: 5; }

/* ---------- Focus rings & scrollbars ---------- */
.btn:focus-visible, .side-link:focus-visible, .nav-link:focus-visible { outline: 2px solid #818cf8; outline-offset: 2px; }

/* Custom scrollbars — every scrollable container, both engines. */
* { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: #cbd5e1; border-radius: 9999px;
  border: 2px solid #fff; /* gap effect on light surfaces */
}
*::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
*::-webkit-scrollbar-corner { background: transparent; }
.dark * { scrollbar-color: #334155 transparent; }
.dark *::-webkit-scrollbar-thumb { background: #334155; border-color: #0f172a; }
.dark *::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

/* ============================================================================
   DARK MODE — utility overrides scoped under .dark.
   Specificity (0,2,0) beats Tailwind's single-class utilities regardless of
   stylesheet order, so no !important is needed.
   ============================================================================ */
.dark body { background-color: #020617; color: #e2e8f0; }
.dark .bg-white { background-color: #0f172a; }
.dark .bg-slate-50 { background-color: #1e293b; }
.dark .bg-slate-100 { background-color: #1e293b; }
.dark .bg-slate-200 { background-color: #334155; }
.dark .bg-indigo-50 { background-color: #1e1b4b; }
.dark .bg-indigo-50\/60 { background-color: rgba(30,27,75,.6); }
.dark .bg-indigo-50\/70 { background-color: rgba(30,27,75,.7); }
.dark .bg-amber-50 { background-color: #451a03; }
.dark .bg-emerald-50 { background-color: #022c22; }
.dark .bg-emerald-50\/60 { background-color: rgba(2,44,34,.6); }
/* The IMPORTANT emerald tints (the promoter "Available for withdrawal"
   card) dodge the plain rules above — give them dark equivalents with the
   same money-green identity, or the pale card glares on a dark page and the
   light number vanishes on it. */
.dark .\!bg-emerald-50\/60 { background-color: rgba(2,44,34,.6) !important; }
.dark .\!border-emerald-200 { border-color: rgba(6,95,70,.5) !important; }
.dark .\!bg-emerald-50\/60 .stat-value { color: #34d399; }
.dark .\!bg-emerald-50\/60 .text-emerald-700 { color: #6ee7b7; }
.dark .bg-violet-50 { background-color: #2e1065; }
.dark .bg-rose-50 { background-color: #4c0519; }
.dark .bg-sky-50 { background-color: #082f49; }
.dark .bg-white\/70 { background-color: rgba(30,41,59,.7); }
.dark .bg-white\/85 { background-color: rgba(2,6,23,.85); }

.dark .text-slate-900 { color: #f1f5f9; }
.dark .text-slate-700 { color: #cbd5e1; }
.dark .text-slate-600 { color: #cbd5e1; }
.dark .text-slate-500 { color: #94a3b8; }
.dark .text-slate-400 { color: #64748b; }
.dark .text-indigo-900 { color: #c7d2fe; }
.dark .text-indigo-800 { color: #a5b4fc; }
.dark .text-indigo-700 { color: #818cf8; }
.dark .text-indigo-600 { color: #818cf8; }
.dark .text-amber-900 { color: #fde68a; }
.dark .text-amber-800 { color: #fcd34d; }
.dark .text-amber-700 { color: #fbbf24; }
.dark .text-amber-600 { color: #fbbf24; }
.dark .text-emerald-900 { color: #a7f3d0; }
.dark .text-emerald-800 { color: #6ee7b7; }
.dark .text-emerald-700 { color: #34d399; }
.dark .text-emerald-600 { color: #34d399; }
.dark .text-rose-900 { color: #fda4af; }
.dark .text-rose-800 { color: #fb7185; }
.dark .text-rose-600 { color: #fb7185; }
.dark .text-violet-900 { color: #ddd6fe; }
.dark .text-sky-900 { color: #bae6fd; }
.dark .text-violet-600 { color: #a78bfa; }
.dark .text-indigo-500 { color: #818cf8; }
.dark .text-violet-500 { color: #a78bfa; }
.dark .text-emerald-500 { color: #34d399; }
.dark .text-amber-500 { color: #fbbf24; }
.dark .text-rose-500 { color: #fb7185; }
.dark .text-sky-500 { color: #38bdf8; }

.dark .border-slate-100 { border-color: #1e293b; }
.dark .border-slate-200 { border-color: #1e293b; }
.dark .border-slate-300 { border-color: #334155; }
.dark .card.border-rose-200, .dark .border-rose-200 { border-color: #4c0519; } /* .card ties with .border-rose-200 at (0,2,0); scoping to .card wins the tie */
.dark .border-indigo-100 { border-color: #312e81; }
.dark .border-amber-100 { border-color: #451a03; }
.dark .border-emerald-100 { border-color: #022c22; }
.dark .border-violet-100 { border-color: #2e1065; }
.dark .border-sky-100 { border-color: #082f49; }
.dark .bg-indigo-50\/50 { background-color: rgba(30, 27, 75, .5); }
.dark .hover\:bg-indigo-50\/50:hover { background-color: rgba(30, 27, 75, .5); }
.dark .hover\:border-indigo-300:hover { border-color: #6366f1; }
.dark .divide-slate-100 > * + * { border-color: #1e293b; }
.dark .divide-slate-200 > * + * { border-color: #1e293b; }

/* Structural components in dark mode */
.dark .nav-bar { background: rgba(2, 6, 23, .8); border-color: #1e293b; }
.dark .dash-sidebar { background: #0f172a; border-color: #1e293b; }
.dark .card { background: #0f172a; border-color: #1e293b; box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.dark .card-hover:hover { border-color: #4338ca; box-shadow: 0 16px 32px -12px rgba(0,0,0,.6); }
.dark .stat-value { color: #f1f5f9; }
.dark .btn-outline { background: #0f172a; border-color: #334155; color: #cbd5e1; }
.dark .btn-outline:hover { background: #1e293b; border-color: #6366f1; color: #a5b4fc; }
.dark .btn-ghost { color: #94a3b8; }
.dark .btn-ghost:hover { background: #1e293b; color: #e2e8f0; }
.dark .btn-soft { background: #312e81; color: #a5b4fc; }
.dark .btn-soft:hover { background: #3730a3; color: #c7d2fe; }
.dark .icon-chip.chip-slate { background: #1e293b; color: #94a3b8; }
.dark .icon-chip.chip-indigo { background: #312e81; color: #a5b4fc; }
.dark .icon-chip.chip-violet { background: #4c1d95; color: #c4b5fd; }
.dark .icon-chip.chip-emerald { background: #064e3b; color: #6ee7b7; }
.dark .icon-chip.chip-amber { background: #78350f; color: #fcd34d; }
.dark .icon-chip.chip-rose { background: #881337; color: #fda4af; }
.dark .icon-chip.chip-sky { background: #0c4a6e; color: #7dd3fc; }
.dark .pill-slate { background: #1e293b; color: #cbd5e1; }
.dark .pill-indigo { background: #312e81; color: #a5b4fc; }
.dark .pill-violet { background: #4c1d95; color: #c4b5fd; }
.dark .pill-emerald { background: #064e3b; color: #6ee7b7; }
.dark .pill-amber { background: #78350f; color: #fcd34d; }
.dark .pill-rose { background: #881337; color: #fda4af; }
.dark .pill-sky { background: #0c4a6e; color: #7dd3fc; }
.dark .tbl thead th { background: #0f172a; color: #64748b; }
.dark .tbl tbody td { border-color: #1e293b; color: #cbd5e1; }
.dark .tbl tbody tr:hover { background: #1e293b; }
.dark .tbl tr.flag-row { background: #4c0519; }
.dark .tbl tr.flag-row:hover { background: #5c1220; }
.dark .tbl tfoot { background: #0f172a; }
.dark .label { color: #cbd5e1; }
.dark .input, .dark .select, .dark .textarea { background-color: #0f172a; color: #e2e8f0; border-color: #334155; }
.dark .field-hint { color: #64748b; }
.dark .progress { background: #1e293b; }
.dark .divider-dash { border-color: #1e293b; }
/* Cash Guard panel sits on slate-900 in BOTH themes — its slate labels must not
   be dimmed further by the dark-mode utility overrides above. */
.dark .cashguard .text-slate-400 { color: #94a3b8; }
.dark .cashguard .text-slate-500 { color: #94a3b8; }
.dark .nav-link { color: #94a3b8; }
.dark .nav-link:hover { background: #1e293b; color: #e2e8f0; }
.dark .nav-link.active { background: #312e81; color: #a5b4fc; }
.dark .nav-divider { background: #334155; }
.dark .nav-admin { border-color: #334155; background: #0f172a; }
.dark .nav-admin:hover, .dark .nav-admin.active { border-color: #6d28d9; background: #312e81; color: #a5b4fc; }
.dark .side-link { color: #94a3b8; }
.dark .side-link:hover { background: #1e293b; color: #e2e8f0; }
.dark .side-link.active { background: #312e81; color: #a5b4fc; }
.dark .side-link.active i { color: #a5b4fc; }
.dark .side-section-label { color: #64748b; }
.dark .modal-card { background: #0f172a; }
.dark .otp-input { background: #0f172a; color: #e2e8f0; border-color: #334155; }
.dark .otp-input:focus { border-color: #818cf8; box-shadow: 0 0 0 3px rgba(129,140,248,.3); }
.dark .avatar-initials { color: #fff; }

/* Image quality badge (assets/image-quality.js) */
.iq-badge { display: flex; align-items: center; gap: .8rem; margin-top: .8rem; padding: .7rem .85rem; border-radius: .9rem; border: 1px solid #e2e8f0; background: #f8fafc; }
.dark .iq-badge { background: #1e293b; border-color: #334155; }
.iq-ring { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.iq-score { width: 34px; height: 34px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-weight: 800; font-size: .8rem; color: #0f172a; }
.dark .iq-score { background: #0f172a; color: #e2e8f0; }
.iq-body { min-width: 0; }
.iq-grade { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.iq-meta { font-size: .68rem; color: #94a3b8; margin-top: .1rem; }
.iq-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .35rem; }
.iq-chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .66rem; font-weight: 600; padding: .18rem .5rem; border-radius: 999px; white-space: nowrap; }
.iq-chip.ok { background: #ecfdf5; color: #059669; }
.iq-chip.warn { background: #fffbeb; color: #d97706; }
.iq-chip.bad { background: #fff1f2; color: #e11d48; }
.dark .iq-chip.ok { background: #064e3b; color: #34d399; }
.dark .iq-chip.warn { background: #451a03; color: #fbbf24; }
.dark .iq-chip.bad { background: #4c0519; color: #fb7185; }
.iq-loading { color: #64748b; font-size: .75rem; font-weight: 600; }
.iq-spin { display: inline-grid; place-items: center; width: 20px; height: 20px; color: #6366f1; }
.iq-spin i { animation: iq-rot 1s linear infinite; }
@keyframes iq-rot { to { transform: rotate(360deg); } }

/* ============================================================================
   Storefront redesign (v2) — category tiles, browse deck, products header
   ============================================================================ */

/* ---------- Category photo tiles ---------- */
.cat-tile {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end;
  aspect-ratio: 4 / 5; border-radius: 1.25rem; overflow: hidden; isolation: isolate;
  box-shadow: 0 12px 28px -14px rgba(15, 23, 42, .25);
  transition: transform .25s ease, box-shadow .25s ease;
}
.cat-tile:hover { transform: translateY(-4px); box-shadow: 0 22px 44px -16px rgba(15, 23, 42, .32); }
.cat-tile-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.cat-tile-veil { position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(15,23,42,.04) 22%, rgba(15,23,42,.84) 94%); transition: background .3s ease; }
.cat-tile:hover .cat-tile-veil { background: linear-gradient(180deg, rgba(15,23,42,.12) 22%, rgba(15,23,42,.92) 94%); }
.cat-tile-icon {
  position: absolute; top: .9rem; left: .9rem; width: 2.3rem; height: 2.3rem; border-radius: .75rem;
  display: grid; place-items: center; background: rgba(255, 255, 255, .94); color: #4f46e5;
  font-size: 1rem; box-shadow: 0 8px 16px -6px rgba(2, 6, 23, .45);
}
.cat-tile-body { padding: 1rem 1rem 1.1rem; color: #fff; display: flex; flex-direction: column; gap: .1rem; }
.cat-tile-name { font-weight: 800; font-size: 1.02rem; letter-spacing: -.01em; }
.cat-tile-count { font-size: .74rem; font-weight: 600; color: rgba(255, 255, 255, .78); }

/* ---------- Products page header: trust badge + title, pretty & static ---------- */
.products-head {
  position: relative; overflow: hidden;
  border-radius: 1.4rem; padding: 1.9rem 1.5rem 1.6rem;
  border: 1px solid #e0e7ff;
  background: linear-gradient(135deg, #eef2ff 0%, #faf5ff 55%, #fdf2f8 100%);
}
.dark .products-head { border-color: #312e81; background: linear-gradient(160deg, #151030 0%, #241b4d 55%, #3b1a3e 100%); }
.ph-inner { position: relative; z-index: 1; }
.ph-badge { box-shadow: 0 4px 14px -6px rgba(5, 150, 105, .45); }
.ph-title {
  margin-top: .85rem; font-weight: 800; letter-spacing: -.03em;
  font-size: clamp(1.7rem, 4.5vw, 2.5rem); line-height: 1.08; color: #0f172a;
}
.dark .ph-title { color: #f1f5f9; }
.ph-accent {
  background: linear-gradient(92deg, #4f46e5, #9333ea, #db2777);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ph-sub {
  margin-top: .6rem; max-width: 40rem; font-size: .92rem; line-height: 1.6;
  color: #64748b;
}
.dark .ph-sub { color: #a5b4fc; }
/* Soft color glows + a faint dot field that fades toward the right */
.ph-glow { position: absolute; border-radius: 9999px; filter: blur(42px); pointer-events: none; }
.ph-glow-a { width: 16rem; height: 16rem; top: -7rem; right: 8%; background: rgba(129, 140, 248, .35); }
.ph-glow-b { width: 12rem; height: 12rem; bottom: -6rem; right: 30%; background: rgba(232, 121, 249, .28); }
.ph-glow-c { width: 10rem; height: 10rem; top: -3rem; left: 30%; background: rgba(52, 211, 153, .22); }
.dark .ph-glow-a { background: rgba(99, 102, 241, .3); }
.dark .ph-glow-b { background: rgba(217, 70, 239, .22); }
.dark .ph-glow-c { background: rgba(52, 211, 153, .16); }
.ph-dots {
  position: absolute; top: 1.2rem; right: 1.4rem; width: 9rem; height: 5.5rem;
  background-image: radial-gradient(rgba(99, 102, 241, .35) 1.3px, transparent 1.3px);
  background-size: 13px 13px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 55%);
  mask-image: linear-gradient(90deg, transparent, #000 55%);
  pointer-events: none;
}
.dark .ph-dots { background-image: radial-gradient(rgba(165, 180, 252, .35) 1.3px, transparent 1.3px); }
@media (max-width: 639px) {
  .products-head { padding: 1.35rem 1.15rem 1.2rem; border-radius: 1.15rem; }
  .ph-dots { opacity: .55; }
  .ph-sub { font-size: .84rem; }
}

/* ---------- Products page: unified browse deck (pure filter bar, sticky at the peak) ---------- */
.browse-deck {
  position: sticky; top: 0; z-index: 40;
  background: rgba(248, 250, 252, .92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid #e2e8f0; border-radius: 1.1rem; padding: .8rem .9rem;
  box-shadow: 0 10px 30px -18px rgba(15, 23, 42, .2);
  overflow: visible;
  transition: box-shadow .25s ease, border-color .25s ease;
}
.browse-deck.stuck {
  box-shadow: 0 18px 40px -14px rgba(15, 23, 42, .28), 0 2px 6px -2px rgba(15, 23, 42, .08);
  border-color: #c7d2fe;
  /* Flush against the peak — flatten the top corners so it truly hugs the edge */
  border-top-left-radius: 0; border-top-right-radius: 0;
  border-left-color: transparent; border-right-color: transparent; border-top-color: transparent;
}
.dark .browse-deck.stuck { border-color: #4338ca; box-shadow: 0 18px 44px -14px rgba(0, 0, 0, .6); }

/* Pagination / anchor scrolls must clear the pinned deck, not hide behind it. */
#product-grid { scroll-margin-top: 5.5rem; }
.browse-deck::before {
  content: ''; position: absolute; top: 0; left: 1.1rem; right: 1.1rem; height: 2px;
  background: linear-gradient(90deg, #4f46e5, #7c3aed, #db2777);
  border-radius: 9999px; opacity: .55;
}
.dark .browse-deck { background: rgba(2, 6, 23, .9); border-color: #1e293b; }

/* On the products page the nav scrolls away, so the deck can pin to the very
   top edge (peak) of the viewport when its stickiness is revealed. */
body[data-page="products"] .nav-bar { position: relative; }

/* Filter dropdowns — icon triggers, accordion menus */
.fdrop { position: relative; }
.fdrop-trigger {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  height: 2.7rem; min-width: 2.7rem; padding: 0 .7rem; border-radius: .8rem;
  border: 1px solid #e2e8f0; background: #fff; color: #475569;
  font-size: .95rem; cursor: pointer; transition: all .15s ease;
}
.fdrop-trigger:hover { border-color: #c7d2fe; background: #eef2ff; color: #4f46e5; }
.fdrop-trigger[aria-expanded="true"] { border-color: #818cf8; background: #eef2ff; color: #4f46e5; box-shadow: 0 0 0 3px rgba(129, 140, 248, .2); }
.fdrop-caret { font-size: .62rem; color: #94a3b8; transition: transform .18s ease; }
.fdrop-trigger[aria-expanded="true"] .fdrop-caret { transform: rotate(180deg); }
.fdrop-dot {
  position: absolute; top: .42rem; right: .42rem; width: .45rem; height: .45rem; border-radius: 9999px;
  background: #4f46e5; border: 2px solid #fff; opacity: 0; transform: scale(.4);
  transition: all .18s ease; pointer-events: none;
}
.fdrop-dot.on { opacity: 1; transform: none; }
.dark .fdrop-dot { border-color: #0f172a; }
.fdrop-menu {
  position: absolute; top: calc(100% + .5rem); left: 0; z-index: 45;
  min-width: 15rem; max-width: calc(100vw - 1.5rem); max-height: 21rem; overflow-y: auto;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 1rem; padding: .4rem;
  box-shadow: 0 22px 48px -16px rgba(15, 23, 42, .3);
  opacity: 0; pointer-events: none; transform: translateY(6px) scale(.98);
  transition: opacity .16s ease, transform .16s ease;
}
.fdrop-menu.open { opacity: 1; pointer-events: auto; transform: none; }
/* Smart positioning — when the menu would spill past the bottom of the
   viewport, app.js flips it to open upward from the trigger instead. */
.fdrop-menu.flip-up { top: auto; bottom: calc(100% + .5rem); transform: translateY(-6px) scale(.98); }
.fdrop-menu.flip-up.open { transform: none; }
.fdrop-menu-wide { min-width: 17rem; }
.dark .fdrop-menu { background: #0f172a; border-color: #1e293b; }
.fdrop-title {
  font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  color: #94a3b8; padding: .35rem .55rem .3rem;
}
.fdrop-opt {
  position: relative; display: flex; align-items: center; gap: .6rem; width: 100%; text-align: left;
  padding: .5rem 1.9rem .5rem .6rem; border-radius: .65rem;
  font-size: .85rem; font-weight: 600; color: #334155; cursor: pointer;
  transition: background .12s ease; border: 0; background: transparent;
}
.fdrop-opt:hover { background: #f1f5f9; }
.fdrop-opt.active { background: #eef2ff; color: #4f46e5; }
.fdrop-ic { width: 1.1rem; text-align: center; color: #94a3b8; font-size: .8rem; flex-shrink: 0; }
.fdrop-opt.active .fdrop-ic { color: #4f46e5; }
.fdrop-n { margin-left: auto; font-size: .66rem; font-weight: 700; color: #94a3b8; flex-shrink: 0; }
.fdrop-opt.active .fdrop-n { color: #818cf8; }
/* Checkmark is absolutely placed so the count keeps its right-aligned auto margin. */
.fdrop-check {
  position: absolute; right: .55rem; top: 50%; color: #4f46e5; font-size: .78rem;
  opacity: 0; transform: translateY(-50%) scale(.5); transition: all .15s ease;
}
.fdrop-opt.active .fdrop-check { opacity: 1; transform: translateY(-50%) scale(1); }
.fdrop-opt.active .fdrop-n { display: none; }
.dark .fdrop-trigger { background: #0f172a; border-color: #334155; color: #cbd5e1; }
.dark .fdrop-trigger:hover { border-color: #6366f1; background: #1e293b; color: #a5b4fc; }
.dark .fdrop-trigger[aria-expanded="true"] { border-color: #6366f1; background: #312e81; color: #a5b4fc; }
.dark .fdrop-opt { color: #cbd5e1; }
.dark .fdrop-opt:hover { background: #1e293b; }
.dark .fdrop-opt.active { background: #312e81; color: #a5b4fc; }
.dark .fdrop-opt.active .fdrop-ic, .dark .fdrop-opt.active .fdrop-check { color: #a5b4fc; }
.dark .fdrop-opt.active .fdrop-n { color: #a5b4fc; }

/* Store dropdown pager — compact prev/next footer with page indicator. */
.fdrop-pager {
  display: flex; align-items: center; justify-content: center; gap: .35rem;
  margin-top: .3rem; padding: .5rem .4rem .25rem; border-top: 1px solid #f1f5f9;
  /* Stays pinned to the menu's bottom edge even when the option list scrolls,
     so the pager can never end up cut off below the fold. */
  position: sticky; bottom: 0; background: #fff; z-index: 1;
  border-radius: 0 0 .65rem .65rem;
}
.dark .fdrop-pager { border-top-color: #1e293b; background: #0f172a; }
.fdrop-pg {
  display: grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: .55rem;
  border: 1px solid #e2e8f0; background: #fff; color: #475569; font-size: .7rem; cursor: pointer;
  transition: all .12s ease;
}
.fdrop-pg:hover:not(:disabled) { border-color: #6366f1; color: #4f46e5; background: #eef2ff; }
.fdrop-pg:disabled { opacity: .35; cursor: default; }
.dark .fdrop-pg { background: #0f172a; border-color: #334155; color: #cbd5e1; }
.dark .fdrop-pg:hover:not(:disabled) { border-color: #6366f1; color: #a5b4fc; background: #1e293b; }
.fdrop-pg-info { font-size: .68rem; font-weight: 700; color: #94a3b8; min-width: 2.6rem; text-align: center; }

/* Search — fills the freed space. Mobile: icon toggles an expanding panel. */
.fdrop-search { flex: 1; min-width: 0; position: relative; }
.fdrop-search > i { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: .85rem; pointer-events: none; }
.fdrop-search input {
  width: 100%; height: 2.7rem; padding: 0 1rem 0 2.5rem; border-radius: .8rem;
  border: 1px solid #e2e8f0; background: #fff; font-size: .875rem; color: #0f172a;
  outline: none; transition: border .15s ease, box-shadow .15s ease;
}
.fdrop-search input::placeholder { color: #94a3b8; }
.fdrop-search:focus-within input { border-color: #818cf8; box-shadow: 0 0 0 3px rgba(129, 140, 248, .2); }
.dark .fdrop-search input { background: #0f172a; border-color: #334155; color: #e2e8f0; }
.dark .fdrop-search input::placeholder { color: #64748b; }
.fdrop-search-toggle {
  display: none; align-items: center; justify-content: center;
  height: 2.7rem; min-width: 2.7rem; padding: 0 .7rem; border-radius: .8rem;
  border: 1px solid #e2e8f0; background: #fff; color: #475569; font-size: .95rem;
  cursor: pointer; transition: all .15s ease;
}
.fdrop-search-toggle:hover { border-color: #c7d2fe; background: #eef2ff; color: #4f46e5; }
.dark .fdrop-search-toggle { background: #0f172a; border-color: #334155; color: #cbd5e1; }
.dark .fdrop-search-toggle:hover { border-color: #6366f1; background: #1e293b; color: #a5b4fc; }

/* The mobile search back arrow — hidden on desktop, leads the bar in search mode */
.search-back {
  display: none; align-items: center; justify-content: center;
  height: 2.7rem; min-width: 2.7rem; padding: 0 .6rem; border-radius: .8rem;
  border: 1px solid #e2e8f0; background: #fff; color: #475569; font-size: .95rem;
  cursor: pointer; transition: all .15s ease; flex-shrink: 0;
}
.search-back:hover { border-color: #c7d2fe; background: #eef2ff; color: #4f46e5; }
.dark .search-back { background: #0f172a; border-color: #334155; color: #cbd5e1; }
.dark .search-back:hover { border-color: #6366f1; background: #1e293b; color: #a5b4fc; }

/* Mobile: the search icon swaps the whole bar — the filter buttons disappear
   and the input fills the deck itself (search ON the bar, never under it). */
@media (max-width: 639px) {
  .fdrop-search { position: static; flex: none; display: none; }
  .fdrop-search-toggle { display: inline-flex; }
  .browse-deck.searching .fdrop { display: none; }
  .browse-deck.searching .fdrop-search-toggle { display: none; }
  .browse-deck.searching .fdrop-search {
    display: flex; flex: 1; min-width: 0; align-items: center; gap: .5rem;
  }
  /* The magnifier gives way to the back arrow — one implies the other */
  .browse-deck.searching .fdrop-search > i { display: none; }
  .browse-deck.searching .fdrop-search input { padding-left: .95rem; height: 2.6rem; }
  .browse-deck.searching .search-back { display: inline-flex; }
}

/* ---------- Product page: sticky mobile buy bar ---------- */
.buy-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .7rem 1rem calc(.7rem + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .95); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid #e2e8f0;
}
.dark .buy-bar { background: rgba(15, 23, 42, .95); border-color: #1e293b; }
@media (min-width: 1024px) { .buy-bar { display: none; } }

/* ---------- Mobile compaction for the shared nav ---------- */
@media (max-width: 639px) {
  .nav-bar .btn-sm { padding: .34rem .6rem; }
  .nav-bar .nav-search, .nav-bar [data-dark-toggle] { width: 2.1rem; height: 2.1rem; }
  .lang-toggle { padding: .14rem; }
  .lang-toggle .lt-opt { padding: .3rem .44rem; font-size: .66rem; }
}
/* Very small screens: tighten the nav so logo + actions never overflow. */
@media (max-width: 380px) {
  .nav-bar .max-w-7xl { gap: .4rem; }
  .nav-bar .font-extrabold span:not(:first-child) { display: none; }
}

/* ============================================================================
   MOBILE — phones & small tablets. Tables become stacked cards (cells carry
   data-label mirrors of their <th>, injected by mobileTableLabels in app.js),
   modals become bottom sheets, dropdown menus go full-width, tap targets grow.
   ============================================================================ */

/* ---------- Tables → stacked cards (≤640px) ---------- */
@media (max-width: 640px) {
  .tbl { display: block; border: 0; }
  .tbl thead { display: none; }
  .tbl tbody { display: block; padding: .35rem 0 .6rem; }
  .tbl tbody tr {
    display: block; border: 1px solid #e2e8f0; border-radius: 1rem;
    background: #fff; padding: .55rem .95rem; margin-bottom: .65rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
  }
  .tbl tbody tr:last-child { margin-bottom: 0; }
  .tbl tbody tr:hover { background: #fff; }
  .tbl tbody tr.flag-row { background: #fff1f2; border-color: #fecdd3; }
  .tbl tbody td {
    display: flex; flex-wrap: wrap; justify-content: flex-end;
    gap: .1rem 1rem; padding: .45rem 0; border: 0; text-align: right;
  }
  .tbl tbody td::before {
    content: attr(data-label);
    flex: 0 0 100%;
    font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
    color: #94a3b8;
  }
  .tbl tbody td > *:not(.pill) { min-width: 0; }
  .tbl tbody td > .flex, .tbl tbody td > div { justify-content: flex-end; }
  .tbl tbody td[colspan] { display: block; text-align: center; padding: 1.25rem .5rem; }
  .tbl tbody td[colspan]::before { display: none; }

  /* Totals strip (earnings + settlement feet) */
  .tbl tfoot { display: block; }
  .tbl tfoot tr {
    display: block; border: 1px solid #e2e8f0; border-radius: 1rem;
    background: #f8fafc; padding: .55rem .95rem;
  }
  .tbl tfoot td { display: flex; flex-wrap: wrap; justify-content: flex-end; border: 0; padding: .25rem 0; text-align: right; }
  .tbl tfoot td::before {
    content: attr(data-label);
    flex: 0 0 100%;
    font-size: .6rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
    color: #94a3b8;
  }
  .tbl tfoot td:empty { display: none; }

  .dark .tbl tbody tr { background: #0f172a; border-color: #1e293b; }
  .dark .tbl tbody tr:hover { background: #0f172a; }
  .dark .tbl tbody tr.flag-row { background: #4c0519; border-color: #881337; }
  .dark .tbl tfoot tr { background: #1e293b; border-color: #1e293b; }
}

/* ---------- Modals → bottom sheets (≤480px) ---------- */
@media (max-width: 480px) {
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-card, .modal-card.wide {
    width: 100%; max-width: 100%; max-height: 92dvh;
    border-radius: 1.4rem 1.4rem 0 0;
    transform: translateY(28px) scale(1);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .modal-card > div { padding: 1.15rem 1.2rem 1.5rem; }
  .modal-overlay.open .modal-card { transform: none; }
}

/* ---------- Mobile dropdown menus: fit the screen, anchor smartly ---------- */
@media (max-width: 639px) {
  .fdrop-menu, .fdrop-menu-wide { min-width: 0; width: max-content; max-width: calc(100vw - 1.25rem); }
  /* Both triggers sit at the LEFT of the browse deck, so anchor every menu to
     the trigger's left edge — `right: 0` on the wide one pushed it off-screen. */
  .fdrop-menu-wide, .fdrop-menu:not(.fdrop-menu-wide) { left: 0; right: auto; }
  .browse-deck { gap: .5rem; }
}

/* ---------- Mobile nav menu (storefront hamburger) ---------- */
@media (max-width: 767px) {
  [data-mobile-nav] {
    padding: .4rem .8rem .95rem;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 18px 30px -18px rgba(15, 23, 42, .25);
  }
  [data-mobile-nav] .nav-link {
    width: 100%; padding: .8rem .95rem; border-radius: .8rem;
    font-weight: 700; font-size: .95rem;
  }
  .dark [data-mobile-nav] { background: #0f172a; border-top-color: #1e293b; }
}

/* ---------- Tap targets & spacing (≤640px) ---------- */
@media (max-width: 640px) {
  .btn { min-height: 2.6rem; }
  .btn-sm { min-height: 2.3rem; padding-top: .45rem; padding-bottom: .45rem; }
  .side-link { padding: .7rem .8rem; font-size: .9rem; }
  .nav-link { padding: .55rem .75rem; }
  .stat-card { padding: 1.05rem 1.1rem; }
  .stat-value { font-size: 1.35rem; }
  .dash-main { padding-bottom: 2.5rem; }
  /* allow wide content to wrap instead of forcing the page wide */
  .overflow-x-auto { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .toast-wrap { left: 1rem; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom)); align-items: stretch; }
  .toast { max-width: none; width: 100%; }
  /* command palette: full-width results on phones */
  .palette-box { max-width: 100%; max-height: 78dvh; }
}

/* ---------- Small-screen type & shell tweaks ---------- */
@media (max-width: 480px) {
  h1, .text-2xl { letter-spacing: -.01em; }
  .card.p-8 { padding: 1.5rem; }
  .dash-shell { min-height: calc(100dvh - 4rem); }
}
@supports not (height: 100dvh) {
  @media (max-width: 480px) { .dash-shell { min-height: calc(100vh - 4rem); } }
}

/* Sidebar drawer — safe-area bottom + cap width on small screens */
@media (max-width: 1023px) {
  .dash-sidebar { max-width: 84vw; padding-bottom: env(safe-area-inset-bottom); }
}

/* Contract step indicator — circles only on tiny screens */
@media (max-width: 480px) {
  .contract-steps .c-step:not(.w-8):not(.h-px) { display: none; }
}

/* IQ badge (image quality) wraps gracefully on phones */
@media (max-width: 640px) {
  .iq-badge { flex-wrap: wrap; }
}

/* ================================================================== *
   THIS WEEK console — the money flow, one week at a time.
   Collect (Sat) · Pay (Sun) · History (read-only)
   ================================================================== */
.tw-tabs {
  display: flex; gap: .35rem; padding: .3rem;
  background: #eef2ff; border: 1px solid #e0e7ff; border-radius: 1rem;
}
.dark .tw-tabs { background: #1e1b4b; border-color: #312e81; }
.tw-tab {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .7rem .9rem; border-radius: .75rem;
  font-size: .9rem; font-weight: 700; color: #6366f1;
  transition: all .18s ease; cursor: pointer;
}
.tw-tab em { font-style: normal; font-weight: 600; opacity: .65; font-size: .78rem; }
.tw-tab:hover { background: rgba(255,255,255,.6); }
.dark .tw-tab:hover { background: rgba(255,255,255,.05); }
.tw-tab.active { background: #fff; color: #4f46e5; box-shadow: 0 1px 4px rgba(79,70,229,.22); }
.dark .tw-tab.active { background: #312e81; color: #c7d2fe; box-shadow: 0 1px 6px rgba(0,0,0,.4); }
.tw-panel { display: none; animation: twFade .22s ease; }
.tw-panel.active { display: block; }
@keyframes twFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---- ledger rows (collect + pay) ---- */
.ledger-row {
  padding: .95rem 1.1rem;
  display: flex; flex-direction: column; gap: .7rem;
  transition: background .15s ease;
}
.ledger-row:hover { background: #fafbff; }
.dark .ledger-row:hover { background: #0f172a; }
.ledger-row.is-bf { background: linear-gradient(90deg, #fff1f2, transparent 65%); border-left: 3px solid #f43f5e; }
.dark .ledger-row.is-bf { background: linear-gradient(90deg, rgba(244,63,94,.12), transparent 65%); }
.ledger-row.is-paid { opacity: .62; }
.ledger-main { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.ledger-due { text-align: right; min-width: 92px; }
.ledger-state { flex-shrink: 0; }
.bf-chip {
  display: inline-block; font-size: .6rem; font-weight: 800; letter-spacing: .03em;
  color: #e11d48; background: #ffe4e6; border-radius: 999px; padding: .14rem .5rem;
  text-transform: uppercase; vertical-align: middle;
}
.dark .bf-chip { background: rgba(244,63,94,.18); color: #fda4af; }
.ledger-act {
  display: flex; align-items: center; justify-content: flex-end; gap: .6rem;
  padding-left: 2.6rem; flex-wrap: wrap;
}
.confirm-box {
  display: inline-flex; align-items: center; gap: .35rem;
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: .8rem; padding: .25rem;
}
.dark .confirm-box { background: #1e293b; border-color: #334155; }
.confirm-prefix { font-size: .68rem; font-weight: 800; color: #94a3b8; padding-left: .6rem; }
.confirm-input {
  width: 6.2rem; padding: .5rem .6rem; border: none; outline: none;
  background: transparent; font-weight: 800; color: #0f172a; font-size: .95rem;
  border-radius: .5rem;
}
.confirm-input:focus { background: #fff; box-shadow: 0 0 0 2px #6366f1; }
.dark .confirm-input { color: #e2e8f0; }
.dark .confirm-input:focus { background: #0f172a; }
.confirm-btn { min-height: 2.2rem; }

.ledger-paid-line summary {
  cursor: pointer; padding: .6rem 1.1rem; font-size: .8rem; font-weight: 700;
  color: #059669; background: #ecfdf5; list-style: none;
}
.dark .ledger-paid-line summary { background: rgba(16,185,129,.1); color: #6ee7b7; }
.ledger-paid-line summary::-webkit-details-marker { display: none; }
.ledger-paid-line[open] summary { border-bottom: 1px solid #e2e8f0; }

/* ---- history cards ---- */
.history-week { border-radius: 1rem; }
.history-week summary { list-style: none; }
.history-week summary::-webkit-details-marker { display: none; }
.history-week[open] summary { border-bottom: 1px solid #e2e8f0; }

@media (max-width: 640px) {
  .tw-tab { font-size: .82rem; padding: .65rem .5rem; gap: .35rem; }
  .ledger-act { padding-left: 0; justify-content: stretch; }
  .ledger-act .confirm-box { flex: 1; }
  .confirm-input { width: 100%; flex: 1; }
  .ledger-main { flex-wrap: wrap; }
  .ledger-due { min-width: 0; }
}

/* ============================================================================
   M7 — error pages & the confirm modal
   ============================================================================ */
/* ---------- View-as — admin read-only preview ---------- */
.view-as-bar {
  background: linear-gradient(90deg, #eef2ff, #f5f3ff);
  border-bottom: 1px solid #c7d2fe;
  color: #334155;
}
.dark .view-as-bar { background: linear-gradient(90deg, #1e1b4b, #2e1065); border-bottom-color: #4c1d95; color: #c7d2fe; }
/* In a read-only preview the merchant's write forms are inert. The server
   blocks them too — this is visual + click protection only. */
body.view-as .dash-main form[method="post"],
body.view-as .dash-main form[method="POST"] {
  pointer-events: none; opacity: .55; filter: saturate(.75);
}

.error-page  { min-height: 70vh; display: flex; align-items: center; justify-content: center; padding: 3rem 1rem; }
.error-card  { max-width: 460px; width: 100%; text-align: center; }
.error-panel { background: #fff; border: 1px solid #e2e8f0; border-radius: 1.5rem; padding: 2.75rem 2.25rem; box-shadow: 0 20px 45px -25px rgba(15, 23, 42, .18); }
.dark .error-panel { background: #0f172a; border-color: #1e293b; box-shadow: 0 20px 45px -25px rgba(0, 0, 0, .55); }
/* 403 gate illustration — the empty icon chip is replaced with a real SVG */
.err-art { width: 150px; height: auto; margin: 0 auto 1.25rem; display: block; }
.err-art .blob { fill: #eef2ff; }
.dark .err-art .blob { fill: #1e1b4b; }
.error-code  { font-size: 3.5rem; font-weight: 800; line-height: 1; background: linear-gradient(120deg,#6366f1,#8b5cf6); -webkit-background-clip: text; background-clip: text; color: transparent; letter-spacing: -0.03em; }
.error-icon  { width: 56px; height: 56px; margin: 0 auto 1rem; border-radius: 1rem; display: grid; place-items: center; font-size: 1.4rem; }
.error-actions { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; margin-top: 1.5rem; }

/* Confirm modal (replaces window.confirm) */
.confirm-backdrop { position: fixed; inset: 0; background: rgba(2,6,23,.55); backdrop-filter: blur(2px); z-index: 90; display: grid; place-items: center; padding: 1rem; opacity: 0; visibility: hidden; transition: opacity .15s ease, visibility 0s linear .15s; }
.confirm-backdrop.open { opacity: 1; visibility: visible; transition: opacity .15s ease; }
.confirm-modal { max-width: 420px; width: 100%; border-radius: 1rem; box-shadow: 0 24px 64px -16px rgba(2,6,23,.45); transform: translateY(8px) scale(.98); transition: transform .15s ease; }
.confirm-backdrop.open .confirm-modal { transform: none; }
.confirm-actions { display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; }

/* ----------------------------------------------------------------
 * Role picker tabs (login / register) — prototype's two-tab switch:
 * active tab is solid indigo with a soft shadow; inactive is muted.
 * Three tabs (Seller / Promoter / Agent) can't share one row below
 * ~410px — the tabs wrap instead: Seller and Promoter keep their full
 * row, Agent drops to its own. The two main roles never shrink.
 * ---------------------------------------------------------------- */
.role-tabs { flex-wrap: wrap; row-gap: .25rem; }
.role-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .375rem;
  padding: .55rem .75rem;
  border-radius: .75rem;
  font-size: .875rem;
  font-weight: 700;
  color: #64748b;
  background: transparent;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
  cursor: pointer;
  white-space: nowrap;
}
.role-tab:hover { background: rgba(148, 163, 184, .18); color: #475569; }
.role-tab-on,
.role-tab-on:hover {
  background: #4f46e5;
  color: #fff;
  box-shadow: 0 4px 10px -2px rgba(79, 70, 229, .4);
}
.dark .role-tab { color: #94a3b8; }
.dark .role-tab:hover { background: rgba(148, 163, 184, .12); color: #e2e8f0; }
.dark .role-tab-on,
.dark .role-tab-on:hover { background: #4f46e5; color: #fff; }


/* ============================================================================
   STOREFRONT LIGHT MODE — warm cream palette
   Ported from the prototype's "warm ivory" section, pushed further from
   white: an oat-cream canvas, warm cream-paper surfaces and taupe borders.
   Scoped under the storefront body data-page attribute (index / products /
   product / stores — set in storefront/layout.php) so the admin/seller/
   promoter dashboards keep the original slate look. Every rule is guarded
   with html:not(.dark) — dark mode stays fully intact (the prototype's
   version lacked this guard and its cream surfaces could win over .dark).
   ============================================================================ */
html:not(.dark) body[data-page] {
  background-color: #f2ead9; /* oat cream — the light-mode canvas */
}

/* ---- Surfaces: cards, sections, panels ---- */
html:not(.dark) body[data-page] .bg-white {
  background-color: #fdf8ec; /* warm cream paper — clearly not white */
}
html:not(.dark) body[data-page] .bg-slate-50 {
  background-color: #f2ead9; /* oat cream — replaces cold slate-50 (same as canvas) */
}
html:not(.dark) body[data-page] .bg-slate-50\/60 {
  background-color: rgba(242, 234, 217, .6); /* oat cream @ 60% */
}
html:not(.dark) body[data-page] .bg-white\/85 {
  background-color: rgba(253, 248, 236, .85); /* warm paper @ 85% — nav bar */
}
html:not(.dark) body[data-page] .bg-white\/70 {
  background-color: rgba(253, 248, 236, .7); /* warm paper @ 70% */
}
html:not(.dark) body[data-page] .bg-slate-100 {
  background-color: #eae0c9; /* warm sand — replaces cold slate-100 */
}
html:not(.dark) body[data-page] .bg-slate-200 {
  background-color: #e2d5b6; /* warm sand — replaces cold slate-200 */
}

/* ---- Borders: warm taupe instead of cold slate ---- */
html:not(.dark) body[data-page] .border-slate-200 {
  border-color: #e5d8bd;
}
html:not(.dark) body[data-page] .border-slate-200\/70 {
  border-color: #e5d8bd;
}
html:not(.dark) body[data-page] .border-slate-100 {
  border-color: #ece2cb;
}
html:not(.dark) body[data-page] .border-slate-300 {
  border-color: #d5c6a5;
}

/* ---- Shared nav bar: warm translucent paper ---- */
html:not(.dark) body[data-page] .nav-bar {
  background: rgba(253, 248, 236, .88);
  border-color: #e5d8bd;
}

/* ---- Cards: warm paper + warm border ---- */
html:not(.dark) body[data-page] .card {
  background: #fdf8ec;
  border-color: #e5d8bd;
}
html:not(.dark) body[data-page] .card-hover:hover {
  border-color: #d5c6a5;
}

/* ---- Browse deck (products page): warm translucent paper ---- */
html:not(.dark) body[data-page] .browse-deck {
  background: rgba(242, 234, 217, .92);
  border-color: #e5d8bd;
}
html:not(.dark) body[data-page] .browse-deck.stuck {
  border-color: #d5c6a5;
}

/* ---- Filter triggers, search, dropdowns: warm paper ---- */
html:not(.dark) body[data-page] .fdrop-trigger,
html:not(.dark) body[data-page] .fdrop-search input,
html:not(.dark) body[data-page] .fdrop-search-toggle {
  background: #fdf8ec;
  border-color: #e5d8bd;
}
html:not(.dark) body[data-page] .fdrop-menu {
  background: #fdf8ec;
  border-color: #e5d8bd;
}
html:not(.dark) body[data-page] .fdrop-pager {
  background: #fdf8ec;
  border-top-color: #ece2cb;
}
html:not(.dark) body[data-page] .fdrop-pg {
  background: #fdf8ec;
  border-color: #e5d8bd;
}

/* ---- Products page header: warm gradient ---- */
html:not(.dark) body[data-page] .products-head {
  border-color: #e5d8bd;
  background: linear-gradient(135deg, #f0e6d0 0%, #f6efdf 55%, #f3e9d5 100%);
}

/* ---- Inputs: warm paper ---- */
html:not(.dark) body[data-page] .input,
html:not(.dark) body[data-page] .select,
html:not(.dark) body[data-page] .textarea {
  background: #fdf8ec;
  border-color: #e5d8bd;
}

/* ---- Buttons: outline & ghost warm paper ---- */
html:not(.dark) body[data-page] .btn-outline {
  background: #fdf8ec;
  border-color: #e5d8bd;
}
html:not(.dark) body[data-page] .btn-outline:hover {
  border-color: #d5c6a5;
}

/* ---- Mobile nav drawer: warm paper ---- */
html:not(.dark) body[data-page] [data-mobile-nav] {
  background: #fdf8ec;
  border-top-color: #e5d8bd;
}

/* ---- Mobile buy bar (product page): warm translucent paper ---- */
html:not(.dark) body[data-page] .buy-bar {
  background: rgba(253, 248, 236, .95);
  border-top-color: #e5d8bd;
}

/* ---- Search panel (products page mobile): warm paper ---- */
html:not(.dark) body[data-page] .fdrop-search.open {
  background: #fdf8ec;
  border-color: #e5d8bd;
}

/* ---- Footer: warm paper ---- */
html:not(.dark) body[data-page] footer {
  background: #fdf8ec;
  border-color: #e5d8bd;
}

/* ---- Mobile stacked table cards: warm paper ---- */
@media (max-width: 640px) {
  html:not(.dark) body[data-page] .tbl tbody tr {
    background: #fdf8ec;
    border-color: #e5d8bd;
  }
}

/* ---- Scrollbar thumb gap: warm paper ---- */
html:not(.dark) body[data-page] *::-webkit-scrollbar-thumb {
  border-color: #f2ead9;
}

/* ============================================================================
   Promoter mode — a logged-in promoter toggles a mode that turns every
   "Request to Buy" (and the store/category cards) into copy-tracking-link
   actions. Toggle + banner live in the storefront layout; storefront.js
   owns the behavior; body.promo-mode reveals the corner copy buttons.
   ============================================================================ */

/* Nav toggle — a slim pill next to the language switch. */
.promo-toggle {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem .7rem; border-radius: 9999px; flex-shrink: 0; line-height: 1;
  font-size: .72rem; font-weight: 800; color: #64748b; cursor: pointer;
  background: #f1f5f9; border: 1px solid #e2e8f0;
  transition: all .15s ease;
}
.promo-toggle:hover { border-color: #c7d2fe; background: #eef2ff; color: #4f46e5; }
.promo-toggle:active { transform: scale(.96); }
.promo-toggle.active {
  background: #4f46e5; border-color: #4f46e5; color: #fff;
  box-shadow: 0 4px 12px -4px rgba(79, 70, 229, .55);
}
.promo-toggle-ic { margin-left: .1rem; color: #94a3b8; }
.promo-toggle.active .promo-toggle-ic { color: #c7d2fe; }
.dark .promo-toggle { background: #1e293b; border-color: #334155; color: #94a3b8; }
.dark .promo-toggle:hover { border-color: #6366f1; background: #312e81; color: #e0e7ff; }
.dark .promo-toggle.active { background: #4f46e5; border-color: #4f46e5; color: #fff; }

/* Banner — one slim strip under the nav while the mode is on. */
.promo-banner {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  padding: .55rem 1rem; text-align: center; font-size: .8125rem;
  background: linear-gradient(90deg, #eef2ff, #faf5ff);
  border-bottom: 1px solid #e0e7ff; color: #3730a3;
}
.promo-banner strong { font-weight: 800; }
.promo-banner-ic { color: #4f46e5; }
.promo-banner-off { flex-shrink: 0; }
.dark .promo-banner { background: linear-gradient(90deg, #1e1b4b, #2e1065); border-color: #3730a3; color: #e0e7ff; }
.dark .promo-banner-ic { color: #a5b4fc; }

/* Corner copy button on category tiles / store cards — hidden unless the
   promoter toggled the mode on (the tile/card stays a normal link). */
.promo-copy {
  position: absolute; top: .7rem; right: .7rem; z-index: 20;
  width: 2.15rem; height: 2.15rem; border-radius: .65rem; border: none; cursor: pointer;
  display: none; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .95); color: #4f46e5; font-size: .8rem;
  box-shadow: 0 8px 16px -6px rgba(2, 6, 23, .4);
  transition: all .15s ease;
}
body.promo-mode .promo-copy { display: flex; }
.promo-copy:hover { background: #fff; color: #4338ca; transform: scale(1.06); }
.promo-copy:active { transform: scale(.94); }
.dark .promo-copy { background: rgba(30, 41, 59, .95); color: #a5b4fc; }
.dark .promo-copy:hover { background: #1e293b; color: #c7d2fe; }

/* Copy toast — transient confirmation for copied tracking links. */
.copy-toast {
  position: fixed; left: 50%; bottom: 1.6rem; z-index: 90;
  transform: translateX(-50%) translateY(10px);
  background: #0f172a; color: #fff; padding: .55rem 1.05rem; border-radius: .7rem;
  font-size: .8rem; font-weight: 700; letter-spacing: .01em;
  box-shadow: 0 14px 30px -10px rgba(2, 6, 23, .6);
  opacity: 0; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.copy-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.dark .copy-toast { background: #e0e7ff; color: #1e1b4b; }

/* ---------- Legal documents (contract sign / admin vault) ----------
   Ported from prototype/contract.html — the contract page and the admin
   contract vault share this paper-document look. All classes here were
   styled in the prototype only; the Play CDN never generated them. */
.legal-doc {
  font-family: 'Manrope', 'Noto Sans Ethiopic', ui-sans-serif, system-ui, sans-serif;
}
.legal-doc .doc-serif {
  font-family: 'Sora', 'Noto Serif Ethiopic', Georgia, serif;
}
.legal-doc h2.article-title {
  font-family: 'Sora', 'Noto Serif Ethiopic', Georgia, serif;
  font-size: .95rem; font-weight: 700; letter-spacing: .02em;
  text-transform: uppercase; color: #0b1220;
  margin: 1.6rem 0 .55rem;
}
.legal-doc .sec-no {
  font-weight: 700; color: #6366f1;
}
.legal-doc p.body {
  font-size: .83rem; line-height: 1.75; color: #334155; margin: .35rem 0;
}
.legal-doc .parties-box {
  border: 1px solid #d8dce6; border-radius: .9rem;
  background: #f8fafc; padding: 1.1rem 1.25rem;
}
.legal-doc .rule-line {
  border-top: 1px solid #cbd5e1; margin: .5rem 0;
}
.sig-line {
  display: inline-block; width: 220px; border-bottom: 1.5px solid #334155;
}
.paper-card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 1.1rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 16px 40px rgba(15, 23, 42, .07);
}
.dark .paper-card { background: #0f172a; border-color: #1e293b; }
.dark .legal-doc p.body { color: #cbd5e1; }
.dark .legal-doc .parties-box { background: #111c30; border-color: #1e293b; }
.dark .legal-doc h2.article-title { color: #f1f5f9; }
.watermark {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-18deg);
  font-family: 'Sora', 'Noto Serif Ethiopic', Georgia, serif;
  font-size: 4.5rem; font-weight: 700;
  color: rgba(99, 102, 241, .06); letter-spacing: .35em;
  white-space: nowrap; pointer-events: none; user-select: none;
}
.dark .watermark { color: rgba(129, 140, 248, .06); }
