/* Design tokens. Dark is the default; [data-theme="light"] overrides below.
   Dark palette matches the Brevo campaign look: warm near-black greys, a gold
   accent, and warm off-white text. Light mode keeps its indigo/violet accent.
   The theme is set on <html data-theme> before first paint by an inline script
   in the layouts. */
:root {
  --bg: #0a0a0a;
  --bg-grad: linear-gradient(135deg, #0a0a0a 0%, #141414 55%, #0d0d0d 100%);
  --panel: #141414;
  --panel-2: #0f0f0f;
  --input-bg: #0f0f0f;
  /* Warm off-white text in dark mode (pure black in light, set below). Headings,
     paragraphs, body, and content links all resolve to this unless the
     Appearance picker injects a custom color. */
  --text: #f2ede3;
  --muted: #8a8072;
  --accent: #c9a86a;
  --accent-2: #d8bd85;
  --accent-3: #b8975a;
  --brand-grad: linear-gradient(90deg, #b8975a, #c9a86a, #d8bd85);
  --border: #2a2620;
  --secondary: #1c1812;
  --error: #f87171;
  --error-bg: rgba(248, 113, 113, 0.12);
  --error-border: rgba(248, 113, 113, 0.3);
  --ok: #22c55e;
  --radius: 12px;
  /* Make native controls (select dropdowns, scrollbars, pickers) render dark. */
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}

[data-theme="light"] {
  --bg: #f5f5fa;
  --bg-grad: linear-gradient(135deg, #f7f7fb 0%, #eef0f7 50%, #e9ecf6 100%);
  --panel: #ffffff;
  --panel-2: #f2f3f8;
  --input-bg: #ffffff;
  --text: #000000;
  --muted: #52525b;
  /* Light mode keeps the original indigo/violet accent ramp. */
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-3: #a855f7;
  --brand-grad: linear-gradient(90deg, #6366f1, #8b5cf6, #a855f7);
  --border: rgba(0, 0, 0, 0.10);
  --secondary: rgba(0, 0, 0, 0.06);
  --error: #dc2626;
  --error-bg: rgba(220, 38, 38, 0.08);
  --error-border: rgba(220, 38, 38, 0.25);
  --ok: #16a34a;
  color-scheme: light;
}

/* Dark mode places dark text on the gold accent (matches the Brevo CTAs) so
   buttons/badges/banner stay legible instead of white-on-gold. */
[data-theme="dark"] .btn,
[data-theme="dark"] a.btn,
[data-theme="dark"] .promo-banner,
[data-theme="dark"] .promo-banner a,
[data-theme="dark"] .cart-link .badge,
[data-theme="dark"] .chip.active,
[data-theme="dark"] .range-pill.active { color: #0a0a0a; }
[data-theme="dark"] a.btn:hover { color: #0a0a0a; }

/* Storefront light mode uses the gold brand (copper accent for legibility on the
   light background). Scoped to non-admin bodies so the admin UI is untouched. */
[data-theme="light"] body:not(.admin-body) {
  --accent: #a9803a;
  --accent-2: #b8975a;
  --accent-3: #8f6a2c;
  --brand-grad: linear-gradient(90deg, #b8975a, #c9a86a, #d8bd85);
}
/* The gold gradient buttons (incl. bare <button> like Add to cart / Place order)
   need dark text for contrast; give link-buttons a gold ring instead of blue. */
[data-theme="light"] body:not(.admin-body) .btn,
[data-theme="light"] body:not(.admin-body) a.btn,
[data-theme="light"] body:not(.admin-body) button:not(.secondary):not(.linkish):not(.danger-link):not(.btn-flow) {
  color: #1a1508;
}
[data-theme="light"] body:not(.admin-body) a.btn:hover { color: #1a1508; }
[data-theme="light"] body:not(.admin-body) a.btn { box-shadow: 0 0 0 2px rgba(169, 128, 58, 0.5); }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }

/* Menu + footer link colors → gold/copper. The base `a` color is var(--accent),
   which is gold in dark mode but indigo in light mode, so storefront header/
   footer links looked blue in light. Pin them to the gold brand instead. */
/* Dark mode (default) — bright gold. Includes link-styled buttons (e.g. Sign
   out is a <button class="linkish">, not an <a>). */
.site-header a,
.site-footer a,
.site-header .linkish,
.site-footer .linkish {
  color: #c9a86a;
  text-decoration: none;
}
.site-header a:hover,
.site-footer a:hover,
.site-header .linkish:hover,
.site-footer .linkish:hover {
  color: #e0c585;
}
/* Light mode — deeper copper so it stays legible on the light background. */
[data-theme="light"] .site-header a,
[data-theme="light"] .site-footer a,
[data-theme="light"] .site-header .linkish,
[data-theme="light"] .site-footer .linkish {
  color: #a9803a;
}
[data-theme="light"] .site-header a:hover,
[data-theme="light"] .site-footer a:hover,
[data-theme="light"] .site-header .linkish:hover,
[data-theme="light"] .site-footer .linkish:hover {
  color: #8f6a2c;
}
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; }
/* Headings follow --text (#fff dark / #000 light) by default. Kept at element
   specificity so the Appearance heading-color picker still overrides it. */
h1, h2, h3, h4, h5, h6 { color: var(--text); }
/* Storefront content links read as body text (black/white) rather than accent,
   per request — nav/header links keep the accent color. Accent on hover. */
main.container a { color: var(--text); }
main.container a:hover { color: var(--accent); }

/* ---- promo banner (seamless infinite marquee) ---- */
.promo-banner {
  background-image: var(--brand-grad);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  overflow: hidden;
  padding: 0.55rem 0;
}
.promo-banner .marquee {
  display: flex;
  width: max-content;
  animation: marquee-scroll 30s linear infinite;
}
.promo-banner:hover .marquee { animation-play-state: paused; }
.promo-banner .marquee-group { display: flex; flex-shrink: 0; }
.promo-banner .marquee-item { padding: 0 2rem; white-space: nowrap; }
.promo-banner a { color: #fff; text-decoration: underline; }
@keyframes marquee-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
/* The marquee is an intentional, opt-in feature, so it keeps scrolling even
   when the OS requests reduced motion — but it slows down and pauses on hover. */
@media (prefers-reduced-motion: reduce) {
  .promo-banner .marquee { animation-duration: 60s; }
}

/* ---- header / footer ---- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
/* Light mode: header fades white (left) → #f0eff6 (right). */
:root[data-theme="light"] .site-header {
  background: linear-gradient(90deg, #ffffff 0%, #ffffff 25%, #f0eff6 75%, #f0eff6 100%);
}
.site-header .brand { font-weight: 700; color: var(--text); font-size: 1.1rem; display: inline-flex; align-items: center; }
.brand-logo { max-height: 40px; max-width: 200px; display: block; }
.brand-wordmark {
  font-weight: 700;
  letter-spacing: 1px;
  background-image: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.site-header nav { display: flex; gap: 1.1rem; align-items: center; flex-wrap: wrap; }
.cart-link .badge {
  display: inline-block;
  min-width: 1.2em;
  padding: 0 0.35em;
  margin-left: 0.3em;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  text-align: center;
}
.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  width: auto;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 1rem;
  line-height: 1;
}
.theme-toggle:hover { filter: none; border-color: var(--accent); }
.site-footer {
  margin-top: auto;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}
.site-footer nav { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.5rem; }

.container { width: 100%; max-width: 1040px; margin: 0 auto; padding: 2rem 1.5rem; flex: 1; }

/* ---- hero / sections ---- */
.hero h1 {
  margin-bottom: 0.25rem;
  background-image: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}
.hero p { color: var(--muted); }
/* Light mode: the store name reads solid black, not the purple brand gradient. */
:root[data-theme="light"] .hero h1 {
  background-image: none;
  -webkit-text-fill-color: #000;
  color: #000;
}
/* Centered section heading (e.g. home "Featured"). */
.section-centered { text-align: center; display: block; }

/* Billing address mirrored from shipping (checkout "same for billing"). */
.billing-mirrored { opacity: .55; pointer-events: none; }

/* Collapsible shipping/billing summary (checkout), default collapsed. */
.addr-collapse { border: 1px solid var(--border); border-radius: var(--radius); margin-top: 1rem; overflow: hidden; }
.addr-collapse-summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.25rem; }
.addr-collapse-summary::-webkit-details-marker { display: none; }
.addr-collapse-carrot { font-size: 1.7rem; line-height: 1; color: var(--muted); transition: transform .2s ease; }
.addr-collapse[open] .addr-collapse-carrot { transform: rotate(180deg); }
.addr-collapse > .card { margin: 0; border: none; border-top: 1px solid var(--border); border-radius: 0; }

/* "How it works" guide cards (Workflow / Automations). */
.guide-card { border-left: 3px solid var(--accent); }
.guide-steps { margin: .4rem 0 1rem; padding-left: 1.2rem; display: flex; flex-direction: column; gap: .4rem; }
.guide-steps li { line-height: 1.5; }

/* Roles & permissions — modernized card + permission grid. */
.role-card { margin-bottom: 1rem; }
.role-head { display: flex; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.role-badge { align-self: center; white-space: nowrap; }
.super-toggle { display: flex; align-items: center; gap: .5rem; margin: .75rem 0; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); }
.perm-details { margin-top: .25rem; }
.perm-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .75rem; margin-top: .6rem; transition: opacity .2s ease; }
.perm-groups.perm-dimmed { opacity: .4; pointer-events: none; }
.perm-fieldset { border: 1px solid var(--border); border-radius: 10px; padding: .5rem .7rem .7rem; margin: 0; }
.perm-fieldset legend { padding: 0 .3rem; }
.perm-all { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; cursor: pointer; }
.perm-grid { display: flex; flex-direction: column; gap: .3rem; margin-top: .35rem; }
.perm-item { display: flex; align-items: center; gap: .45rem; font-size: .85rem; }
.perm-item input { width: auto; }
.perm-item span { font-family: ui-monospace, monospace; font-size: .8rem; color: var(--muted); }
.role-actions { display: flex; align-items: center; gap: .75rem; margin-top: .85rem; }

/* KPI tiles (Reports / Analytics) — modern CRM dashboard look, light + dark. */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin: 0 0 1.5rem; }
.kpi-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 1.05rem 1.2rem; display: flex; flex-direction: column; gap: .35rem;
}
.kpi-label { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; }
.kpi-value { font-size: 1.85rem; font-weight: 700; line-height: 1.05; }
.kpi-sub { color: var(--muted); font-size: .8rem; }
.kpi-card.accent { border-color: var(--accent); }
.kpi-card.accent .kpi-value { color: var(--accent); }

/* Media edit dialog: read-only URL + copy button. */
.me-url-row { display: flex; gap: .4rem; align-items: stretch; }
.me-url-row input { flex: 1; min-width: 0; font-family: ui-monospace, monospace; font-size: .82rem; }
.me-url-row button { white-space: nowrap; width: auto; flex: 0 0 auto; }

/* Address phone: country-code select + masked input. */
.phone-group { display: flex; gap: .4rem; align-items: stretch; }
.phone-group .addr-phone-cc { width: auto; flex: 0 0 auto; }
.phone-group .addr-phone { flex: 1; min-width: 0; }

/* Username field + "flowy" customize button (account profile). */
.username-row { display: flex; gap: .5rem; align-items: stretch; }
.username-row input { flex: 1; }
.btn-flow {
  border: none; border-radius: 8px; padding: 0 .9rem; cursor: pointer; white-space: nowrap;
  color: #fff; font-weight: 600; width: auto;
  background: linear-gradient(90deg, #6366f1, #a855f7, #ec4899, #f59e0b, #6366f1);
  background-size: 300% 100%; animation: flow-shift 6s linear infinite;
  box-shadow: 0 2px 10px rgba(168, 85, 247, .35);
}
.btn-flow:hover { filter: brightness(1.08); }
@keyframes flow-shift { from { background-position: 0% 50%; } to { background-position: 300% 50%; } }
@media (prefers-reduced-motion: reduce) { .btn-flow { animation: none; } }

/* Welcome dialog (first login) — blurred backdrop over the page. */
.welcome-dialog {
  border: 1px solid var(--border); border-radius: 14px; padding: 1.75rem;
  max-width: 460px; width: calc(100vw - 2rem); background: var(--bg); color: var(--text);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}
.welcome-dialog::backdrop { background: rgba(10, 12, 22, 0.55); backdrop-filter: blur(6px); }
section { margin-top: 2rem; }
.muted { color: var(--muted); }
.text-orange { color: #f59e0b; font-weight: 600; }
/* Customer order-status tones (green=in process, orange=on hold, red=failed,
   grey=cancelled, blue=completed). Bright variants for dark mode. */
.ostat { font-weight: 700; }
.ostat-green { color: #16a34a; }
.ostat-orange { color: #d97706; }
.ostat-red { color: #dc2626; }
.ostat-grey { color: #6b7280; }
.ostat-blue { color: #2563eb; }
[data-theme="dark"] .ostat-green { color: #4ade80; }
[data-theme="dark"] .ostat-orange { color: #fbbf24; }
[data-theme="dark"] .ostat-red { color: #f87171; }
[data-theme="dark"] .ostat-grey { color: #9ca3af; }
[data-theme="dark"] .ostat-blue { color: #60a5fa; }
/* Confirmation "Pay by invoice" note — gold in both modes (was blue in light). */
.pay-invoice-note { color: #f59e0b; font-weight: 600; }
:root[data-theme="light"] .pay-invoice-note { color: var(--accent); }
/* Order-line quantity prefix (e.g. "2×") — small + muted. */
.qty-x { color: var(--muted); font-size: .9em; font-variant-numeric: tabular-nums; }
/* Clickable product links (cart / checkout / confirmation quick-view) follow the
   brand accent — gold in dark, copper in light (were blue). */
.pqv-trigger { color: var(--accent); font-weight: 500; }
.notice { color: var(--ok); }

/* ---- product grid ---- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}
.product-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.product-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.product-card a { color: inherit; text-decoration: none; }
.product-card .thumb {
  aspect-ratio: 1 / 1;
  background: var(--panel-2);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.85rem;
}
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-card .body { padding: 0.85rem; }
.product-card .title { font-weight: 600; margin: 0 0 0.25rem; }
.product-card .price { color: var(--muted); }

/* Out-of-stock: still shown (they know we sell it) but visibly unavailable. */
.product-card .thumb { position: relative; }
.product-card .stock-badge {
  position: absolute; top: .5rem; left: .5rem;
  padding: .22rem .55rem; border-radius: 999px;
  font-size: .72rem; font-weight: 700; letter-spacing: .02em;
  color: #fff; background: rgba(17, 17, 17, .82); border: 1px solid rgba(255, 255, 255, .18);
}
.product-card .stock-note { margin: .25rem 0 0; font-size: .78rem; color: var(--muted); }
.product-card.out-of-stock .thumb img { opacity: .55; filter: saturate(.6); }
.product-card.out-of-stock:hover { border-color: var(--border); transform: none; }

/* ---- shop toolbar ---- */
.toolbar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1.5rem;
}
.toolbar form { flex-direction: row; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.chips { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.chip {
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.pagination { display: flex; gap: 0.75rem; margin-top: 2rem; align-items: center; }

/* ---- product detail ----
   minmax(0, …) on both tracks stops the gallery image from forcing its column
   wider than its share and overlapping the form column. The image column is
   capped at the configured max (set inline per page); the rest goes to info. */
.product-detail { display: grid; grid-template-columns: minmax(0, var(--img-col, 1fr)) minmax(0, 1fr); gap: 2rem; align-items: start; }
.gallery { display: grid; gap: 0.75rem; min-width: 0; }
/* Belt-and-suspenders: every text node in the product detail follows the theme
   text color (white in dark / black in light), so the description, the buy-box
   labels, and the subscribe card can never inherit a stray dark color. */
.product-detail, .product-detail p, .product-detail strong, .product-detail label,
.product-detail li, .product-detail td, .product-detail dt, .product-detail dd { color: var(--text); }
.gallery .main {
  aspect-ratio: 1 / 1;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: var(--muted);
}
.gallery .main img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius); }
.in-stock { color: var(--ok); }
.out-stock { color: var(--error); }

/* ---- cards / forms ---- */
.auth-card, .card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  backdrop-filter: blur(6px);
}
.auth-card { max-width: 420px; }
.card { margin-bottom: 1.25rem; }

/* ---- registration / login gate ---- */
.gate-card { margin: 2rem auto; }
.gate-logo { text-align: center; margin-bottom: 1rem; }
.gate-logo img { max-height: 72px; max-width: 240px; }
.gate-logo .brand-wordmark { font-size: 1.6rem; }
.consent {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--panel-2);
}
.consent-item {
  flex-direction: row;
  align-items: flex-start;
  gap: 0.7rem;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.4;
}
.consent-item input { width: auto; margin-top: 0.2rem; flex-shrink: 0; accent-color: var(--accent); }
/* Green when accepted, red once the user has tried to submit without checking. */
.consent-item:has(input:checked) { color: var(--ok); }
.consent-item:has(input:checked) input { accent-color: var(--ok); }
.consent-item:has(input:user-invalid) { color: var(--error); }
.consent-item:has(input:user-invalid) input { accent-color: var(--error); }

/* Inline validity checkmark for email/password. */
.field-check { position: relative; display: block; }
.field-check input { width: 100%; }
.field-check .ok-check {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ok);
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
  font-weight: 700;
}
.field-check:has(input:user-valid) .ok-check { opacity: 1; }
.gate-card { margin: 2.5rem auto; }

form { display: flex; flex-direction: column; gap: 0.85rem; }
form.inline { display: inline; }
/* Base `form` is flex-column; `.row` MUST switch back to a horizontal row,
   otherwise fields stack vertically and align-items:flex-end shoves them right. */
.row { display: flex; flex-direction: row; gap: 0.85rem; flex-wrap: wrap; justify-content: flex-start; align-items: flex-start; }
/* Labels size to their content and pack left — they no longer grow to fill the
   row, which is what was pushing Add/Save buttons to the far right edge. */
.row > label { flex: 0 1 auto; min-width: 160px; }
/* Cards laid out side by side in a .row still share the space evenly. */
.row > .card { flex: 1 1 260px; }

label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; color: var(--muted); }
/* Storefront form labels (account, login, cart, checkout, product page) read
   in the body text color — pure black/white per theme — rather than the dim
   grey used for admin forms. */
main.container label { color: var(--text); }
.checkbox-label { flex-direction: row; align-items: center; gap: 0.4rem; }
.checkbox-label input { width: auto; }

input, select, textarea {
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
/* Native <option> list contrast (browsers that allow styling the popup). */
select option, select optgroup { background: var(--bg); color: var(--text); }

button {
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 8px;
  background-image: var(--brand-grad);
  color: white;
  font-size: 1rem;
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button.secondary { background-image: none; background: var(--secondary); color: var(--text); }
button.linkish { background-image: none; background: none; color: var(--accent); padding: 0; font-size: inherit; }
/* Delete = red, Edit/expanders = blue, so they're easy to tell apart. */
button.danger-link { color: var(--error); }
details > summary.summary-link { color: var(--accent); cursor: pointer; }
.admin-item { margin-bottom: 0.75rem; }
.admin-item > details { margin-top: 0.35rem; }
.btn {
  display: inline-block;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  background-image: var(--brand-grad);
  color: #fff;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
/* Link-buttons (e.g. "Proceed to checkout") keep white text and gain a ring so
   they read as buttons, never as a blue link. White ring in dark mode, blue in light. */
a.btn { color: #fff; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35); }
a.btn:hover { color: #fff; }
:root[data-theme="light"] a.btn { box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.45); }

.error {
  color: var(--error);
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
}

/* ---- tables ---- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.6rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1.5rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
/* Emphasised total row (checkout estimated total). */
.kv dt.kv-total, .kv dd.kv-total { color: var(--text); font-weight: 700; font-size: 1.05rem; padding-top: 0.35rem; border-top: 1px solid var(--border); margin-top: 0.15rem; }

/* Reports / Analytics date-range selector */
.range-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; margin-bottom: 1rem; }
.range-presets { display: inline-flex; flex-wrap: wrap; gap: 0.35rem; }
.range-pill {
  display: inline-flex; align-items: center; padding: 0.3rem 0.75rem; border-radius: 999px;
  background: var(--secondary); color: var(--muted); font-size: 0.82rem; font-weight: 600; text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.range-pill:hover { color: var(--text); text-decoration: none; }
.range-pill.active { background: var(--accent); color: #fff; }
.range-custom { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0; }
.range-custom input[type="date"] { padding: 0.35rem 0.5rem; }
.range-label { margin-left: auto; }

/* Destructive confirm button (replace-userbase import). */
.btn.danger-solid { background: var(--error); background-image: none; color: #fff; }
.btn.danger-solid:hover { filter: brightness(0.94); }

@media (max-width: 640px) {
  .product-detail { grid-template-columns: 1fr; }
}

/* ---- admin shell ---- */
:root {
  --admin-header-h: 64px;
  --admin-side-w: 280px;
  --admin-side-collapsed-w: 72px;
  /* Solid sidebar — lighter than the body in dark, white in light. */
  --admin-side-bg: #1a1d2e;
  --admin-side-border: rgba(255, 255, 255, 0.08);
  --primary-50: rgba(99, 102, 241, 0.14);
  --primary-900-20: rgba(99, 102, 241, 0.20);
}
[data-theme="light"] {
  --admin-side-bg: #ffffff;
  --admin-side-border: rgba(0, 0, 0, 0.10);
  --primary-50: rgba(99, 102, 241, 0.08);
}
.admin-body { background: var(--bg); }
.admin-shell { display: grid; grid-template-columns: var(--admin-side-w) 1fr; min-height: calc(100vh - var(--admin-header-h)); }
.admin-shell.side-collapsed { grid-template-columns: var(--admin-side-collapsed-w) 1fr; }
.admin-side {
  background: var(--admin-side-bg);
  border-right: 1px solid var(--admin-side-border);
  padding: 0.75rem 0.75rem 1rem;
  position: sticky;
  /* No `top` offset — the sidebar meets the header flush (its parent grid
     already starts below the sticky header in flow). */
  top: 0;
  align-self: start;
  height: calc(100vh - var(--admin-header-h));
  display: flex;
  flex-direction: column;
  /* overflow stays visible so the absolute-positioned collapse chevron isn't
     clipped at the right edge; the inner .side-nav handles its own scrolling. */
  overflow: visible;
}
.admin-side .side-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding-right: 0.25rem; }
/* Custom scrollbar — slim, only visible on hover. */
.admin-side .side-nav::-webkit-scrollbar { width: 6px; }
.admin-side .side-nav::-webkit-scrollbar-track { background: transparent; }
.admin-side .side-nav::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; }
.admin-side:hover .side-nav::-webkit-scrollbar-thumb { background: var(--border); }
.admin-side .side-nav::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.admin-side .side-nav { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
/* NOTE: the old `.admin-side nav a` / `.admin-side nav a.active` rules were
   removed here. The sidebar was rebuilt around `.side-nav`/`.side-link`, but
   those anchors are still `<a>` inside `<nav>` inside `.admin-side`, so the
   legacy selectors kept matching them — and `.admin-side nav a.active`
   (specificity 0,2,2) beat `.side-link.active` (0,2,0), painting the active
   item a solid accent block and hiding its (accent-colored) icon. Styling now
   lives entirely on the `.side-*` classes below. */
.admin-main { padding: 1.5rem 2rem; max-width: 1100px; min-width: 0; }
/* Pages that need to use the full browser width (inventory, reports tables)
   opt in with body.admin-wide; the cap on .admin-main is lifted. */
body.admin-wide .admin-main { max-width: none; }
.admin-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; gap: 1rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
/* Every .stat in the admin shell inherits the neon-card look; the :nth-child
   rotation gives each card a distinct accent glow without any per-card class. */
.stat {
  position: relative; overflow: hidden;
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  background: linear-gradient(160deg, rgba(99, 102, 241, 0.10), rgba(139, 92, 246, 0.03));
  box-shadow: 0 0 18px rgba(99, 102, 241, 0.12), inset 0 0 24px rgba(139, 92, 246, 0.05);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.stat:hover { transform: translateY(-1px); }
.stat .n { font-size: 1.8rem; font-weight: 800; color: var(--text); line-height: 1.1; }
.stat .l { color: var(--muted); font-size: 0.85rem; margin-top: 0.2rem; }
.stat-grid > .stat:nth-child(6n + 1) { border-color: rgba(99, 102, 241, 0.45); background: linear-gradient(160deg, rgba(99, 102, 241, 0.14), rgba(99, 102, 241, 0.03)); box-shadow: 0 0 22px rgba(99, 102, 241, 0.22), inset 0 0 28px rgba(99, 102, 241, 0.08); }
.stat-grid > .stat:nth-child(6n + 2) { border-color: rgba(16, 185, 129, 0.45); background: linear-gradient(160deg, rgba(16, 185, 129, 0.14), rgba(16, 185, 129, 0.03)); box-shadow: 0 0 22px rgba(16, 185, 129, 0.22), inset 0 0 28px rgba(16, 185, 129, 0.08); }
.stat-grid > .stat:nth-child(6n + 3) { border-color: rgba(245, 158, 11, 0.45); background: linear-gradient(160deg, rgba(245, 158, 11, 0.14), rgba(245, 158, 11, 0.03)); box-shadow: 0 0 22px rgba(245, 158, 11, 0.22), inset 0 0 28px rgba(245, 158, 11, 0.08); }
.stat-grid > .stat:nth-child(6n + 4) { border-color: rgba(239, 68, 68, 0.45);  background: linear-gradient(160deg, rgba(239, 68, 68, 0.14),  rgba(239, 68, 68, 0.03));  box-shadow: 0 0 22px rgba(239, 68, 68, 0.22),  inset 0 0 28px rgba(239, 68, 68, 0.08); }
.stat-grid > .stat:nth-child(6n + 5) { border-color: rgba(6, 182, 212, 0.45);   background: linear-gradient(160deg, rgba(6, 182, 212, 0.14),   rgba(6, 182, 212, 0.03));   box-shadow: 0 0 22px rgba(6, 182, 212, 0.22),   inset 0 0 28px rgba(6, 182, 212, 0.08); }
.stat-grid > .stat:nth-child(6n)     { border-color: rgba(168, 85, 247, 0.45); background: linear-gradient(160deg, rgba(168, 85, 247, 0.14), rgba(168, 85, 247, 0.03)); box-shadow: 0 0 22px rgba(168, 85, 247, 0.22), inset 0 0 28px rgba(168, 85, 247, 0.08); }
[data-theme="light"] .stat { box-shadow: 0 0 14px rgba(99, 102, 241, 0.10), inset 0 0 18px rgba(139, 92, 246, 0.04); }
.pill { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--secondary); font-size: 0.8rem; }

/* ---- changelog / patch notes ---- */
.changelog .release-head { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.changelog summary.release-head { cursor: pointer; list-style: none; }
.changelog summary.release-head::-webkit-details-marker { display: none; }
.changelog summary.release-head::before { content: "▸"; color: var(--muted); margin-right: 0.2rem; }
.changelog details[open] > summary.release-head::before { content: "▾"; }
.changelog details.release[open] .release-changes { margin-top: 0.75rem; }
.changelog .release-version {
  font-weight: 700;
  background-image: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.changelog .release-title { font-weight: 600; }
.changelog .release-date { margin-left: auto; font-size: 0.85rem; }
.changelog .release-changes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.changelog .release-changes li { display: flex; gap: 0.6rem; align-items: flex-start; font-size: 0.92rem; }
.tag {
  flex-shrink: 0;
  display: inline-block;
  min-width: 3.6rem;
  text-align: center;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1px solid var(--border);
}
.tag-added { color: var(--ok); border-color: var(--ok); }
.tag-changed { color: var(--accent-2); border-color: var(--accent-2); }
.tag-fixed { color: var(--accent); border-color: var(--accent); }

/* ---- logo size previews (settings) ---- */
.logo-previews { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.logo-previews > div { flex: 1; min-width: 220px; }
.logo-preview-box {
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  margin-bottom: 0.6rem;
  overflow: hidden;
}
.logo-preview-box.gate { min-height: 180px; }
.logo-preview-box img { display: block; max-width: 100%; }

/* ---- permission grid (roles) ---- */
/* Group boxes arranged 4 across; checkboxes stack within each box. */
.perm-groups { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; align-items: start; }
.perm-groups fieldset { margin: 0 !important; }
.perm-grid { display: flex; flex-direction: column; gap: 0.25rem; }
.perm-item { display: flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; }
.perm-item input { width: auto; }
@media (max-width: 900px) { .perm-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .perm-groups { grid-template-columns: 1fr; } }

/* ---- dashboard to-do ---- */
.todo-card { margin-top: 1.75rem; }
.todo-card > summary { cursor: pointer; list-style: none; }
.todo-card > summary::-webkit-details-marker { display: none; }
.todo-card > summary::before { content: "▸ "; color: var(--muted); }
.todo-card[open] > summary::before { content: "▾ "; }
.todo-list { list-style: none; margin: 0.75rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.todo-list li { display: flex; align-items: flex-start; gap: 0.5rem; }
.todo-list li.done .todo-text { text-decoration: line-through; color: var(--muted); }
.todo-check { background: none; background-image: none; color: var(--accent); padding: 0; font-size: 1.1rem; line-height: 1; }
.todo-check:hover { filter: none; }
.todo-text { flex: 1; }
.todo-del { color: var(--muted); }

/* ---- inventory grid (left-aligned, 2-3 across) ---- */
.inv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 1rem;
  align-items: start;
}
.inv-grid > .card { margin-bottom: 0; }

/* ---- confirmation dialog ---- */
.confirm-dialog {
  background: var(--bg);
  background-image: var(--bg-grad);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 420px;
  width: calc(100% - 2rem);
}
.confirm-dialog::backdrop { background: rgba(0, 0, 0, 0.55); }

/* ---- back to top (admin) ---- */
.back-to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 50%;
  background-image: var(--brand-grad);
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  z-index: 50;
}
.back-to-top[hidden] { display: none; }

/* Light mode still carries the legacy purple brand gradient; keep the promo
   banner and the back-to-top button on the gold brand (with dark text for
   contrast) so they aren't purple in light mode. */
[data-theme="light"] .promo-banner {
  background-image: linear-gradient(90deg, #b8975a, #c9a86a, #d8bd85);
  color: #1a1508;
}
[data-theme="light"] .promo-banner a { color: #1a1508; }
[data-theme="light"] .back-to-top {
  background-image: linear-gradient(90deg, #b8975a, #c9a86a, #d8bd85);
  color: #1a1508;
}

/* Floating "Save page" — appears (with the back-to-top button) once you scroll
   a long page editor, so you can save without scrolling back to the toolbar. */
.page-save-floating {
  position: fixed;
  right: 4.7rem;
  bottom: 1.35rem;
  z-index: 50;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}
.page-save-floating[hidden] { display: none; }

/* ---- icon buttons / cart actions ---- */
.icon-btn { background: none; background-image: none; color: var(--muted); padding: 0.2rem 0.4rem; font-size: 1.1rem; }
.icon-btn:hover { color: var(--error); filter: none; }
.cart-actions { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; margin-top: 0.5rem; }

/* ---- banner speed preview (settings) ---- */
.banner-preview { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.banner-preview .promo-banner { padding: 0.45rem 0; }
/* Hamburger + drawer chrome (hidden on desktop; shown ≤900px). */
.admin-header-left { display: inline-flex; align-items: center; gap: 0.5rem; min-width: 0; }
.admin-nav-toggle { display: none; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; border: none; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; flex-shrink: 0; }
.admin-nav-toggle:hover { background: var(--secondary); color: var(--text); }
.admin-nav-backdrop { position: fixed; inset: 0; z-index: 44; background: rgba(0, 0, 0, 0.5); }

@media (max-width: 900px) {
  .admin-nav-toggle { display: inline-flex; }
  .side-toggle { display: none; }            /* desktop collapse chevron */
  .admin-header { z-index: 50; }             /* stay above the drawer + backdrop */
  body.admin-nav-open { overflow: hidden; }  /* freeze the page behind the drawer */
  .admin-brand .brand-name { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* Sidebar becomes a slide-in drawer; content takes the full width. */
  .admin-shell, .admin-shell.side-collapsed { grid-template-columns: 1fr; }
  .admin-side {
    position: fixed; top: var(--admin-header-h); left: 0;
    height: calc(100vh - var(--admin-header-h)); height: calc(100dvh - var(--admin-header-h));
    width: min(280px, 84vw);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 46; overflow-y: auto;
    border-right: 1px solid var(--admin-side-border);
  }
  body.admin-nav-open .admin-side { transform: translateX(0); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45); }
  .admin-side .side-list { flex-direction: column; }
  /* Wide admin tables scroll inside their section instead of stretching the page. */
  .admin-main table { display: block; overflow-x: auto; white-space: nowrap; max-width: 100%; -webkit-overflow-scrolling: touch; }
}
@media (min-width: 901px) { .admin-nav-backdrop { display: none; } }

/* ---- mobile-friendly ---- */
/* Grid/flex children must be allowed to shrink below their content width,
   otherwise a wide table or preview pushes the whole page past the viewport. */
.admin-shell, .admin-side, .admin-main, .container, .card, .row, .product-detail { min-width: 0; }
.card { max-width: 100%; }

@media (max-width: 640px) {
  .container { padding: 1.25rem 1rem; }
  .admin-main { padding: 1rem; }
  /* Let wide tables scroll horizontally instead of breaking the layout. */
  table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; max-width: 100%; }
  .stat-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .product-detail { grid-template-columns: 1fr; gap: 1.25rem; }
  /* Stack any two-up card rows on phones. */
  .row > .card { flex: 1 1 100%; min-width: 0; }
  .logo-previews { flex-direction: column; }
  .kv { grid-template-columns: 1fr; gap: 0.1rem 0; }
  .kv dt { margin-top: 0.4rem; }
}
@media (max-width: 480px) {
  /* Stack form fields full-width so nothing overflows. */
  .row > label { min-width: 100%; flex-basis: 100%; }
  .site-header { padding: 0.75rem 1rem; gap: 0.5rem; }
  .site-header nav { gap: 0.85rem; }
  .hero h1 { font-size: 1.8rem; }
  .gate-card { margin: 1.25rem auto; }
}

/* ====== Analytics "Mission Control" (neon) ====== */
.neon-head { display: flex; align-items: center; gap: 0.85rem; margin-bottom: 1rem; }
.neon-title { margin: 0; font-size: 1.7rem; letter-spacing: 0.04em; }
.neon {
  color: #c4b5fd;
  text-shadow: 0 0 6px rgba(168, 85, 247, 0.55), 0 0 16px rgba(99, 102, 241, 0.35);
}
.live-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em;
  color: #fca5a5; border: 1px solid rgba(248, 113, 113, 0.5);
  padding: 0.18rem 0.55rem; border-radius: 999px;
  background: rgba(248, 113, 113, 0.08);
}
.live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #f87171;
  box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.7); animation: live-pulse 1.6s infinite;
}
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.7); }
  70% { box-shadow: 0 0 0 7px rgba(248, 113, 113, 0); }
  100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0); }
}

.neon-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem; margin-bottom: 1.1rem;
}
.neon-card {
  position: relative; overflow: hidden;
  border: 1px solid rgba(139, 92, 246, 0.35); border-radius: 14px;
  padding: 1rem 1.1rem; background: linear-gradient(160deg, rgba(99,102,241,0.10), rgba(139,92,246,0.03));
  box-shadow: 0 0 18px rgba(99, 102, 241, 0.12), inset 0 0 24px rgba(139, 92, 246, 0.05);
}
.neon-card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--accent-3); box-shadow: 0 0 10px var(--accent-3);
}
.neon-card.glow-b::before { background: var(--accent-2); box-shadow: 0 0 10px var(--accent-2); }
.neon-card.glow-c::before { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.neon-card.glow-d::before { background: #22d3ee; box-shadow: 0 0 10px #22d3ee; }
.neon-n {
  font-size: 2.1rem; font-weight: 800; line-height: 1; color: #f5f3ff;
  font-variant-numeric: tabular-nums; text-shadow: 0 0 12px rgba(168, 85, 247, 0.45);
}
.neon-l { margin-top: 0.35rem; font-size: 0.82rem; color: var(--muted); }
.pulse { animation: num-pulse 0.6s ease; }
@keyframes num-pulse {
  0% { transform: scale(1); color: #fff; text-shadow: 0 0 20px rgba(168, 85, 247, 0.9); }
  100% { transform: scale(1); }
}

.neon-panel {
  border: 1px solid rgba(139, 92, 246, 0.22); border-radius: 14px;
  padding: 1rem 1.1rem; margin-bottom: 1.1rem;
  background: linear-gradient(180deg, rgba(99,102,241,0.05), rgba(0,0,0,0));
  box-shadow: inset 0 0 30px rgba(99, 102, 241, 0.04);
}
.neon-panel h2 { margin: 0 0 0.75rem; font-size: 1.05rem; }
.neon-row { display: flex; flex-wrap: wrap; gap: 1.1rem; align-items: stretch; }
.neon-row > .grow { flex: 1 1 320px; min-width: 0; }

.ana-spark { width: 100%; height: auto; display: block; }
.spark-axis { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--muted); margin-top: 0.3rem; }

.funnel { display: flex; flex-direction: column; gap: 0.6rem; }
.funnel-row { display: flex; align-items: center; gap: 0.6rem; }
.funnel-k { width: 92px; font-size: 0.82rem; color: var(--muted); flex-shrink: 0; }
.funnel-pct { width: 44px; text-align: right; font-variant-numeric: tabular-nums; font-size: 0.82rem; flex-shrink: 0; }
.funnel-bar {
  height: 26px; border-radius: 6px; min-width: 0;
  background: var(--accent);
  display: flex; align-items: center; transition: width 0.6s ease;
}
.funnel-bar.f2 { background: #3b82f6; }
.funnel-bar.f3 { background: #10b981; }
.funnel-bar span { padding: 0 0.5rem; font-size: 0.78rem; font-weight: 700; color: #fff; }

.live-feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; max-height: 280px; overflow-y: auto; }
.live-feed li { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; padding: 0.3rem 0.4rem; border-radius: 6px; background: var(--secondary); }
.feed-flag { flex-shrink: 0; }
.feed-ev { color: var(--accent-3); font-weight: 600; flex-shrink: 0; min-width: 78px; }
.feed-url { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-ip { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.feed-ago { flex-shrink: 0; width: 38px; text-align: right; }

.bars { display: flex; flex-direction: column; gap: 0.45rem; }
.bar-row { display: flex; align-items: center; gap: 0.6rem; }
.bar-k { width: 200px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.8rem; color: var(--muted); }
.bar-v { flex-shrink: 0; font-variant-numeric: tabular-nums; font-size: 0.82rem; }
.ana-bar {
  height: 14px; border-radius: 4px; flex: 1 1 auto; min-width: 6px;
  background: var(--accent);
}
.ana-bar.b2 { background: #3b82f6; }
.ana-bar.b3 { background: #10b981; }
.ana-table { width: 100%; }
.ana-table td.num, .ana-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  .live-dot, .pulse, .funnel-bar { animation: none; transition: none; }
}
@media (max-width: 600px) {
  .bar-k { width: 120px; }
}

/* Analytics interactive tooltips */
.spark-wrap { position: relative; }
.spark-hit { cursor: crosshair; }
.ana-tip {
  position: absolute; z-index: 5; pointer-events: none;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 0.35rem 0.6rem; font-size: 0.78rem; white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3); transform: translateZ(0);
}
.ana-tip strong { color: var(--accent); }
.bar-row { cursor: default; border-radius: 6px; padding: 0.1rem 0.25rem; transition: background 0.15s ease; }
.bar-row:hover { background: var(--secondary); }
.funnel-row { cursor: default; }
.ana-table tr { cursor: default; transition: background 0.15s ease; }
.ana-table tr:hover { background: var(--secondary); }
.live-feed li { cursor: default; transition: background 0.15s ease; }
.live-feed li:hover { background: rgba(139, 92, 246, 0.14); }

/* Reports: demo-data simulator panel */
.sim-card { border: 1px solid rgba(139, 92, 246, 0.4); box-shadow: 0 0 16px rgba(139, 92, 246, 0.1); margin-bottom: 1.25rem; }
.sim-notice { margin-bottom: 1rem; padding: 0.6rem 0.85rem; border: 1px solid rgba(16, 185, 129, 0.4); border-radius: 8px; background: rgba(16, 185, 129, 0.08); }

/* Order trash */
.trash-link { color: var(--muted); }
.trash-link:hover { color: var(--error); }
.btn.danger { background-image: none; background: var(--error); color: #fff; }
.btn.danger:hover { filter: brightness(1.05); }

/* ===== Quick-edit modal (products / categories) ===== */
.qe-dialog {
  border: 1px solid var(--border); border-radius: 14px; padding: 0;
  background: var(--bg); color: var(--text);
  width: min(480px, calc(100vw - 2rem)); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.qe-dialog::backdrop { background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(2px); }
.qe-modal-form { display: flex; flex-direction: column; gap: 0.7rem; padding: 1.25rem; margin: 0; }
.qe-head { display: flex; align-items: center; justify-content: space-between; }
.qe-head .qe-close { font-size: 1.1rem; color: var(--muted); }
.qe-modal-form label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; }
.qe-modal-form .row { display: flex; flex-direction: row; gap: 0.75rem; }
.qe-modal-form .row > label { flex: 1; }
.qe-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 0.5rem; }
.qe-error { color: var(--error); margin: 0; font-size: 0.85rem; }
.qe-cats { border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.75rem; margin: 0; }
.qe-cats legend { font-size: 0.8rem; color: var(--muted); padding: 0 0.35rem; }
.qe-cat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.25rem 0.75rem; max-height: 9rem; overflow-y: auto; }
.qe-cat-grid .checkbox-label { font-size: 0.85rem; }
.qe-btn { white-space: nowrap; }
.row-flash { animation: row-flash 1s ease; }
@keyframes row-flash {
  0% { background: rgba(99, 102, 241, 0.25); }
  100% { background: transparent; }
}
@media (prefers-reduced-motion: reduce) { .row-flash { animation: none; } }

/* ===== Page builder (Admin > Pages) ===== */
.builder-toolbar { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin: 1rem 0; }
.bt-add { position: relative; }
.bt-menu { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 0.35rem; display: flex; flex-direction: column; min-width: 170px; box-shadow: 0 12px 30px rgba(0,0,0,0.35); }
/* The `hidden` attribute must beat the display:flex above, or the menu is stuck open. */
.bt-menu[hidden] { display: none; }
.bt-menu button { text-align: left; background: none; border: none; color: var(--text); padding: 0.4rem 0.6rem; border-radius: 6px; cursor: pointer; }
.bt-menu button:hover { background: var(--secondary); }
.blk-card { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 0.85rem; background: var(--panel); }
.blk-card-head { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0.85rem; border-bottom: 1px solid var(--border); }
.blk-card-type { font-weight: 600; font-size: 0.85rem; color: var(--accent-3); text-transform: uppercase; letter-spacing: 0.04em; }
.blk-card-ctrls { display: flex; gap: 0.35rem; }
.blk-icon { font-size: 1rem; padding: 0.1rem 0.35rem; }
.blk-card-body { padding: 0.85rem; display: grid; gap: 0.6rem; }
.blk-field { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; }
.blk-field > span { color: var(--muted); }
.blk-html-preview { border: 1px dashed var(--border); border-radius: 8px; padding: 0.75rem; background: var(--bg); overflow: auto; }
/* Raw HTML block editor: full width + tall (like a real code editor) so it isn't
   a cramped little box. Monospace, horizontal scroll for long lines, resizable. */
.blk-html-code {
  width: 100%;
  min-height: 65vh;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.55;
  white-space: pre;
  overflow: auto;
  resize: vertical;
  tab-size: 2;
}
.blk-html-preview:empty::before { content: "Nothing to preview yet — add HTML below."; color: var(--muted); font-size: 0.85rem; }
.media-field { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.media-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.gallery-field { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.gallery-cell { position: relative; }
.gallery-cell img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.gallery-cell button { position: absolute; top: -6px; right: -6px; background: var(--bg); border-radius: 50%; line-height: 1; }
.columns-field { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.5rem; }
.columns-col { display: flex; flex-direction: column; gap: 0.25rem; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0.5rem; max-height: 50vh; overflow-y: auto; }
.media-pick-cell { padding: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--panel-2); aspect-ratio: 1/1; }
.media-pick-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-pick-cell:hover { border-color: var(--accent); }
.tpl-list { display: flex; flex-direction: column; gap: 0.4rem; }
.tpl-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.4rem 0.5rem; border: 1px solid var(--border); border-radius: 8px; }
.tpl-row .tpl-name { flex: 1; font-weight: 500; }

/* Rendered block content on the public page */
.page-content .blk-heading { margin: 1rem 0 0.5rem; }
.page-content .blk-text { margin: 0.5rem 0; }
.page-content .blk-image { margin: 1rem 0; }
.page-content .blk-button { margin: 1rem 0; }
.page-content .blk-spacer { width: 100%; }
.page-content .blk-divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }
.page-content .blk-gallery { display: grid; gap: 0.75rem; margin: 1rem 0; }
.page-content .blk-gallery img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; aspect-ratio: 1/1; }
.page-content .blk-columns { display: grid; gap: 1.25rem; margin: 1rem 0; }
@media (max-width: 640px) { .page-content .blk-columns { grid-template-columns: 1fr !important; } }

/* Menus editor + content regions */
.menu-rows { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.6rem; }
.menu-row { display: flex; gap: 0.5rem; align-items: center; }
.menu-row input { flex: 1; min-width: 0; }
.menu-row .blk-icon, .menu-row .linkish { flex: 0 0 auto; }
.region-intro { margin: 0.5rem 0 1.25rem; }
.region-outro { margin: 1.5rem 0 0.5rem; }

/* Storefront layout width (Settings → Site layout). Boxed/widescreen constrains
   the whole chrome — header, body, and footer — not just the main column. */
body { --site-max: 1040px; }
body.layout-wide { --site-max: 1400px; }
.container { max-width: var(--site-max); }
.site-header, .site-footer { max-width: var(--site-max); margin-left: auto; margin-right: auto; width: 100%; }

/* ---- Boxed layout: visible border around header + main, optional drop
   shadow per side. Footer stays outside the box (user's "Header & Body"
   spec). Border style + shadow sides come from Site Details. ---- */
body.layout-boxed .site-header,
body.layout-boxed > main.container {
  border-left:  1px solid var(--border);
  border-right: 1px solid var(--border);
}
body.layout-boxed .site-header { border-top: 1px solid var(--border); border-radius: 12px 12px 0 0; }
body.layout-boxed > main.container { border-bottom: 1px solid var(--border); border-radius: 0 0 12px 12px; padding-bottom: 2rem; }

/* Boxed border can be hidden (Admin → Settings → Site layout). Keep the 1px
   spacing (transparent) so the layout doesn't shift, just drop the grey line. */
body.layout-boxed.boxed-border-off .site-header,
body.layout-boxed.boxed-border-off > main.container { border-color: transparent; }
body.layout-boxed.boxed-border-off[data-boxed-border] .site-header,
body.layout-boxed.boxed-border-off[data-boxed-border] > main.container { border-image: none; }

/* Border style variants (apply to all three drawn sides). */
body.layout-boxed[data-boxed-border="dotted"] .site-header,
body.layout-boxed[data-boxed-border="dotted"] > main.container { border-style: dotted; }
/* "Wavy" + "checkered" use border-image with an inline SVG pattern so they
   stay sharp at any width and follow currentColor's tone via a CSS variable. */
body.layout-boxed[data-boxed-border="wavy"] .site-header,
body.layout-boxed[data-boxed-border="wavy"] > main.container {
  border-width: 6px; border-style: solid; border-radius: 0;
  border-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path d='M0 6 Q3 0 6 6 T12 6' fill='none' stroke='%238a8aa8' stroke-width='2'/></svg>") 6 round;
}
body.layout-boxed[data-boxed-border="checkered"] .site-header,
body.layout-boxed[data-boxed-border="checkered"] > main.container {
  border-width: 6px; border-style: solid; border-radius: 0;
  border-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><rect width='6' height='6' x='0' y='0' fill='%238a8aa8'/><rect width='6' height='6' x='6' y='6' fill='%238a8aa8'/></svg>") 6 round;
}

/* Drop-shadow per page section (Header / Body / Footer).
   OR mode: every selected section casts its own surrounding drop shadow.
   AND mode: the shadow only renders when every one of the three sections
   is on — the box reads as one shadowed slab. */
body.layout-boxed.boxed-shadow-on[data-boxed-shadow-mode="or"].boxed-shadow-header .site-header   { box-shadow: 0 6px 22px rgba(0, 0, 0, 0.22); }
body.layout-boxed.boxed-shadow-on[data-boxed-shadow-mode="or"].boxed-shadow-body   > main.container { box-shadow: 0 6px 22px rgba(0, 0, 0, 0.22); }
body.layout-boxed.boxed-shadow-on[data-boxed-shadow-mode="or"].boxed-shadow-footer .site-footer   { box-shadow: 0 6px 22px rgba(0, 0, 0, 0.22); }

body.layout-boxed.boxed-shadow-on[data-boxed-shadow-mode="and"].boxed-shadow-header.boxed-shadow-body.boxed-shadow-footer .site-header,
body.layout-boxed.boxed-shadow-on[data-boxed-shadow-mode="and"].boxed-shadow-header.boxed-shadow-body.boxed-shadow-footer > main.container,
body.layout-boxed.boxed-shadow-on[data-boxed-shadow-mode="and"].boxed-shadow-header.boxed-shadow-body.boxed-shadow-footer .site-footer { box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25); }

/* Theme-aware logos (Settings → Dark/Light mode logos) */
.brand-logo.logo-light { display: none; }
[data-theme="light"] .brand-logo.logo-dark { display: none; }
[data-theme="light"] .brand-logo.logo-light { display: block; }

/* Header/footer dropdown menus (nested nav items) */
.nav-group { position: relative; display: inline-flex; align-items: center; }
.nav-group > a { display: inline-flex; align-items: center; gap: 0.2rem; }
.nav-caret { font-size: 0.7em; opacity: 0.7; }
.nav-dropdown { position: absolute; top: 100%; left: 0; display: none; flex-direction: column; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 0.35rem; min-width: 160px; box-shadow: 0 12px 30px rgba(0,0,0,0.35); z-index: 30; }
.nav-group:hover .nav-dropdown, .nav-group:focus-within .nav-dropdown { display: flex; }
.nav-dropdown a { padding: 0.3rem 0.5rem; border-radius: 6px; white-space: nowrap; }
.nav-dropdown a:hover { background: var(--secondary); text-decoration: none; }

/* Footer information block + its editor */
.footer-info :where(p, ul, h1, h2, h3) { margin: 0.25rem 0; }
.footer-info-editor { resize: both; min-height: 6rem; width: 100%; font-family: inherit; }

/* Menu editor: nested rows + parent select */
.menu-row.is-child { margin-left: 1.75rem; }
.menu-row select { flex: 0 0 auto; max-width: 190px; }

/* "Choose file on device" label styled as a button (hides the native input). */
.file-btn { display: inline-flex; align-items: center; gap: .4rem; cursor: pointer; background: var(--secondary); border: 1px solid var(--border); border-radius: 8px; padding: 0.55rem 0.8rem; font-size: 0.95rem; white-space: nowrap; }
.file-btn input[type="file"] { display: none; }

/* Site Logo groups (Settings) — dim the inactive group */
.logo-group { padding: 0.4rem 0; }
.group-disabled { opacity: 0.4; }

/* Media library admin page */
.media-lib { --media-tile: 512px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(var(--media-tile), 100%), 1fr)); gap: 0.75rem; margin-top: 1rem; }
/* Media library toolbar (type tabs, size buttons, per-page). */
.media-toolbar { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: center; justify-content: space-between; margin-top: 1rem; }
.media-toolbar-right { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: center; }
.media-size-btns { display: inline-flex; gap: .3rem; }
.media-size-btns .media-size { width: auto; padding: .35rem .7rem; }
.media-size-btns .media-size.active { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.media-tile .thumb-icon { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; font-size: 2.4rem; color: var(--muted); }
.media-tile .thumb-ext { font-size: .7rem; font-weight: 700; letter-spacing: .05em; }
.media-tile { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--panel-2); display: flex; flex-direction: column; }
.media-tile .thumb { aspect-ratio: 1/1; background: var(--panel-2); display: grid; place-items: center; }
.media-tile .thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-tile .meta { padding: 0.4rem 0.5rem; display: flex; flex-direction: column; gap: 0.3rem; }
.media-tile .mkey { font-size: 0.72rem; color: var(--muted); word-break: break-all; }
.media-tile .actions { display: flex; gap: 0.4rem; justify-content: space-between; align-items: center; }

/* Admin top header — store-name on the left, all controls right-justified.
   Shares its background with the sidebar so the two read as one piece. */
.admin-header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 0.8rem;
  height: var(--admin-header-h);
  padding: 0 1.25rem;
  background: var(--admin-side-bg);
  border-bottom: 1px solid var(--admin-side-border);
}
.admin-brand { display: inline-flex; align-items: center; color: var(--text); font-weight: 700; flex-shrink: 0; }
.admin-brand:hover { text-decoration: none; }
.admin-brand .brand-name { font-size: 1.1rem; letter-spacing: 0.5px; }
.admin-header-right { display: inline-flex; align-items: center; gap: 0.4rem; }
.admin-header .hbtn, .admin-header .theme-toggle {
  position: relative;
  background: transparent; border: none; color: var(--muted);
  width: 36px; height: 36px; padding: 0; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  flex-shrink: 0;
}
.admin-header .hbtn:hover, .admin-header .theme-toggle:hover { background: var(--secondary); color: var(--text); }
.admin-header .hbtn-badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px;
  background: var(--accent); color: #fff;
  font-size: 0.65rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1;
}
.hide-sm { }
@media (max-width: 640px)  { .hide-sm { display: none; } }

/* Admin sidebar — collapses to icon-only (not zero width) */
.admin-shell { transition: grid-template-columns 0.25s ease; position: relative; }
.admin-side { transition: padding 0.25s ease; position: relative; }
.side-toggle {
  position: absolute; top: 0.75rem; right: -12px; z-index: 30;
  background: var(--admin-side-bg); border: 1px solid var(--border); color: var(--muted);
  width: 24px; height: 24px; padding: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  transition: transform 0.25s ease;
}
.side-toggle:hover { color: var(--text); border-color: var(--accent); }
.admin-shell.side-collapsed .side-toggle { transform: rotate(180deg); }

/* Sidebar brand block — logo + admin_name from Site Details. */
.side-brand {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.5rem 0.5rem 0.85rem;
  color: var(--text); text-decoration: none;
  border-bottom: 1px solid var(--admin-side-border);
  margin-bottom: 0.75rem;
  min-width: 0; overflow: hidden;
}
.side-brand:hover { text-decoration: none; }
/* max-width: 100% (not a fixed px) so the logo never spills past the rail —
   including the collapsed 72px rail, which is what was clipping it. */
.side-brand-logo { max-height: 28px; max-width: 100%; flex-shrink: 1; min-width: 0; object-fit: contain; }
.side-brand-name {
  font-weight: 700; font-size: 0.95rem; letter-spacing: 0.3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side-brand-logo.logo-light { display: none; }
[data-theme="light"] .side-brand-logo.logo-dark { display: none; }
[data-theme="light"] .side-brand-logo.logo-light { display: block; }
.side-collapsed .side-brand-name { display: none; }
.side-collapsed .side-brand { justify-content: center; gap: 0; padding: 0.5rem 0 0.85rem; }
.side-collapsed .side-brand-logo { max-height: 32px; }

/* Grouped lucide-icon nav */
.side-nav { display: flex; flex-direction: column; gap: 1.25rem; }
.side-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.side-h3 {
  padding: 0 0.75rem; margin: 0 0 0.4rem;
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); opacity: 0.75; white-space: nowrap; overflow: hidden;
  transition: opacity 0.2s ease, height 0.2s ease;
}
.side-link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.55rem 0.75rem; border-radius: 10px;
  color: var(--muted); font-weight: 500; font-size: 0.92rem;
  position: relative; transition: background-color 0.18s ease, color 0.18s ease, padding 0.25s ease;
  white-space: nowrap; overflow: hidden;
}
.side-link:hover { background: var(--secondary); text-decoration: none; color: var(--text); }
.side-icon { flex-shrink: 0; }
.side-link.active {
  background: var(--primary-50);
  color: var(--accent);
}
.side-link.active .side-icon { color: var(--accent); }
.side-section + .side-section { margin-top: 1.25rem; }
.side-list.side-solo { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--admin-side-border); }
.side-link .active-bar {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 60%; background: var(--accent); border-radius: 0 4px 4px 0;
}
.side-label { transition: opacity 0.2s ease; }
.side-version { display: block; margin-top: 1rem; font-size: 0.75rem; padding: 0 0.75rem; }

/* Expandable nav item (e.g. Appearance → Overview / Menus / Theme) */
.side-drop-summary { list-style: none; cursor: pointer; }
.side-drop-summary::-webkit-details-marker { display: none; }
.side-caret { margin-left: auto; flex-shrink: 0; opacity: 0.55; transition: transform 0.18s ease; }
.side-drop[open] > .side-drop-summary .side-caret { transform: rotate(180deg); }
.side-sublist { list-style: none; margin: 0.1rem 0 0.35rem; padding: 0 0 0 2.35rem; display: flex; flex-direction: column; gap: 0.1rem; }
.side-sublink { display: block; padding: 0.4rem 0.6rem; border-radius: 8px; color: var(--muted); font-size: 0.88rem; text-decoration: none; white-space: nowrap; }
.side-sublink:hover { background: var(--secondary); color: var(--text); text-decoration: none; }
.side-sublink.active { color: var(--accent); background: var(--primary-50); font-weight: 600; }

/* Collapsed state: hide labels + group headers, center icons */
.side-collapsed .side-label,
.side-collapsed .side-h3,
.side-collapsed .side-version { opacity: 0; height: 0; margin: 0; padding: 0; pointer-events: none; }
.side-collapsed .side-link { justify-content: center; padding: 0.6rem 0; }
.side-collapsed .side-link .active-bar { display: none; }
.side-collapsed .side-link.active { background: var(--primary-50); border-radius: 10px; }
.side-collapsed .side-icon { width: 22px; height: 22px; }
.side-collapsed .side-section { margin-bottom: 0.5rem; }
.side-collapsed .side-section + .side-section { margin-top: 0.5rem; }
.side-collapsed .side-caret { display: none; }
.side-collapsed .side-sublist { display: none; }
.side-collapsed .side-drop-summary { justify-content: center; padding: 0.6rem 0; }
.side-collapsed .side-list { gap: 0.25rem; }
.side-collapsed .side-list.side-solo { margin-top: 0.5rem; padding-top: 0.5rem; }
.side-collapsed .admin-side { padding: 1rem 0.4rem; }

/* Settings: grouped fieldsets + preview mocks + layout thumbnails */
fieldset.settings-group { min-width: 0; }
.settings-group > legend { font-weight: 700; padding: 0 0.4rem; font-size: 1.05rem; }
.checkbox-label.nested { margin-left: 1.6rem; font-size: 0.9rem; color: var(--muted); }
.preview-mock { border: 1px dashed var(--border); border-radius: 8px; padding: 0.75rem; margin-top: 0.5rem; background: var(--panel-2); }
.layout-thumbs { display: flex; gap: 1rem; margin-top: 0.6rem; }
.layout-thumb { margin: 0; text-align: center; }
.layout-thumb figcaption { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }
.layout-thumb .lt-page { width: 130px; height: 84px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel-2); display: flex; justify-content: center; padding: 6px 0; }
.layout-thumb .lt-inner { display: flex; flex-direction: column; gap: 4px; height: 100%; }
.layout-thumb .lt-inner.boxed { width: 56%; }
.layout-thumb .lt-inner.wide { width: 92%; }
.layout-thumb .lt-inner span { display: block; background: var(--border); border-radius: 2px; }
.layout-thumb .lt-inner span:nth-child(1) { height: 10px; }
.layout-thumb .lt-inner span:nth-child(2) { flex: 1; }
.layout-thumb .lt-inner span:nth-child(3) { height: 8px; }
.layout-thumb.selected .lt-page { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.layout-thumb.selected .lt-inner span { background: var(--accent); opacity: 0.55; }

/* Storefront product reviews */
.reviews-list { display: flex; flex-direction: column; gap: 0.85rem; margin: 1rem 0; }
.review { border: 1px solid var(--border); border-radius: 10px; padding: 0.75rem 0.9rem; }
.review .stars { color: var(--accent-3); }
.review .review-meta { font-size: 0.8rem; color: var(--muted); }

/* Settings extras: save button breathing room, sim card spacing, info tooltip,
   clickable layout thumbs, logo clear button, nested perf details. */
.save-btn { margin: 1.25rem 0 1.5rem; }
.sim-card-spacer { margin-top: 1.5rem; }
.info-tip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--muted); font-size: 0.7rem; font-weight: 700;
  cursor: help; margin-left: 0.3rem;
}
.info-tip:hover { color: var(--accent); border-color: var(--accent); }

.layout-thumb { cursor: pointer; transition: transform 0.15s ease; }
.layout-thumb:hover { transform: translateY(-2px); }
.layout-thumb:focus { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 8px; }

.logo-row { gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.logo-thumb { max-height: 40px; padding: 0.3rem; border-radius: 6px; background: var(--panel-2); }
.logo-clear {
  background: transparent; border: 1px solid var(--error); color: var(--error);
  width: 24px; height: 24px; border-radius: 50%; padding: 0; line-height: 1;
  font-size: 0.85rem; font-weight: 700; cursor: pointer; flex: 0 0 auto;
}
.logo-clear:hover { background: var(--error); color: #fff; }

/* Nested <details> inside a fieldset (e.g. Performance) */
.card-nested {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 0.5rem 0.75rem; margin-top: 0.75rem; background: var(--panel-2);
}
.card-nested > summary { cursor: pointer; font-weight: 600; padding: 0.25rem 0; }
.card-nested[open] > summary { margin-bottom: 0.5rem; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }

/* Storefront: footer social icons */
.footer-socials { display: flex; gap: 0.75rem; margin-top: 0.75rem; }
.social-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border); color: var(--muted); transition: all 0.2s ease;
}
.social-link:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); text-decoration: none; }

/* Inventory compact cards (click row to expand) */
.inv-grid-compact { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.5rem; }
.inv-card {
  border: 1px solid var(--border); border-radius: 10px; background: var(--panel);
  transition: border-color 0.18s ease;
}
.inv-card[open] { grid-column: 1 / -1; border-color: var(--accent); }
.inv-card-summary {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.6rem 0.85rem; cursor: pointer; list-style: none;
}
.inv-card-summary::-webkit-details-marker { display: none; }
.inv-card-name { display: flex; align-items: baseline; gap: 0.4rem; min-width: 0; flex-wrap: wrap; }
.inv-card-name strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-card-size { font-weight: 600; color: var(--accent); }
.inv-card-body { padding: 0.85rem; border-top: 1px solid var(--border); }

/* Workflow page — 4 phase cards in a 2x2 grid on wide screens */
.wf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.wf-grid .card { margin-bottom: 0; }

/* Media library — clickable tiles + edit dialog */
.media-tile-btn { padding: 0; cursor: pointer; text-align: left; }
.media-tile-btn:hover { border-color: var(--accent); }
.media-tile-btn:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

.media-edit-dialog {
  border: 1px solid var(--border); border-radius: 14px; padding: 0;
  background: var(--bg); color: var(--text);
  width: min(960px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
}
.media-edit-dialog::backdrop { background: rgba(0,0,0,0.55); backdrop-filter: blur(2px); }
#media-edit-form { padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; }
.me-head { display: flex; align-items: center; justify-content: space-between; }
.me-body { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(220px, 1fr); gap: 1.25rem; }
@media (max-width: 720px) { .me-body { grid-template-columns: 1fr; } }
.me-canvas-wrap { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.me-stage {
  position: relative; background: var(--panel-2); border-radius: 10px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  max-height: 60vh; min-height: 240px;
}
.me-stage img { max-width: 100%; max-height: 60vh; display: block; user-select: none; }
.me-crop {
  position: absolute; border: 2px solid var(--accent);
  background: rgba(99, 102, 241, 0.18);
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.45);
  cursor: move; touch-action: none;
}
.me-crop-handle {
  position: absolute; width: 14px; height: 14px; background: var(--accent); border: 2px solid #fff;
  border-radius: 50%; touch-action: none;
}
.me-crop-handle[data-h="nw"] { top: -8px; left: -8px; cursor: nwse-resize; }
.me-crop-handle[data-h="ne"] { top: -8px; right: -8px; cursor: nesw-resize; }
.me-crop-handle[data-h="sw"] { bottom: -8px; left: -8px; cursor: nesw-resize; }
.me-crop-handle[data-h="se"] { bottom: -8px; right: -8px; cursor: nwse-resize; }
.me-tools { display: flex; gap: 0.5rem; }

.me-fields { display: flex; flex-direction: column; gap: 0.6rem; min-width: 0; }
.me-fields label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.88rem; }
.me-actions { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; flex-wrap: wrap; }

/* Sidebar user block (bottom of the sidebar) */
.side-user {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 0.5rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--admin-side-border);
}
.side-user-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: var(--brand-grad); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.95rem;
}
.side-user-info { flex: 1; min-width: 0; overflow: hidden; }
.side-user-info p { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-name { font-weight: 600; font-size: 0.88rem; color: var(--text); text-transform: capitalize; }
.side-user-email { font-size: 0.78rem; color: var(--muted); }
.side-collapsed .side-user-info { display: none; }
.side-collapsed .side-user { justify-content: center; }

/* Admin header user menu (dropdown) */
.user-menu { position: relative; }
.user-menu-btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: transparent; border: 1px solid transparent; color: var(--text);
  padding: 0.4rem 0.6rem; border-radius: 8px; cursor: pointer;
  font-size: 0.9rem;
}
.user-menu-btn:hover { background: var(--secondary); }
.user-menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50;
  min-width: 200px;
  background: var(--admin-side-bg); border: 1px solid var(--admin-side-border);
  border-radius: 10px; padding: 0.35rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  display: flex; flex-direction: column; gap: 0.05rem;
}
/* `display: flex` above would override the `hidden` attribute, leaving the
   dropdown stuck open. Force it closed when the attribute is present. */
.user-menu-pop[hidden] { display: none; }
.user-menu-btn[aria-expanded="true"] .user-menu-caret { transform: rotate(180deg); }
.user-menu-caret { transition: transform 0.18s ease; }
.user-menu-pop a, .user-menu-signout {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.5rem 0.65rem; border-radius: 6px;
  color: var(--text); text-decoration: none; font-size: 0.92rem;
  background: transparent; border: none; cursor: pointer; width: 100%; text-align: left;
}
.user-menu-pop a:hover, .user-menu-signout:hover { background: var(--secondary); text-decoration: none; }
.user-menu-signout { color: var(--error); }
.user-menu-pop hr { border: none; border-top: 1px solid var(--admin-side-border); margin: 0.3rem 0; }
.user-menu-pop form { margin: 0; }

/* Inventory: keep expanded cards in the grid (no full-row span) */
.inv-card[open] { grid-column: auto; }

/* Workflow page: prefer 4 columns, gracefully reduce */
.wf-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

/* ---- Shared "blue-grey card" admin styles ----
   Used by the dashboard, analytics, reports, products, inventory pages so
   they all read with the same rounded-card / muted-label / colored-icon look. */
.admin-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin: 0 0 1.25rem; }
.admin-h1 { margin: 0; font-size: 1.4rem; font-weight: 700; color: var(--text); }
.admin-sub { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.9rem; }

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin: 0 0 1.25rem;
}
.admin-stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}
.admin-stat-label { color: var(--muted); font-size: 0.8rem; margin-bottom: 0.25rem; }
.admin-stat-value { font-size: 1.6rem; font-weight: 800; color: var(--text); }

.admin-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  overflow: hidden;
}
.admin-card-head { padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); }

/* ---- Inventory dense table ---- */
.inv-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.inv-search { flex: 1; min-width: 220px; max-width: 380px; }
.inv-search input { width: 100%; }
.inv-filters { display: inline-flex; flex-wrap: wrap; gap: 0.35rem; }
.inv-filter-pill {
  display: inline-flex; align-items: center;
  padding: 0.25rem 0.75rem; border-radius: 999px;
  background: var(--secondary); color: var(--muted);
  font-size: 0.78rem; font-weight: 600;
  text-decoration: none; transition: background-color 0.15s ease, color 0.15s ease;
}
.inv-filter-pill:hover { color: var(--text); text-decoration: none; }
.inv-filter-pill.active { background: var(--accent); color: #fff; }

.inv-table-wrap { overflow-x: auto; }
.inv-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; min-width: 1400px; }
.inv-table thead th {
  text-align: left; padding: 0.6rem 0.6rem;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
[data-theme="light"] .inv-table thead th { background: rgba(0, 0, 0, 0.02); }

/* Orders bulk-select toolbar. */
.orders-bulk-bar { display: flex; align-items: center; gap: 0.75rem; margin: 0 0 0.5rem; }

/* Sortable table headers (admin lists). */
th.th-sortable { cursor: pointer; user-select: none; }
th.th-sortable::after { content: "↕"; opacity: 0.35; margin-left: 0.35em; font-size: 0.85em; }
th.th-sortable[data-sort-dir="asc"]::after { content: "↑"; opacity: 0.9; }
th.th-sortable[data-sort-dir="desc"]::after { content: "↓"; opacity: 0.9; }
th.th-sortable:hover { color: var(--accent); }
.inv-table tbody td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.inv-table tbody tr.inv-row:hover { background: var(--secondary); }
.inv-table tbody tr.inv-row-danger { background: rgba(239, 68, 68, 0.06); }
.inv-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.82rem; }
.inv-product strong { color: var(--text); font-size: 0.88rem; }
.inv-pos-strong { color: #10b981; font-weight: 700; }
.inv-neg-strong { color: var(--error); font-weight: 700; }
.inv-warn { color: #f59e0b; font-weight: 600; }
.inv-neg  { color: var(--error); font-weight: 600; }
.inv-muted { color: var(--muted); }
.inv-notes { white-space: normal; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }

.inv-pill {
  display: inline-flex; align-items: center;
  padding: 0.15rem 0.55rem; border-radius: 999px;
  font-size: 0.72rem; font-weight: 600;
}
.inv-pill-ok     { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.inv-pill-warn   { background: rgba(245, 158, 11, 0.18); color: #f59e0b; }
.inv-pill-danger { background: rgba(239, 68, 68, 0.18);  color: var(--error); }

.inv-action-btn {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  font-size: 0.75rem; padding: 0.2rem 0.55rem; border-radius: 6px; cursor: pointer;
}
.inv-action-btn:hover { color: var(--text); border-color: var(--accent); }

.inv-edit-row { background: var(--bg); }
.inv-edit-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.6rem 0.8rem;
  padding: 0.85rem 0.9rem;
  white-space: normal;
}
.inv-edit-form label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.78rem; color: var(--muted); }
.inv-edit-form input, .inv-edit-form textarea { font-size: 0.82rem; }
.inv-edit-notes { grid-column: span 3; }
.inv-edit-actions { grid-column: 1 / -1; display: flex; gap: 0.6rem; align-items: center; justify-content: flex-end; }

/* Column-visibility dropdown */
.inv-cols-wrap { position: relative; }
.inv-cols-btn {
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  padding: 0.45rem 0.85rem; border-radius: 8px; cursor: pointer; font-size: 0.85rem;
}
.inv-cols-btn:hover { background: var(--secondary); }
.inv-cols-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  min-width: 360px;
  /* Solid (not see-through) background so it actually reads over the table.
     `--admin-side-bg` is the same solid we use for the sidebar/header. */
  background: var(--admin-side-bg);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 0.6rem 0.75rem 0.75rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  max-height: 70vh; overflow-y: auto;
}
[data-theme="light"] .inv-cols-pop { box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12); }
.inv-cols-pop[hidden] { display: none; }
.inv-cols-head { margin: 0 0 0.5rem; color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; grid-column: 1 / -1; }
.inv-cols-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.15rem 0.6rem; }
.inv-cols-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.55rem; padding: 0.3rem 0.4rem; border-radius: 6px;
  font-size: 0.85rem; color: var(--text); cursor: pointer;
}
.inv-cols-row:hover { background: var(--secondary); }
.inv-cols-row .inv-cols-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-cols-row input { width: auto; margin: 0; flex-shrink: 0; }

/* Media library: copy-URL chip that appears on hover over each tile. */
.media-tile-wrap { position: relative; }
/* Always-visible read-only URL + copy button under each tile. */
.media-url-row { display: flex; gap: 0.3rem; align-items: center; margin-top: 0.3rem; }
.media-url-field {
  flex: 1; min-width: 0; font-family: ui-monospace, monospace; font-size: 0.68rem;
  padding: 0.2rem 0.4rem; border: 1px solid var(--border); border-radius: 6px;
  background: var(--secondary); color: var(--text);
}
.media-copy-url {
  flex: 0 0 auto; z-index: 2;
  background: rgba(15, 15, 26, 0.85); color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px; padding: 0.2rem 0.45rem;
  font-size: 0.78rem; cursor: pointer; line-height: 1;
}
.media-copy-url:hover { background: rgba(15, 15, 26, 0.95); border-color: rgba(255, 255, 255, 0.3); }
[data-theme="light"] .media-copy-url { background: rgba(255, 255, 255, 0.92); color: #1a1d2e; border-color: rgba(0, 0, 0, 0.12); }

/* Page builder code view — line-numbered gutter + monospace pane.
   The gutter scroll position is synced from JS so the numbers track the
   textarea exactly as the admin scrolls long documents. */
.code-block {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0f1117;
  color: #e4e4f4;
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.5;
}
[data-theme="light"] .code-block { background: #f7f7fb; color: #1a1d2e; }
.code-block .code-gutter {
  flex-shrink: 0;
  width: 3.25rem;
  margin: 0;
  padding: 0.85rem 0.6rem;
  background: rgba(255, 255, 255, 0.04);
  border-right: 1px solid var(--border);
  color: rgba(228, 228, 244, 0.45);
  text-align: right;
  font-family: inherit;
  font-size: 0.8rem;
  line-height: 1.5;
  overflow: hidden;
  user-select: none;
  white-space: pre;
}
[data-theme="light"] .code-block .code-gutter { background: rgba(0, 0, 0, 0.03); color: rgba(26, 29, 46, 0.5); }
.code-block #code-text {
  flex: 1; min-width: 0;
  margin: 0;
  padding: 0.85rem 0.9rem;
  background: transparent;
  color: inherit;
  border: none;
  outline: none;
  resize: vertical;
  min-height: 50vh;
  font-family: inherit;
  font-size: inherit;
  line-height: 1.5;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}

/* ===== Page editor: book-flip live preview ===== */
.flip-scene { perspective: 2200px; margin-top: 0.25rem; }
.flip-inner {
  position: relative; width: 100%; min-height: 22rem;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.2, 0.75, 0.2, 1);
}
.flip-inner.flipped { transform: rotateY(180deg); }
.flip-face { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
/* Front stays in normal flow so the scene height follows the editor; the back
   sits over it and only faces the viewer once the scene is flipped. */
.flip-front { position: relative; z-index: 2; }
.flip-back {
  position: absolute; inset: 0; z-index: 1;
  transform: rotateY(180deg);
  display: flex; flex-direction: column;
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  background: var(--bg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}
.flip-inner.flipped .flip-back { pointer-events: auto; }
.flip-inner.flipped .flip-front { pointer-events: none; }
.preview-head {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.85rem; font-size: 0.85rem; font-weight: 600;
  background: var(--panel-2); border-bottom: 1px solid var(--border); color: var(--muted);
}
.preview-head .preview-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); }
.preview-head.loading .preview-dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2); animation: preview-pulse 0.9s ease-in-out infinite; }
.preview-head.loading::after { content: "Rendering…"; color: var(--muted); font-weight: 400; }
@keyframes preview-pulse { 50% { opacity: 0.35; } }
.preview-frame { flex: 1 1 auto; width: 100%; min-height: 20rem; border: 0; background: var(--bg); }
/* Respect users who prefer no motion: skip the flip, just cross-cut. */
@media (prefers-reduced-motion: reduce) { .flip-inner { transition: none; } }

.media-trash-form { position: absolute; top: 8px; right: 8px; z-index: 2; margin: 0; }
.media-trash-btn {
  background: rgba(15, 15, 26, 0.85); color: #fca5a5;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px; padding: 0.25rem 0.4rem;
  cursor: pointer;
  opacity: 0; transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease, color 0.15s ease, background 0.15s ease;
  display: inline-flex; align-items: center; justify-content: center;
}
.media-tile-wrap:hover .media-trash-btn,
.media-tile-wrap:focus-within .media-trash-btn { opacity: 1; transform: translateY(0); }
.media-trash-btn:hover { background: rgba(239, 68, 68, 0.95); color: #fff; border-color: rgba(239, 68, 68, 0.8); }
[data-theme="light"] .media-trash-btn { background: rgba(255, 255, 255, 0.92); color: #b91c1c; border-color: rgba(0, 0, 0, 0.12); }

/* Customers table — sortable, column-toggleable. */
.cust-table { width: 100%; border-collapse: collapse; }
.cust-table th, .cust-table td { padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--border); text-align: left; font-size: 0.9rem; vertical-align: middle; }
.cust-table thead th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.cust-table tbody tr:hover { background: var(--secondary); }
.cust-sort-link { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 0.2rem; }
.cust-sort-link:hover { color: var(--text); text-decoration: none; }

.cust-table.cust-hide-id        th[data-col="id"],        .cust-table.cust-hide-id        td[data-col="id"],
.cust-table.cust-hide-email     th[data-col="email"],     .cust-table.cust-hide-email     td[data-col="email"],
.cust-table.cust-hide-username  th[data-col="username"],  .cust-table.cust-hide-username  td[data-col="username"],
.cust-table.cust-hide-name      th[data-col="name"],      .cust-table.cust-hide-name      td[data-col="name"],
.cust-table.cust-hide-role      th[data-col="role"],      .cust-table.cust-hide-role      td[data-col="role"],
.cust-table.cust-hide-orders    th[data-col="orders"],    .cust-table.cust-hide-orders    td[data-col="orders"],
.cust-table.cust-hide-wallet    th[data-col="wallet"],    .cust-table.cust-hide-wallet    td[data-col="wallet"],
.cust-table.cust-hide-created   th[data-col="created"],   .cust-table.cust-hide-created   td[data-col="created"],
.cust-table.cust-hide-city      th[data-col="city"],      .cust-table.cust-hide-city      td[data-col="city"],
.cust-table.cust-hide-state     th[data-col="state"],     .cust-table.cust-hide-state     td[data-col="state"],
.cust-table.cust-hide-zip       th[data-col="zip"],       .cust-table.cust-hide-zip       td[data-col="zip"],
.cust-table.cust-hide-ip        th[data-col="ip"],        .cust-table.cust-hide-ip        td[data-col="ip"]
  { display: none; }

/* The hide rule: any table.inv-table.inv-hide-COL hides th/td with that data-col. */
.inv-table.inv-hide-sale_price th[data-col="sale_price"], .inv-table.inv-hide-sale_price td[data-col="sale_price"],
.inv-table.inv-hide-velocity   th[data-col="velocity"],   .inv-table.inv-hide-velocity   td[data-col="velocity"],
.inv-table.inv-hide-sku1       th[data-col="sku1"],       .inv-table.inv-hide-sku1       td[data-col="sku1"],
.inv-table.inv-hide-sku2       th[data-col="sku2"],       .inv-table.inv-hide-sku2       td[data-col="sku2"],
.inv-table.inv-hide-size       th[data-col="size"],       .inv-table.inv-hide-size       td[data-col="size"],
.inv-table.inv-hide-quantity   th[data-col="quantity"],   .inv-table.inv-hide-quantity   td[data-col="quantity"],
.inv-table.inv-hide-labeled    th[data-col="labeled"],    .inv-table.inv-hide-labeled    td[data-col="labeled"],
.inv-table.inv-hide-off_books  th[data-col="off_books"],  .inv-table.inv-hide-off_books  td[data-col="off_books"],
.inv-table.inv-hide-status     th[data-col="status"],     .inv-table.inv-hide-status     td[data-col="status"],
.inv-table.inv-hide-batch      th[data-col="batch"],      .inv-table.inv-hide-batch      td[data-col="batch"],
.inv-table.inv-hide-net_wt     th[data-col="net_wt"],     .inv-table.inv-hide-net_wt     td[data-col="net_wt"],
.inv-table.inv-hide-purity     th[data-col="purity"],     .inv-table.inv-hide-purity     td[data-col="purity"],
.inv-table.inv-hide-ord_qty    th[data-col="ord_qty"],    .inv-table.inv-hide-ord_qty    td[data-col="ord_qty"],
.inv-table.inv-hide-ord_date   th[data-col="ord_date"],   .inv-table.inv-hide-ord_date   td[data-col="ord_date"],
.inv-table.inv-hide-notes      th[data-col="notes"],      .inv-table.inv-hide-notes      td[data-col="notes"]
  { display: none; }

/* ---- Neon cards (analytics-style glow) ----
   Drop-in: <div class="neon-card glow-a"> ... </div>. Each glow-N picks a
   different accent so the page reads as a row of distinct, glowing cards. */
.neon-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  background: linear-gradient(160deg, rgba(99, 102, 241, 0.10), rgba(139, 92, 246, 0.03));
  box-shadow: 0 0 18px rgba(99, 102, 241, 0.12), inset 0 0 24px rgba(139, 92, 246, 0.05);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.neon-card:hover { transform: translateY(-1px); }
.neon-card .neon-n { font-size: 1.8rem; font-weight: 800; color: var(--text); line-height: 1.1; }
.neon-card .neon-l { color: var(--muted); font-size: 0.85rem; margin-top: 0.2rem; }
.neon-card .neon-l .muted { color: var(--muted); opacity: 0.7; }

/* Per-card hues — indigo, emerald, amber, rose, cyan, violet. Stack the
   classes (neon-card glow-X) and the colors override the default purple. */
.neon-card.glow-a { border-color: rgba(99, 102, 241, 0.45);
  background: linear-gradient(160deg, rgba(99, 102, 241, 0.14), rgba(99, 102, 241, 0.03));
  box-shadow: 0 0 22px rgba(99, 102, 241, 0.22), inset 0 0 28px rgba(99, 102, 241, 0.08); }
.neon-card.glow-b { border-color: rgba(16, 185, 129, 0.45);
  background: linear-gradient(160deg, rgba(16, 185, 129, 0.14), rgba(16, 185, 129, 0.03));
  box-shadow: 0 0 22px rgba(16, 185, 129, 0.22), inset 0 0 28px rgba(16, 185, 129, 0.08); }
.neon-card.glow-c { border-color: rgba(245, 158, 11, 0.45);
  background: linear-gradient(160deg, rgba(245, 158, 11, 0.14), rgba(245, 158, 11, 0.03));
  box-shadow: 0 0 22px rgba(245, 158, 11, 0.22), inset 0 0 28px rgba(245, 158, 11, 0.08); }
.neon-card.glow-d { border-color: rgba(239, 68, 68, 0.45);
  background: linear-gradient(160deg, rgba(239, 68, 68, 0.14), rgba(239, 68, 68, 0.03));
  box-shadow: 0 0 22px rgba(239, 68, 68, 0.22), inset 0 0 28px rgba(239, 68, 68, 0.08); }
.neon-card.glow-e { border-color: rgba(6, 182, 212, 0.45);
  background: linear-gradient(160deg, rgba(6, 182, 212, 0.14), rgba(6, 182, 212, 0.03));
  box-shadow: 0 0 22px rgba(6, 182, 212, 0.22), inset 0 0 28px rgba(6, 182, 212, 0.08); }
.neon-card.glow-f { border-color: rgba(168, 85, 247, 0.45);
  background: linear-gradient(160deg, rgba(168, 85, 247, 0.14), rgba(168, 85, 247, 0.03));
  box-shadow: 0 0 22px rgba(168, 85, 247, 0.22), inset 0 0 28px rgba(168, 85, 247, 0.08); }

/* Light mode keeps the glow legible without washing out content. */
[data-theme="light"] .neon-card { box-shadow: 0 0 14px rgba(99, 102, 241, 0.10), inset 0 0 18px rgba(139, 92, 246, 0.04); }

/* ===== Media library: folders, selection & drag-and-drop ===== */
.notice.error { color: var(--error); }
.media-folders { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0 .25rem; }
.folder-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .7rem; border: 1px solid var(--border); border-radius: 999px;
  background: var(--panel-2); color: inherit; font-size: .9rem; cursor: pointer;
  text-decoration: none; transition: border-color .12s, background .12s, transform .08s;
}
.folder-chip:hover { border-color: var(--accent); }
.folder-chip.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.folder-chip .folder-count {
  font-size: .72rem; font-weight: 700; min-width: 1.3rem; text-align: center;
  padding: 0 .35rem; border-radius: 999px; background: var(--border); color: var(--muted);
}
.folder-chip.active .folder-count { background: var(--accent); color: #fff; }
.folder-chip.folder-add { border-style: dashed; color: var(--accent); }
.folder-chip.drop-hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 26%, transparent); transform: scale(1.04); }
.media-folder-actions { display: flex; align-items: center; gap: .8rem; margin: .2rem 0 .4rem; font-size: .88rem; }

.media-bulkbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .8rem;
  padding: .6rem .8rem; margin: 0 0 .8rem; border: 1px solid var(--accent);
  border-radius: 10px; background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.media-bulkbar .bulk-count { font-weight: 600; }

/* Selection checkbox sits over the top-left of each tile. */
.media-select {
  position: absolute; top: .4rem; left: .4rem; z-index: 3;
  width: 1.5rem; height: 1.5rem; display: grid; place-items: center;
  background: rgba(0,0,0,.45); border-radius: 6px; cursor: pointer;
  opacity: 0; transition: opacity .12s;
}
.media-select .media-select-cb { width: 1.05rem; height: 1.05rem; cursor: pointer; margin: 0; }
.media-tile-wrap:hover .media-select,
.media-tile-wrap:focus-within .media-select,
.media-tile-wrap.selected .media-select { opacity: 1; }
.media-tile-wrap.selected .media-tile { outline: 2px solid var(--accent); outline-offset: -2px; }
.media-tile-wrap[draggable=true] { cursor: grab; }
.media-tile-wrap.dragging { opacity: .5; }

/* Product image picker dialog (pulls from the Media Library). */
.media-pick-dialog { border: 1px solid var(--border); border-radius: 12px; padding: 1rem; width: min(720px, 92vw); background: var(--panel); color: inherit; }
.media-pick-dialog::backdrop { background: rgba(0,0,0,.5); }
.media-pick-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; }
.media-pick-upload { margin-bottom: .8rem; }
.media-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .6rem; max-height: 60vh; overflow-y: auto; }

/* ===== Rich-text editor (public/scripts/richtext.js) ===== */
.rte { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--panel); }
.rte-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem; padding: .35rem .4rem; background: var(--panel-2); border-bottom: 1px solid var(--border); }
.rte-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 1.9rem; height: 1.9rem; padding: 0 .4rem; font-size: .85rem; line-height: 1; color: var(--fg, inherit); background: transparent; border: 1px solid transparent; border-radius: 6px; cursor: pointer; }
.rte-btn:hover { background: var(--panel); border-color: var(--border); color: var(--accent); }
.rte-sep { width: 1px; height: 1.3rem; margin: 0 .25rem; background: var(--border); }
.rte-select { height: 1.9rem; padding: 0 .3rem; font-size: .8rem; color: inherit; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.rte-color { width: 1.9rem; height: 1.9rem; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); cursor: pointer; }
.rte-btn:disabled, .rte-select:disabled, .rte-color:disabled { opacity: .4; cursor: default; }
.rte-btn:disabled:hover { background: transparent; border-color: transparent; color: inherit; }
/* Field wrapper for the rich-text editor. Deliberately a <div>, NOT a <label>:
   a contentEditable surface inside a <label> has its clicks forwarded to the
   label's control, leaving the editor with no caret. */
.rte-field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .35rem; }
.rte-field > .rte-field-label { font-size: .9rem; color: var(--muted); }
.rte-field > textarea { width: 100%; }
.rte-code-btn { margin-left: auto; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; }
.rte-code-btn.is-on { background: var(--accent); color: #1a1205; border-color: var(--accent); }
.rte-fs-btn { font-size: 1rem; }
.rte-fs-btn.is-on { background: var(--accent); color: #1a1205; border-color: var(--accent); }
/* Drag the bottom edge to resize; contentEditable grows with content too. */
.rte-surface { min-height: 10rem; max-height: none; height: 16rem; overflow-y: auto; resize: vertical; padding: .7rem .8rem; font-size: .95rem; line-height: 1.5; outline: none; }

/* Full-screen editing: the widget fills the viewport and the active editor
   (surface or code textarea) flexes to take all remaining height. */
body.rte-fs-lock { overflow: hidden; }
.rte-fullscreen { position: fixed; inset: 0; z-index: 3000; margin: 0; border-radius: 0; display: flex; flex-direction: column; box-shadow: none; }
.rte-fullscreen .rte-bar { position: sticky; top: 0; }
.rte-fullscreen .rte-surface { flex: 1 1 auto; height: auto; max-height: none; resize: none; }
.rte-fullscreen textarea.rte-code { flex: 1 1 auto; min-height: 0; max-height: none; resize: none; }
textarea.rte-code { display: block; width: 100%; min-height: 14rem; margin: 0; padding: .7rem .8rem; border: none; border-radius: 0; background: var(--panel-2); color: inherit; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; line-height: 1.5; resize: vertical; }
textarea.rte-code:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.rte-surface:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.rte-surface h2, .rte-surface h3 { margin: .4rem 0; }
.rte-surface blockquote { margin: .4rem 0; padding-left: .8rem; border-left: 3px solid var(--accent); color: var(--muted); }
.rte-surface a { color: var(--accent); }
.rte-surface:empty::before { content: "Write a description…"; color: var(--muted); }

/* Rendered rich text on the storefront product page. */
.product-desc { line-height: 1.6; }
.product-desc h2, .product-desc h3 { margin: .8rem 0 .4rem; }
.product-desc ul, .product-desc ol { margin: .5rem 0 .5rem 1.4rem; }
.product-desc blockquote { margin: .6rem 0; padding-left: .9rem; border-left: 3px solid var(--accent); color: var(--muted); }
.product-desc a { color: var(--accent); }

/* ===== Variant drag-and-drop reorder (admin product editor) ===== */
.variant-drag-cell { width: 1.8rem; text-align: center; vertical-align: middle; }
.variant-drag {
  display: inline-block; cursor: grab; user-select: none;
  color: var(--muted); font-size: 1.1rem; line-height: 1; padding: .1rem .2rem;
  border-radius: 6px; touch-action: none;
}
.variant-drag:hover { color: var(--accent); background: var(--panel-2); }
.variant-drag:active { cursor: grabbing; }
tr[data-variant-id].dragging { opacity: .5; background: var(--panel-2); }
tr[data-variant-id].dragging td { border-color: var(--accent); }

/* ===== Product image reorder (admin product editor) ===== */
.image-reorder { flex-wrap: wrap; gap: .6rem; }
.img-card {
  position: relative; text-align: center; border-radius: 10px; padding: .4rem;
  cursor: grab; user-select: none; background: var(--panel-2);
}
.img-card:active { cursor: grabbing; }
.img-card.dragging { opacity: .5; }
.img-card img { display: block; }
.img-first-badge {
  position: absolute; top: .3rem; left: .3rem; z-index: 1;
  font-size: .68rem; font-weight: 700; color: #1a1205; background: var(--accent);
  border-radius: 999px; padding: .05rem .4rem;
}
.img-variant-select { width: 124px; max-width: 124px; font-size: .78rem; padding: .2rem .3rem; }

/* ===== Shop page: header toolbar + scroll reveal ===== */
.shop-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.shop-head h1 { margin: 0; }
.shop-toolbar { display: flex; gap: .5rem; align-items: center; justify-content: flex-end; margin-left: auto; }
.shop-toolbar input[type="search"] { width: 180px; max-width: 46vw; padding: .4rem .6rem; font-size: .9rem; }
.shop-toolbar select { padding: .4rem .5rem; font-size: .9rem; }
.shop-section { margin-bottom: 2rem; }

/* Cards start hidden only once JS marks the container ready (no-JS shows all). */
.shop-reveal.reveal-ready .product-card { opacity: 0; transform: translateY(16px); transition: opacity .5s ease, transform .5s ease; }
.shop-reveal.reveal-ready .product-card.in-view { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .shop-reveal.reveal-ready .product-card { opacity: 1; transform: none; transition: none; }
}

@media (max-width: 640px) {
  .shop-head { flex-direction: column; align-items: stretch; }
  .shop-toolbar { margin-left: 0; }
  .shop-toolbar input[type="search"] { flex: 1 1 auto; width: auto; max-width: none; }
}

/* Menu editor drag handle (Admin → Appearance → Menus). */
.menu-drag { cursor: grab; user-select: none; color: var(--muted); font-size: 1.05rem; padding: 0 .15rem; align-self: center; flex: 0 0 auto; }
.menu-drag:hover { color: var(--accent); }
.menu-drag:active { cursor: grabbing; }
.menu-row.dragging { opacity: .5; }
