/*
 * Galleon — shops, orders, effects and owner management
 * Purple V2 Theme | RTL / Persian | Dark Purple + Gold
 *
 * Builds on contact_glass.css (loaded alongside it on galleon pages) and only
 * consumes its --ct-* tokens plus the semantic --theme-color-* tokens, so
 * dark/light and the minimal surface mode work without extra rules.
 * Loaded from theme_autorun.php; markup lives in themes/purple_v2/modules/galleon/*.tpl.
 */

.gl-page {
  --gl-sunk:      var(--ct-input-bg);
  --gl-gap:       20px;
  --gl-ease-out:  cubic-bezier(0.22, 1, 0.36, 1);
  --gl-ok-rgb:    var(--profile-stat-green-rgb);
  --gl-warn-rgb:  var(--profile-stat-amber-rgb);
  --gl-bad-rgb:   var(--theme-color-danger-rgb);
  --gl-info-rgb:  var(--theme-color-accent-2-rgb);
  /* Catalogue paintings are dark purple in both themes: fallback tiles and overlays match them, not the page. */
  --gl-photo-rgb:     13, 6, 24;
  --gl-on-photo:      #fff;
  --gl-on-photo-soft: rgba(255, 255, 255, 0.84);
  --gl-on-photo-gold: var(--gold-200);
  --gl-stage:     radial-gradient(circle at 50% 42%, #4a2472 0, #2a1245 46%, #150a26 100%);
  --gl-coin:      radial-gradient(circle at 34% 30%, var(--theme-color-gold-pale) 0 18%, var(--theme-color-gold-light) 34%, var(--theme-color-gold-base) 62%, var(--theme-color-gold-dark) 100%);

  direction: rtl;
  display: flex;
  flex-direction: column;
  gap: var(--gl-gap);
  min-width: 0;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px 0 48px;
  font-family: "Vazir", Tahoma, Arial, sans-serif;
  color: var(--ct-text);
}
:root[data-theme=dark] .gl-page {
  --gl-ok-rgb:   var(--profile-stat-emerald-rgb);
  --gl-warn-rgb: var(--profile-stat-yellow-rgb);
}

.gl-page .ct-card { min-width: 0; max-width: 100%; padding: 26px; }
.gl-page .ct-field__label .gl-i { width: 15px; height: 15px; margin-inline-end: 5px; vertical-align: -2px; }
.gl-page svg { flex-shrink: 0; }
.gl-page a { text-underline-offset: 3px; }
.gl-i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.gl-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.gl-sprite { display: none; }

/* ============================================================
   Module bar: breadcrumb, balance, moderation entry, section tabs.
   Its own card above the page, so nothing sits on top of a shop's picture.
   ============================================================ */
.gl-page {
  /* Light theme's gold reaches only 3.7:1 on cards; darkened toward the text colour it passes 4.5:1. */
  --gl-gold-text: color-mix(in srgb, var(--ct-gold) 68%, var(--ct-text));
}
:root[data-theme=dark] .gl-page { --gl-gold-text: var(--ct-gold); }

.gl-page .ct-card.gl-bar { display: flex; flex-direction: column; gap: 0; padding: 0; overflow: hidden; }
.gl-bar__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 12px 20px;
}
.gl-bar__crumbs { flex: 1 1 auto; min-width: 0; }
.gl-bar__end { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; margin-inline-start: auto; }

.gl-page .gl-bar__mod {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--ct-border-strong);
  border-radius: 999px;
  color: var(--ct-text-muted);
  font-size: var(--ct-fs-sm);
  font-weight: 700;
  text-decoration: none;
  touch-action: manipulation;
  transition: color var(--ct-ease), border-color var(--ct-ease), background var(--ct-ease);
}
.gl-page .gl-bar__mod .gl-i { width: 17px; height: 17px; }
.gl-page .gl-bar__mod:hover { color: var(--ct-text); border-color: var(--ct-gold-border); background: var(--ct-gold-soft); }
.gl-page .gl-bar__mod:focus-visible { outline: 2px solid var(--ct-gold); outline-offset: 2px; }

.gl-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--ct-fs-sm);
  color: var(--ct-text-muted);
}
.gl-crumbs li { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.gl-crumbs li + li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-left: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.55;
  margin-left: 4px;
}
.gl-crumbs a { display: inline-flex; align-items: center; gap: 5px; color: var(--gl-gold-text); text-decoration: none; transition: color var(--ct-ease); }
.gl-crumbs a:hover { color: var(--ct-text); }
.gl-crumbs a:focus-visible { outline: 2px solid var(--ct-gold); outline-offset: 2px; border-radius: 4px; }
.gl-crumbs .gl-i { width: 14px; height: 14px; }
.gl-crumbs [aria-current] { color: var(--ct-text); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 42ch; }

/* Wallet: the reader's balance, one glance away on every page */
.gl-wallet {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding-block: 4px;
  padding-inline: 8px 16px;
  border: 1px solid var(--ct-gold-border);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--ct-gold-soft), transparent 80%), var(--gl-sunk);
}
.gl-wallet__amount { color: var(--gl-gold-text); font-size: var(--ct-fs-md); font-weight: 800; line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums; }
.gl-wallet__amount small { color: var(--ct-text-muted); font-size: var(--ct-fs-xs); font-weight: 600; }

.gl-coin {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  border-radius: 50%;
  background: var(--gl-coin);
  box-shadow: inset 0 0 0 1.5px rgba(var(--theme-color-gold-dark-rgb), 0.55), 0 1px 3px rgba(var(--theme-color-gold-dark-rgb), 0.45);
  vertical-align: -0.18em;
  flex-shrink: 0;
}
.gl-wallet .gl-coin { width: 28px; height: 28px; }
/* Mana (magical energy) sits in the same pill as Galleons, after a hairline, with a blue crystal instead of the coin. Mana is blue everywhere so it never reads as Galleons. */
.gl-wallet__part { display: inline-flex; align-items: center; gap: 9px; }
.gl-wallet__sep { width: 1px; height: 24px; background: var(--ct-gold-border); }
.gl-mana-icon { display: block; width: 30px; height: 30px; flex-shrink: 0; overflow: visible; filter: drop-shadow(0 1px 2px rgba(18, 63, 143, 0.4)); }
.gl-page { --gl-mana-text: #1b5fb4; --gl-mana-rgb: 27, 95, 180; }
:root[data-theme=dark] .gl-page { --gl-mana-text: #8fd0ff; --gl-mana-rgb: 143, 208, 255; }
.gl-wallet__part--mana .gl-wallet__amount { color: var(--gl-mana-text); }

/* Tabs under a hairline, the current section underlined in gold. They wrap on wide screens and scroll sideways on phones. */
.gl-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0 2px;
  margin: 0;
  padding: 0 12px;
  border-top: 1px solid var(--ct-border);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.gl-tabs::-webkit-scrollbar { display: none; }
/* RTL: the start edge is on the right */
.gl-tabs.is-clipped-start { -webkit-mask-image: linear-gradient(to left, transparent, #000 44px); mask-image: linear-gradient(to left, transparent, #000 44px); }
.gl-tabs.is-clipped-end { -webkit-mask-image: linear-gradient(to right, transparent, #000 44px); mask-image: linear-gradient(to right, transparent, #000 44px); }
.gl-tabs.is-clipped-start.is-clipped-end {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 44px, #000 calc(100% - 44px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 44px, #000 calc(100% - 44px), transparent);
}
.gl-page .gl-tab {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  min-height: 50px;
  padding: 0 10px;
  color: var(--ct-text-muted);
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  touch-action: manipulation;
  transition: color var(--ct-ease);
}
.gl-page .gl-tab::after {
  content: "";
  position: absolute;
  inset-inline: 10px;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--ct-gold);
  transform: scaleX(0);
  transition: transform 220ms var(--gl-ease-out);
}
.gl-page .gl-tab .gl-i { width: 17px; height: 17px; opacity: 0.8; }
.gl-page .gl-tab:hover { color: var(--ct-text); }
.gl-page .gl-tab:hover::after { transform: scaleX(0.35); }
.gl-page .gl-tab:focus-visible { outline: 2px solid var(--ct-gold); outline-offset: -6px; border-radius: 12px; }
.gl-page .gl-tab[aria-current] { color: var(--gl-gold-text); }
.gl-page .gl-tab[aria-current] .gl-i { opacity: 1; }
.gl-page .gl-tab[aria-current]::after { transform: scaleX(1); }
.gl-tab__count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--ct-gold-soft);
  color: var(--gl-gold-text);
  font-size: var(--ct-fs-xs);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
@media (prefers-reduced-motion: reduce) { .gl-page .gl-tab::after { transition: none; } }

/* The product page keeps only the bar: where you are and what you can spend. */
.gl-bar--compact .gl-bar__top { padding: 10px 18px; }

@media (max-width: 600px) {
  .gl-bar__top { padding: 10px 14px; }
  .gl-tabs { flex-wrap: nowrap; padding: 0 6px; }
  .gl-page .gl-tab { padding: 0 10px; }
  /* Icon only on phones; the label stays for screen readers. */
  .gl-page .gl-bar__mod { width: 44px; padding: 0; justify-content: center; }
  .gl-bar__mod span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .gl-bar--compact .gl-bar__crumbs { display: none; }
}

/* ============================================================
   Hero: the page's name and, on a shop page, the shop's own words across the full width.
   (The shop's picture is the page background, set by the theme's hero-setup.tpl.)
   ============================================================ */
.gl-hero { display: flex; flex-direction: column; gap: 18px; }
.gl-hero::after {
  content: "";
  position: absolute;
  inset-inline-start: -60px;
  top: -80px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--ct-gold-soft), transparent 70%);
  pointer-events: none;
}

.gl-hero__id { position: relative; z-index: 1; display: flex; align-items: center; gap: 16px; min-width: 0; }
.gl-hero__icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--ct-gold-soft), var(--ct-purple-glow));
  border: 1px solid var(--ct-gold-border);
  color: var(--ct-gold);
  overflow: hidden;
}
.gl-hero__icon .gl-i { width: 28px; height: 28px; stroke-width: 1.7; }
.gl-hero__icon img { width: 100%; height: 100%; object-fit: cover; }
.gl-hero__text { min-width: 0; }
.gl-hero__title {
  margin: 0;
  font-family: "Lalezar", "Vazir", Tahoma, Arial, sans-serif;
  font-size: var(--ct-fs-xl);
  font-weight: 400;
  line-height: 1.35;
  color: var(--ct-text);
  overflow-wrap: anywhere;
}
.gl-hero__sub { margin: 4px 0 0; color: var(--ct-text-muted); font-size: var(--ct-fs-sm); line-height: 1.8; }
.gl-hero__sub a { color: var(--gl-gold-text); text-decoration: none; }
.gl-hero__sub a:hover { text-decoration: underline; }

/* The shop's own words, in full and across the card */
.gl-story { display: flex; flex-direction: column; gap: 10px; padding-top: 20px; border-top: 1px solid var(--ct-border); }
.gl-page .gl-story__title { margin: 0; color: var(--gl-gold-text); font-size: var(--ct-fs-base); font-weight: 800; }
.gl-page .gl-story__text { width: 100%; color: var(--ct-text); font-size: 1.0625rem; line-height: 2; }

@media (max-width: 600px) {
  .gl-story { padding-top: 16px; }
  .gl-page .gl-story__text { font-size: 1rem; }
}

/* ============================================================
   Section headings and toolbars
   ============================================================ */
.gl-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 18px;
}
.gl-head__title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: "Lalezar", "Vazir", Tahoma, Arial, sans-serif;
  font-size: var(--ct-fs-lg);
  font-weight: 400;
  color: var(--ct-text);
}
.gl-head__title::before {
  content: "";
  width: 4px;
  height: 26px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--ct-gold) 0%, var(--ct-purple-accent) 100%);
}
.gl-head__sub { width: 100%; margin: -10px 0 0; color: var(--ct-text-muted); font-size: var(--ct-fs-sm); line-height: 1.8; }
.gl-head__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.gl-subtitle {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 24px 0 12px;
  font-size: var(--ct-fs-md);
  font-weight: 700;
  color: var(--ct-text);
}
.gl-subtitle:first-child { margin-top: 0; }
.gl-subtitle .gl-i { width: 20px; height: 20px; color: var(--ct-gold); }

.gl-count {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--ct-gold-soft);
  color: var(--ct-gold);
  font-family: "Vazir", Tahoma, sans-serif;
  font-size: var(--ct-fs-xs);
  font-weight: 700;
}

.gl-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 0 0 18px; }
.gl-toolbar .ct-field { flex: 1 1 220px; max-width: 360px; }
.gl-toolbar__end { margin-inline-start: auto; }

/* Segmented switch (my orders / review queue) */
.gl-seg { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--ct-border); border-radius: 999px; background: var(--gl-sunk); }
.gl-seg a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 6px 16px;
  border-radius: 999px;
  color: var(--ct-text-muted);
  font-size: var(--ct-fs-sm);
  font-weight: 700;
  text-decoration: none;
  transition: background var(--ct-ease), color var(--ct-ease);
}
.gl-seg a:hover { color: var(--ct-text); }
.gl-seg a[aria-current] { background: var(--ct-gold-soft); color: var(--ct-gold); box-shadow: inset 0 0 0 1px var(--ct-gold-border); }
.gl-seg .gl-i { width: 16px; height: 16px; }

/* ============================================================
   Buttons
   ============================================================ */
.gl-page .gl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 20px;
  border-radius: 999px;
  border: 1px solid var(--ct-gold-border);
  background: var(--ct-gold-soft);
  color: var(--ct-gold);
  font-family: inherit;
  font-size: var(--ct-fs-sm);
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  transition: background var(--ct-ease), border-color var(--ct-ease), color var(--ct-ease), transform 0.15s ease, box-shadow var(--ct-ease), filter var(--ct-ease);
}
.gl-page .gl-btn .gl-i { width: 17px; height: 17px; }
.gl-page .gl-btn:hover { border-color: var(--ct-gold); background: rgba(var(--theme-color-accent-rgb), 0.24); color: var(--ct-gold-bright); }
.gl-page .gl-btn:active { transform: scale(0.97); }
.gl-page .gl-btn:focus-visible { outline: 2px solid var(--ct-gold-bright); outline-offset: 3px; }
.gl-page .gl-btn--primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--ct-gold), var(--theme-color-gold-base));
  color: var(--theme-color-on-accent);
  box-shadow: 0 8px 22px rgba(var(--theme-color-accent-rgb), 0.3);
}
.gl-page .gl-btn--primary:hover {
  border-color: transparent;
  background: linear-gradient(135deg, var(--ct-gold), var(--theme-color-gold-base));
  color: var(--theme-color-on-accent);
  filter: brightness(1.06);
  box-shadow: 0 12px 28px rgba(var(--theme-color-accent-rgb), 0.42);
}
.gl-page .gl-btn--danger { border-color: rgba(var(--gl-bad-rgb), 0.45); background: rgba(var(--gl-bad-rgb), 0.1); color: var(--ct-danger); }
.gl-page .gl-btn--danger:hover { border-color: var(--ct-danger); background: rgba(var(--gl-bad-rgb), 0.18); color: var(--ct-danger); }
.gl-page .gl-btn--ghost { border-color: var(--ct-border-strong); background: transparent; color: var(--ct-text-muted); }
.gl-page .gl-btn--ghost:hover { border-color: var(--ct-gold-border); background: transparent; color: var(--ct-text); }
.gl-page .gl-btn--sm { min-height: 40px; padding: 6px 14px; font-size: var(--ct-fs-xs); }
.gl-page .gl-btn--sm .gl-i { width: 15px; height: 15px; }
.gl-page .gl-btn--block { width: 100%; }
.gl-page .gl-btn[disabled], .gl-page .gl-btn[aria-disabled="true"] {
  border-color: var(--ct-border-strong);
  background: var(--gl-sunk);
  color: var(--ct-text-muted);
  box-shadow: none;
  filter: none;
  cursor: not-allowed;
  transform: none;
}

.gl-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 6px; }
.gl-actions--end { justify-content: flex-end; }
.gl-actions--split { justify-content: space-between; }
.gl-actions form { margin: 0; }
.gl-link-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.gl-table .gl-cell-actions .gl-link-actions { justify-content: flex-end; }

@media (max-width: 600px) {
  .gl-actions { flex-direction: column-reverse; align-items: stretch; }
  .gl-actions .gl-btn { width: 100%; }
}

/* ============================================================
   Chips, pills, price
   ============================================================ */
.gl-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; padding: 0; list-style: none; }
.gl-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 3px 11px;
  border: 1px solid var(--ct-border);
  border-radius: 999px;
  background: var(--gl-sunk);
  color: var(--ct-text-muted);
  font-size: var(--ct-fs-xs);
  font-weight: 600;
  line-height: 1.5;
  max-width: 100%;
}
.gl-chip .gl-i { width: 13px; height: 13px; color: var(--ct-gold); }
.gl-chip a { color: var(--ct-gold); text-decoration: none; }
.gl-chip a:hover { color: var(--ct-gold-bright); }
.gl-chip--warn { border-color: rgba(var(--gl-warn-rgb), 0.5); background: rgba(var(--gl-warn-rgb), 0.12); color: var(--ct-text); }
.gl-chip--warn .gl-i { color: currentColor; }

.gl-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 12px;
  border-radius: 999px;
  border: 1px solid var(--ct-border-strong);
  background: var(--gl-sunk);
  color: var(--ct-text);
  font-size: var(--ct-fs-xs);
  font-weight: 700;
  line-height: 1.7;
  white-space: nowrap;
}
.gl-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ct-text-muted); }
.gl-pill--pending, .gl-pill--draft-review { border-color: var(--ct-gold-border); background: var(--ct-gold-soft); }
.gl-pill--pending::before { background: var(--ct-gold); box-shadow: 0 0 0 3px var(--ct-gold-soft); }
.gl-pill--changes { border-color: rgba(var(--gl-warn-rgb), 0.55); background: rgba(var(--gl-warn-rgb), 0.13); }
.gl-pill--changes::before { background: rgb(var(--gl-warn-rgb)); }
.gl-pill--fulfilled, .gl-pill--active, .gl-pill--on { border-color: rgba(var(--gl-ok-rgb), 0.5); background: rgba(var(--gl-ok-rgb), 0.12); }
.gl-pill--fulfilled::before, .gl-pill--active::before, .gl-pill--on::before { background: rgb(var(--gl-ok-rgb)); }
.gl-pill--rejected { border-color: rgba(var(--gl-bad-rgb), 0.5); background: rgba(var(--gl-bad-rgb), 0.12); }
.gl-pill--rejected::before { background: var(--ct-danger); }
.gl-pill--draft::before { background: rgb(var(--gl-info-rgb)); }
.gl-pill--cancelled, .gl-pill--ended, .gl-pill--off { color: var(--ct-text-muted); }

.gl-price {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ct-gold);
  font-weight: 800;
  font-size: var(--ct-fs-md);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.gl-price small { color: var(--ct-text-muted); font-size: var(--ct-fs-xs); font-weight: 600; }
.gl-price--sm { font-size: var(--ct-fs-sm); gap: 5px; }

/* ============================================================
   Shop directory: poster cards, the painting is the card
   ============================================================ */
/* Six tracks so a shop can take a third (default), a half or the whole row; per_row is set beside the shop order. */
.gl-posters { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; margin: 0; padding: 0; list-style: none; }
.gl-posters > li { min-width: 0; grid-column: span 2; }
.gl-posters > li[data-per-row="2"] { grid-column: span 3; }
.gl-posters > li[data-per-row="1"] { grid-column: 1 / -1; }
.gl-posters > li[data-per-row="1"] .gl-poster { aspect-ratio: 21 / 9; }
.gl-posters > li[data-per-row="1"] .gl-poster__title, .gl-posters > li[data-per-row="2"] .gl-poster__title { font-size: clamp(1.35rem, 2.2vw, 1.9rem); }

.gl-poster {
  position: relative;
  display: flex;
  align-items: flex-end;
  aspect-ratio: 16 / 9;
  width: 100%;
  border-radius: var(--ct-radius-lg);
  background: var(--gl-stage);
  box-shadow: var(--ct-shadow);
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.3s var(--gl-ease-out), box-shadow var(--ct-ease);
}
.gl-poster::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  background: linear-gradient(to top, rgba(var(--gl-photo-rgb), 0.92) 0, rgba(var(--gl-photo-rgb), 0.56) 30%, rgba(var(--gl-photo-rgb), 0) 62%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  transition: box-shadow var(--ct-ease);
  pointer-events: none;
}
.gl-poster:hover { transform: translateY(-3px); box-shadow: var(--ct-shadow-hover); }
.gl-poster:hover::after, .gl-poster:focus-within::after { box-shadow: inset 0 0 0 2px var(--gl-on-photo-gold); }
.gl-poster:active { transform: scale(0.985); }
.gl-poster__media { position: absolute; inset: 0; display: grid; place-items: center; color: var(--gl-on-photo-gold); }
.gl-poster__media > .gl-i { width: 52px; height: 52px; margin-bottom: 44px; stroke-width: 1.2; opacity: 0.7; }
.gl-poster__media:has(> img) > .gl-i { display: none; }
.gl-poster__media > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--gl-ease-out); }
.gl-poster:hover .gl-poster__media > img { transform: scale(1.04); }
/* No positioning on body or title: the title link's ::after must stretch over the whole card. */
.gl-poster__body { z-index: 2; min-width: 0; padding: 16px 20px 16px 72px; }
.gl-poster__title {
  margin: 0;
  font-family: "Lalezar", "Vazir", Tahoma, Arial, sans-serif;
  font-size: clamp(1.2rem, 1.7vw, 1.5rem);
  font-weight: 400;
  line-height: 1.4;
  color: var(--gl-on-photo);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.6);
  overflow-wrap: anywhere;
}
.gl-poster__body > * { position: relative; z-index: 2; }
.gl-poster__body > .gl-poster__title { position: static; }
.gl-poster__title a { position: relative; z-index: 2; }
.gl-page .gl-poster__title a { position: static; color: inherit; text-decoration: none; }
.gl-poster__title a::after { content: ""; position: absolute; inset: 0; z-index: 3; }
.gl-page .gl-poster__title a:focus-visible { outline: none; }
.gl-poster__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 14px; margin: 2px 0 0; color: var(--gl-on-photo-soft); font-size: 0.8125rem; font-weight: 600; }
.gl-poster__from { display: inline-flex; align-items: center; gap: 5px; color: var(--gl-on-photo-gold); font-variant-numeric: tabular-nums; }
.gl-poster__go {
  position: absolute;
  z-index: 2;
  inset-block-end: 16px;
  inset-inline-end: 16px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: rgba(var(--gl-photo-rgb), 0.55);
  color: var(--gl-on-photo);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: background var(--ct-ease), color var(--ct-ease), border-color var(--ct-ease), transform 0.25s var(--gl-ease-out);
}
.gl-poster:hover .gl-poster__go { border-color: transparent; background: var(--gl-on-photo-gold); color: rgb(var(--gl-photo-rgb)); transform: translateX(-3px); }
.gl-poster__flag,
.gl-product__tag,
.gl-product__price,
.gl-product__out {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(var(--gl-photo-rgb), 0.68);
  color: var(--gl-on-photo);
  font-weight: 700;
  line-height: 1.5;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.gl-poster__flag { position: absolute; z-index: 2; inset-block-start: 14px; inset-inline-start: 14px; padding: 3px 12px; font-size: 0.8125rem; color: var(--gl-on-photo-gold); }
.gl-poster.is-soon .gl-poster__media > img { filter: saturate(0.72) brightness(0.86); }

@media (max-width: 960px) {
  .gl-posters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .gl-posters > li, .gl-posters > li[data-per-row="2"] { grid-column: span 1; }
}
@media (max-width: 600px) {
  .gl-posters { grid-template-columns: minmax(0, 1fr); }
  .gl-posters > li, .gl-posters > li[data-per-row] { grid-column: 1 / -1; }
  .gl-posters > li[data-per-row="1"] .gl-poster { aspect-ratio: 16 / 9; }
  .gl-poster__title { font-size: 1.3rem; }
  .gl-poster__body { padding: 14px 16px 14px 66px; }
  .gl-poster__go { inset-block-end: 14px; inset-inline-end: 14px; }
}

/* ============================================================
   Storefront: filter bar and shelf of image-led product cards
   ============================================================ */
.gl-catalogue { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
/* Long shop stories stay one tap away so the shelf starts near the top. */
.gl-shelf-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
  padding: 12px 18px;
  border: 1px solid var(--ct-border);
  border-radius: var(--ct-radius);
  background: var(--ct-glass-bg);
  -webkit-backdrop-filter: blur(var(--ct-glass-blur));
  backdrop-filter: blur(var(--ct-glass-blur));
}
.gl-shelf-bar[hidden] { display: none; }
.gl-shelf-bar + .gl-shelf--more { margin-top: 14px; }
.gl-filter { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; flex: 1 1 420px; margin: 0; }
.gl-filter__search { position: relative; flex: 1 1 200px; max-width: 320px; }
.gl-filter__search .gl-i { position: absolute; inset-block-start: 50%; inset-inline-start: 13px; width: 17px; height: 17px; color: var(--ct-text-muted); transform: translateY(-50%); pointer-events: none; }
.gl-page .gl-filter__search .ct-input { width: 100%; min-height: 44px; padding-inline-start: 38px; }
.gl-page .gl-filter__sort { flex: 0 1 170px; width: auto; min-height: 44px; }
.gl-filter__switch { flex: 0 0 auto; min-height: 44px; padding-block: 6px; }

.gl-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(214px, 1fr)); gap: 16px; margin: 0; padding: 0; list-style: none; }
.gl-shelf > li { min-width: 0; }
.gl-shelf > li[hidden], .gl-shelf[hidden] { display: none; }
.gl-shelf--more { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Category headings sit above the same full-width product grid used by shops without categories. */
.gl-groups { display: flex; flex-direction: column; gap: 22px; }
.gl-groups[hidden], .gl-group[hidden] { display: none; }
.gl-group {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.gl-group__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 18px;
  padding: 16px 22px;
  border: 1px solid var(--ct-gold-border);
  border-radius: calc(var(--ct-radius) + 6px);
  background:
    radial-gradient(120% 90% at 100% 0%, var(--ct-gold-soft), transparent 55%),
    radial-gradient(90% 80% at 0% 100%, var(--ct-purple-glow), transparent 60%),
    var(--ct-glass-bg);
  -webkit-backdrop-filter: blur(var(--ct-glass-blur));
  backdrop-filter: blur(var(--ct-glass-blur));
  box-shadow: 0 18px 40px rgba(var(--gl-photo-rgb), 0.28);
}
.gl-group__text { min-width: 0; }
.gl-group__title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: "Lalezar", "Vazir", Tahoma, Arial, sans-serif;
  font-size: var(--ct-fs-lg);
  font-weight: 400;
  line-height: 1.4;
  color: var(--ct-text);
}
.gl-group__title::before { content: ""; flex: 0 0 auto; width: 4px; height: 26px; border-radius: 4px; background: linear-gradient(180deg, var(--ct-gold) 0%, var(--ct-purple-accent) 100%); }
.gl-group__desc { margin: 6px 14px 0 0; color: var(--ct-text-muted); font-size: var(--ct-fs-sm); line-height: 1.8; }
.gl-group__head .gl-count { flex: 0 0 auto; }
@media (max-width: 600px) {
  .gl-groups { gap: 16px; }
  .gl-group { gap: 14px; }
  .gl-group__head { padding: 14px; }
}

.gl-product {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--ct-border);
  border-radius: var(--ct-radius-lg);
  /* Nearly solid so names and prices stay readable over the busy shop backdrop (less glass than other cards). */
  background: rgba(var(--theme-color-surface-rgb), 0.94);
  -webkit-backdrop-filter: blur(var(--ct-glass-blur));
  backdrop-filter: blur(var(--ct-glass-blur));
  box-shadow: var(--ct-shadow);
  overflow: hidden;
  transition: transform 0.3s var(--gl-ease-out), box-shadow var(--ct-ease), border-color var(--ct-ease);
}
.gl-product:not(.is-out):hover { transform: translateY(-3px); border-color: var(--ct-gold-border); box-shadow: var(--ct-shadow-hover); }
.gl-product:not(.is-out):active { transform: scale(0.985); }
.gl-product:focus-within { border-color: var(--ct-gold); box-shadow: 0 0 0 2px var(--ct-gold); }

.gl-product__media {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  perspective: 1000px;
  background: var(--gl-stage);
  color: var(--gl-on-photo-gold);
  overflow: hidden;
}
.gl-product__flipper { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform 380ms var(--gl-ease-out); }
.gl-product__media.is-flipped { z-index: 2; }
.gl-product__media.is-flipped .gl-product__flipper { transform: rotateY(180deg); }
.gl-product__front, .gl-product__back { position: absolute; inset: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.gl-product__front { display: grid; place-items: center; }
.gl-product__front > .gl-i, .gl-product__media > .gl-i { width: 34%; height: 34%; stroke-width: 1; opacity: 0.6; }
.gl-product__front:has(> img) > .gl-i, .gl-product__media:has(> img) > .gl-i { display: none; }
.gl-product__front > img, .gl-product__media > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: transform 0.6s var(--gl-ease-out); }
.gl-product:not(.is-out):hover .gl-product__front > img, .gl-product:not(.is-out):hover .gl-product__media > img { transform: scale(1.05); }
.gl-product.is-out .gl-product__front > img, .gl-product.is-out .gl-product__media > img { filter: grayscale(0.85) brightness(0.72); }
.gl-product__back { box-sizing: border-box; display: flex; flex-direction: column; gap: 8px; padding: 18px; transform: rotateY(180deg); overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.18); background: radial-gradient(circle at 50% 0, rgba(var(--theme-color-accent-rgb), 0.2), transparent 58%), var(--gl-stage); color: var(--gl-on-photo); text-align: start; }
.gl-product__back:focus-visible { outline: 2px solid var(--gl-on-photo-gold); outline-offset: -4px; }
.gl-product__back-label { display: flex; align-items: center; justify-content: space-between; color: var(--gl-on-photo-gold); font-size: 0.75rem; font-weight: 800; }
.gl-product__back-scroll { display: none; width: 15px; height: 15px; }
.gl-product__back.is-scrollable .gl-product__back-scroll { display: block; }
.gl-product__back-name { font-family: "Lalezar", "Vazir", Tahoma, Arial, sans-serif; font-size: 1.25rem; font-weight: 400; line-height: 1.3; }
.gl-product__back-text { margin: 0; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--gl-on-photo-gold) transparent; color: var(--gl-on-photo); font-size: 0.875rem; line-height: 1.7; overflow-wrap: anywhere; }
.gl-product__back.is-scrollable:not(.is-at-end) .gl-product__back-text { mask-image: linear-gradient(to bottom, #000 calc(100% - 18px), transparent); }
.gl-product__back-text:focus-visible { outline: 2px solid var(--gl-on-photo-gold); outline-offset: -2px; }
.gl-product__back-meta { display: flex; flex-wrap: wrap; flex: 0 0 auto; gap: 5px 10px; margin-top: auto; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, 0.2); color: var(--gl-on-photo-soft); font-size: 0.75rem; font-weight: 700; }
.gl-product__back-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.gl-product__back-meta .gl-i { width: 13px; height: 13px; }
.gl-product__back-meta .gl-coin { width: 13px; height: 13px; }

.gl-product__tag { position: absolute; inset-block-start: 10px; inset-inline-start: 10px; max-width: calc(100% - 20px); padding: 2px 10px 2px 9px; font-size: 0.75rem; font-weight: 600; }
.gl-product__tag .gl-i { width: 13px; height: 13px; color: var(--gl-on-photo-gold); }
.gl-product__price {
  position: absolute;
  inset-block-end: 10px;
  inset-inline-end: 10px;
  padding: 4px 12px 4px 8px;
  color: var(--gl-on-photo-gold);
  font-size: 1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.gl-product__out { position: absolute; inset-block-start: 50%; inset-inline-start: 50%; padding: 4px 14px; font-size: 0.8125rem; transform: translate(50%, -50%); }

.gl-product__body { display: flex; flex-direction: column; gap: 8px; flex: 1; padding: 14px; }
.gl-product__title { margin: 0; font-family: "Lalezar", "Vazir", Tahoma, Arial, sans-serif; font-size: 1.125rem; font-weight: 400; line-height: 1.45; color: var(--ct-text); overflow-wrap: anywhere; }
.gl-page .gl-product__title a { color: inherit; text-decoration: none; }
.gl-product__title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.gl-page .gl-product__title a:focus-visible { outline: none; }
.gl-product__text { margin: 0; color: var(--ct-text-muted); font-size: 0.875rem; line-height: 1.75; overflow-wrap: anywhere; }
.gl-product__actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.gl-product__actions.has-details { grid-template-columns: auto minmax(0, 1fr); }
.gl-product__actions.has-details:has(> .gl-product__details[hidden]) { grid-template-columns: minmax(0, 1fr); }
.gl-product__details { position: relative; z-index: 2; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 94px; min-height: 44px; padding: 7px 10px; border: 1px solid var(--ct-gold-border); border-radius: var(--ct-radius-sm); background: var(--ct-gold-soft); color: var(--gl-gold-text); font: inherit; font-size: 0.8125rem; font-weight: 700; cursor: pointer; touch-action: manipulation; transition: border-color 200ms, background 200ms; }
.gl-product__details[hidden] { display: none; }
/* Renew / repair for a copy the member already owns: full row under the buy row, price after a divider. */
.gl-product__actions > .gl-product__service { position: relative; z-index: 2; grid-column: 1 / -1; margin: 0; }
/* With no buy button the renewal takes the buy slot beside the description button. */
.gl-product__actions > .gl-product__details + .gl-product__service { grid-column: auto; padding-inline: 10px; }
/* Never wider than the card: the label shrinks with an ellipsis, the price stays whole. */
.gl-product__actions > .gl-product__service { min-width: 0; max-width: 100%; }
.gl-product__service-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gl-product__service-price { flex-shrink: 0; }
/* Out of stock / already owned: the reason wraps inside the card instead of running past its edge. */
.gl-page .gl-product__blocked { min-width: 0; padding: 7px 12px; border-radius: var(--ct-radius-sm); font-size: var(--ct-fs-xs); line-height: 1.4; text-align: center; white-space: normal; overflow-wrap: anywhere; cursor: not-allowed; }
.gl-product__service .gl-btn, form.gl-product__service > .gl-btn { min-width: 0; max-width: 100%; }
.gl-product__service-price { display: inline-flex; align-items: center; gap: 4px; padding-inline-start: 8px; border-inline-start: 1px solid color-mix(in srgb, currentColor 35%, transparent); font-variant-numeric: tabular-nums; }
.gl-product__service-price .gl-coin { width: 14px; height: 14px; }
/* Owner-written descriptions may carry XOOPS codes ([img], [url], [center]). */
.gl-page :is(.gl-story__text, .gl-product__back-text, .gl-product__text, .gl-buy__desc, .gl-group__desc, .gl-effect__desc, .gl-prose) img { max-width: 100%; height: auto; }
.gl-page .gl-product__back-text a { color: var(--gl-on-photo-gold); }
.gl-product__details .gl-i { width: 15px; height: 15px; }
.gl-product__details:hover { border-color: var(--ct-gold); background: rgba(var(--theme-color-accent-rgb), 0.23); }
.gl-product__details:focus-visible { outline: 2px solid var(--ct-gold); outline-offset: 3px; }
.gl-facts { display: flex; flex-wrap: wrap; gap: 3px 12px; margin: 0; padding: 0; list-style: none; color: var(--ct-text-muted); font-size: 0.75rem; font-weight: 600; line-height: 1.6; }
.gl-facts li { display: inline-flex; align-items: center; gap: 4px; }
.gl-facts .gl-i { width: 13px; height: 13px; color: var(--ct-gold); }
.gl-product__buy { display: flex; flex-direction: column; gap: 6px; margin-top: auto; padding-top: 4px; }
.gl-product__hint { margin: 0; color: var(--ct-text-muted); font-size: 0.75rem; line-height: 1.5; text-align: center; }
.gl-product--mini .gl-product__body { padding: 10px 12px 12px; }
.gl-product--mini .gl-product__title { font-size: 1rem; }

@media (prefers-reduced-motion: no-preference) {
  .gl-posters > li, .gl-shelf:not(.gl-shelf--more) > li { animation: gl-rise 0.45s var(--gl-ease-out) both; }
  .gl-posters > li:nth-child(2), .gl-shelf > li:nth-child(2) { animation-delay: 0.04s; }
  .gl-posters > li:nth-child(3), .gl-shelf > li:nth-child(3) { animation-delay: 0.08s; }
  .gl-posters > li:nth-child(4), .gl-shelf > li:nth-child(4) { animation-delay: 0.12s; }
  .gl-posters > li:nth-child(n+5), .gl-shelf > li:nth-child(n+5) { animation-delay: 0.16s; }
}
/* Entrance is for the first paint only; filtering should not replay it. */
.gl-shelf[data-gl-filtered] > li { animation: none; }
@keyframes gl-rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
.gl-prose { color: var(--ct-text); line-height: 2; overflow-wrap: anywhere; }
.gl-prose p { margin: 0 0 10px; }
.gl-prose p:last-child { margin-bottom: 0; }

/* Phones: two cards a row keep the pictures big and the shelf short. */
@media (max-width: 600px) {
  .gl-shelf, .gl-shelf--more { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .gl-shelf-bar { padding: 12px; }
  .gl-filter { flex-basis: 100%; }
  .gl-filter__search { flex-basis: 100%; max-width: none; }
  .gl-page .gl-filter__sort { flex: 1 1 0; min-width: 0; }
  .gl-filter__switch { flex: 0 0 auto; padding-inline: 10px; gap: 8px; white-space: nowrap; }
  .gl-product { border-radius: var(--ct-radius); }
  .gl-product__body { padding: 10px; gap: 6px; }
  .gl-product__title { font-size: 1rem; }
  .gl-product__text { font-size: 1rem; }
  .gl-product__back { padding: 12px; }
  .gl-product__back-name { display: none; }
  .gl-product__back-name { font-size: 1.125rem; }
  .gl-product__back-text { font-size: 0.875rem; }
  .gl-product__details { min-width: 84px; padding-inline: 7px; font-size: 0.75rem; }
  .gl-product__tag { inset-block-start: 7px; inset-inline-start: 7px; padding: 1px 8px 1px 7px; font-size: 0.6875rem; }
  .gl-product__price { inset-block-end: 7px; inset-inline-end: 7px; padding: 2px 10px 2px 6px; font-size: 0.9375rem; }
  .gl-page .gl-product__buy .gl-btn { padding-inline: 8px; }
}
@media (max-width: 480px) {
  .gl-shelf, .gl-shelf--more { grid-template-columns: minmax(0, 1fr); }
}

/* ============================================================
   Product page: picture and facts beside the order form
   ============================================================ */
.gl-buy { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: var(--gl-gap); align-items: start; scroll-margin-top: 96px; }
.gl-page .ct-card.gl-buy__product { padding: 0; overflow: hidden; }
@media (min-width: 721px) { .gl-buy__product { position: sticky; top: 96px; } }
.gl-buy__media { width: 100%; }
.gl-buy__info { display: flex; flex-direction: column; gap: 12px; padding: 18px 22px 22px; }
.gl-buy__name { margin: 0; font-family: "Lalezar", "Vazir", Tahoma, Arial, sans-serif; font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 400; line-height: 1.35; color: var(--ct-text); overflow-wrap: anywhere; }
.gl-buy__price { margin: 0; font-size: 1.375rem; }
.gl-buy__desc { margin: 0; color: var(--ct-text-muted); font-size: 0.9375rem; line-height: 1.9; overflow-wrap: anywhere; }
.gl-receipt { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border: 1px solid var(--ct-gold-border); border-radius: var(--ct-radius); background: var(--gl-sunk); }
.gl-receipt__total { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; color: var(--ct-text); font-weight: 700; }
.gl-price--total { margin: 0; font-size: 1.375rem; }
/* The breadcrumb holds the way back on wide screens; phones get a real button instead. */
.gl-page .gl-back-link { display: none; }
@media (max-width: 720px) {
  .gl-buy { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .gl-page--directory .gl-hero__sub { display: none; }
  .gl-page .gl-back-link { display: inline-flex; align-self: flex-start; width: fit-content; }
  .gl-buy__info { padding: 14px 16px 18px; }
}

/* Order page and owned items: the product picture beside its details. */
.gl-order-item, .gl-owned { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 20px; align-items: start; }
.gl-order-item__media, .gl-owned > .gl-product__media { border-radius: var(--ct-radius); }
.gl-order-item__body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.gl-order-item__body .gl-head { margin: 0; }
.gl-owned > .gl-stack .gl-head { margin: 0; }
@media (max-width: 600px) {
  .gl-order-item, .gl-owned { grid-template-columns: minmax(0, 1fr); }
  .gl-order-item__media, .gl-owned > .gl-product__media { width: 148px; }
}

/* Shop intro (owner management) */
.gl-intro { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.gl-intro--plain { grid-template-columns: minmax(0, 1fr); }
.gl-intro__media { border-radius: var(--ct-radius); overflow: hidden; border: 1px solid var(--ct-border); aspect-ratio: 4 / 3; background: var(--gl-sunk); }
.gl-intro__media img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 720px) {
  .gl-intro { grid-template-columns: minmax(0, 1fr); }
  .gl-intro__media { max-height: 220px; aspect-ratio: auto; }
}

/* ============================================================
   Order summary rows (checkout receipt, order page)
   ============================================================ */
.gl-summary { display: flex; flex-direction: column; gap: 14px; }
.gl-rows { display: flex; flex-direction: column; margin: 0; padding: 0; }
.gl-rows > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--ct-border-strong);
  font-size: var(--ct-fs-sm);
}
.gl-rows > div:last-child { border-bottom: 0; }
.gl-rows dt { margin: 0; color: var(--ct-text-muted); font-weight: 600; }
.gl-rows dd { margin: 0; color: var(--ct-text); font-weight: 700; text-align: left; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.gl-rows .is-total { padding-top: 14px; border-top: 1px solid var(--ct-border-strong); border-bottom: 0; }
.gl-rows .is-negative dd { color: var(--ct-danger); }
.gl-receipt .gl-rows { padding-top: 6px; border-top: 1px solid var(--ct-border); }
.gl-receipt .gl-rows > div { padding: 7px 0; }
.gl-receipt .gl-rows .is-total { border-top: 0; }

/* ============================================================
   Forms
   ============================================================ */
.gl-form { display: flex; flex-direction: column; gap: 18px; }
.gl-form .ct-textarea { min-height: 110px; }
.gl-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.gl-fields--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gl-fields > .is-wide { grid-column: 1 / -1; }
@media (max-width: 720px) { .gl-fields, .gl-fields--3 { grid-template-columns: minmax(0, 1fr); } }

.gl-fieldset {
  margin: 0;
  padding: 20px;
  min-width: 0;
  border: 1px solid var(--ct-border);
  border-radius: var(--ct-radius);
  background: rgba(var(--theme-color-surface-2-rgb), 0.18);
}
.gl-fieldset > legend {
  float: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  margin: 0;
  padding: 0 8px;
  color: var(--ct-gold);
  font-size: var(--ct-fs-base);
  font-weight: 700;
}
.gl-fieldset > legend .gl-i { width: 18px; height: 18px; }
.gl-fieldset__desc { margin: 0 0 16px; color: var(--ct-text-muted); font-size: var(--ct-fs-sm); line-height: 1.8; }

.gl-help { margin: 0; color: var(--ct-text-muted); font-size: var(--ct-fs-xs); line-height: 1.75; }
.gl-inline { display: flex; gap: 8px; align-items: stretch; }
.gl-inline .ct-input { flex: 1; min-width: 0; }
@media (max-width: 600px) { .gl-inline { flex-wrap: wrap; } .gl-inline .gl-btn { flex: 1; } }

.gl-step { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: start; }
.gl-step__num {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-top: 26px;
  border-radius: 50%;
  border: 1px solid var(--ct-gold-border);
  background: var(--ct-gold-soft);
  color: var(--ct-gold);
  font-weight: 800;
  font-size: var(--ct-fs-sm);
}

/* Toggle switch (native checkbox kept, restyled) */
.gl-switches { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.gl-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--ct-border-strong);
  border-radius: var(--ct-radius-sm);
  background: var(--ct-input-bg);
  color: var(--ct-text);
  font-size: var(--ct-fs-sm);
  font-weight: 600;
  line-height: 1.6;
  cursor: pointer;
  transition: border-color var(--ct-ease), background var(--ct-ease);
}
.gl-switch:hover { border-color: var(--ct-gold-border); }
.gl-switch:has(input:checked) { border-color: var(--ct-gold-border); background: linear-gradient(135deg, var(--ct-gold-soft), transparent 80%), var(--ct-input-bg); }
.gl-switch input {
  appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 38px;
  height: 22px;
  margin: 0;
  border-radius: 999px;
  background: var(--ct-border-strong);
  cursor: pointer;
  transition: background var(--ct-ease);
}
.gl-switch input::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--theme-color-white);
  box-shadow: 0 1px 3px rgba(var(--theme-color-text-rgb), 0.3);
  transition: transform 0.2s var(--gl-ease-out);
}
.gl-switch input:checked { background: var(--ct-gold); }
.gl-switch input:checked::after { transform: translateX(-16px); }
.gl-switch input:focus-visible { outline: 2px solid var(--ct-gold); outline-offset: 2px; }

/* User picker (profile/ajax_user_search.php JSON) */
.gl-picker { position: relative; display: block; width: 100%; margin-top: 6px; }
.gl-picker .ct-input { width: 100%; }
[data-user-picker] > .ct-field__label { display: block; }
.gl-form__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.gl-picker__list {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 290px;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  list-style: none;
  border: 1px solid var(--ct-gold-border);
  border-radius: var(--ct-radius-sm);
  background: rgb(var(--theme-color-surface-rgb));
  box-shadow: var(--ct-shadow-hover);
}
.gl-picker__list[hidden] { display: none; }
.gl-picker__opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ct-text);
  font: inherit;
  font-size: var(--ct-fs-sm);
  text-align: right;
  cursor: pointer;
}
.gl-picker__opt:hover, .gl-picker__opt:focus-visible { background: var(--ct-gold-soft); outline: none; }
.gl-picker__opt img { flex: none; width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: var(--gl-sunk); }
[data-user-chosen] img { width: 24px; height: 24px; margin-inline-end: 6px; border-radius: 50%; object-fit: cover; vertical-align: middle; background: var(--gl-sunk); }
.gl-picker__opt small { color: var(--ct-text-muted); direction: ltr; }
.gl-picker__empty { padding: 10px; color: var(--ct-text-muted); font-size: var(--ct-fs-sm); }
.gl-picker__chosen { display: none; width: fit-content; }
[data-gl-picker].has-choice .gl-picker__chosen { display: inline-flex; }
.gl-page .ct-card:has(.gl-picker__list:not([hidden])) { overflow: visible; z-index: 5; }

.gl-image-field { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; align-items: center; }
.gl-image-field__preview {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border: 1px dashed var(--ct-border-strong);
  border-radius: var(--ct-radius-sm);
  background: var(--ct-input-bg);
  overflow: hidden;
}
.gl-image-field__preview { position: relative; }
.gl-image-field__preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--ct-input-bg); }
.gl-image-field__preview .gl-i { width: 26px; height: 26px; color: var(--ct-text-faint); }
.gl-image-field__preview img[src=""] { display: none; }

/* ============================================================
   Alerts and controller messages
   ============================================================ */
.gl-alert,
.gl-page .errorMsg,
.gl-page .successMsg,
.gl-page .resultMsg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 13px 16px;
  border: 1px solid var(--ct-border-strong);
  border-inline-start-width: 4px;
  border-radius: var(--ct-radius-sm);
  background: var(--gl-sunk);
  color: var(--ct-text);
  font-size: var(--ct-fs-sm);
  line-height: 1.8;
}
.gl-alert .gl-i { width: 19px; height: 19px; margin-top: 3px; }
.gl-alert strong { display: block; }
.gl-alert--error, .gl-page .errorMsg { border-color: rgba(var(--gl-bad-rgb), 0.55); background: rgba(var(--gl-bad-rgb), 0.11); }
.gl-alert--error .gl-i { color: var(--ct-danger); }
.gl-alert--success, .gl-page .successMsg { border-color: rgba(var(--gl-ok-rgb), 0.55); background: rgba(var(--gl-ok-rgb), 0.11); }
.gl-alert--success .gl-i { color: rgb(var(--gl-ok-rgb)); }
.gl-alert--info, .gl-page .resultMsg { border-color: var(--ct-gold-border); background: var(--ct-gold-soft); }
.gl-alert--info .gl-i { color: var(--ct-gold); }
.gl-alert--warn { border-color: rgba(var(--gl-warn-rgb), 0.55); background: rgba(var(--gl-warn-rgb), 0.11); }
.gl-messages { display: flex; flex-direction: column; gap: 10px; }
.gl-messages:empty { display: none; }

/* ============================================================
   Tables (floating rows, cards when the content area is narrow)
   ============================================================ */
.gl-table-wrap { min-width: 0; max-width: 100%; overflow-x: auto; container: galleon-list / inline-size; }
.gl-table { width: 100%; border-collapse: separate; border-spacing: 0 8px; font-size: var(--ct-fs-sm); }
.gl-table th { padding: 4px 14px 6px; color: var(--ct-text-muted); font-weight: 600; text-align: right; background: none; border: 0; }
.gl-table td { min-width: 0; overflow-wrap: anywhere; }
.gl-table td {
  padding: 12px 14px;
  background: var(--gl-sunk);
  border-top: 1px solid var(--ct-border);
  border-bottom: 1px solid var(--ct-border);
  vertical-align: middle;
  color: var(--ct-text);
}
.gl-table td:first-child { border-right: 1px solid var(--ct-border); border-radius: 0 var(--ct-radius-sm) var(--ct-radius-sm) 0; }
.gl-table td:last-child { border-left: 1px solid var(--ct-border); border-radius: var(--ct-radius-sm) 0 0 var(--ct-radius-sm); }
.gl-table tbody tr { position: relative; }
.gl-table tbody tr:hover td { border-color: var(--ct-gold-border); }
.gl-table .gl-c { text-align: center; }
.gl-table .gl-muted { color: var(--ct-text-muted); }
.gl-table .gl-num { color: var(--ct-text-muted); font-variant-numeric: tabular-nums; width: 1%; white-space: nowrap; }
.gl-table .gl-end { text-align: left; }
.gl-table .gl-cell-main { width: 28%; min-width: 14rem; }
.gl-table .gl-cell-state { min-width: 7rem; }
.gl-table .gl-cell-actions { width: 36%; }
.gl-table input[type="number"] { width: 5.5rem; max-width: 100%; min-width: 0; }
.gl-table .gl-num:has(form) { width: 12rem; white-space: normal; }
.gl-table .gl-btn { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.gl-table .gl-pill, .gl-table .gl-chip { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.gl-page .gl-row-link { color: var(--ct-gold); font-weight: 700; text-decoration: none; overflow-wrap: anywhere; }
.gl-page .gl-row-link:hover { color: var(--ct-gold-bright); }
.gl-page .gl-row-link--stretch::after { content: ""; position: absolute; inset: 0; }
.gl-page .gl-row-link:focus-visible { outline: 2px solid var(--ct-gold); outline-offset: 3px; border-radius: 4px; }
.gl-table a:not(.gl-row-link--stretch), .gl-table button, .gl-table form { position: relative; z-index: 1; }
.gl-table td.gl-empty-cell { padding: 0; text-align: center; border: 1px dashed var(--ct-border-strong); border-radius: var(--ct-radius-sm); background: transparent; }
.gl-table td.gl-empty-cell .gl-empty { padding: 22px 12px; }
.gl-table:has(.gl-empty-cell) thead { display: none; }
.gl-cell-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.gl-cell-title > span:not(.gl-thumb) { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gl-cell-title small { color: var(--ct-text-muted); font-size: var(--ct-fs-xs); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.gl-thumb {
  position: relative;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--ct-border);
  background: var(--ct-input-bg);
  overflow: hidden;
  flex-shrink: 0;
}
.gl-thumb:has(> img) { background: var(--gl-stage); }
.gl-thumb:has(> img) > .gl-i { display: none; }
.gl-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.gl-thumb .gl-i { width: 19px; height: 19px; color: var(--ct-gold); }

@container galleon-list (max-width: 900px) {
  .gl-table, .gl-table tbody, .gl-table tr, .gl-table td { display: block; width: 100%; }
  .gl-table td { width: auto; }
  .gl-table thead { display: none; }
  .gl-table tbody { display: flex; flex-direction: column; gap: 10px; }
  .gl-table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
    padding: 14px 16px;
    background: var(--gl-sunk);
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius);
  }
  .gl-table td,
  .gl-table td:first-child,
  .gl-table td:last-child { padding: 0; border: 0; border-radius: 0; background: none; text-align: right; }
  .gl-table td:first-child { grid-column: 1 / -1; }
  .gl-table td.gl-cell-main { grid-column: 1 / -1; grid-row: 1; width: auto; min-width: 0; font-size: var(--ct-fs-base); }
  .gl-table td.gl-cell-state { min-width: 0; align-self: start; }
  .gl-table td.gl-cell-actions { grid-column: 1 / -1; width: auto; padding-top: 8px; border-top: 1px solid var(--ct-border); }
  .gl-table .gl-cell-actions .gl-link-actions { flex-wrap: wrap; justify-content: flex-start; }
  .gl-table td[data-label]::before { content: attr(data-label) ": "; color: var(--ct-text-faint); }
  .gl-table td.gl-num { display: none; }
  .gl-table td.gl-num:has(form) { display: block; grid-column: 1 / -1; }
  .gl-table td:empty { display: none; }
  .gl-table tr:has(.gl-empty-cell) { display: block; padding: 0; border: 0; background: none; }
}

/* ============================================================
   Empty states, stats, details
   ============================================================ */
.gl-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 34px 12px;
  text-align: center;
  color: var(--ct-text-muted);
  font-size: var(--ct-fs-sm);
}
.gl-empty .gl-i { width: 42px; height: 42px; stroke-width: 1.5; color: var(--ct-gold); opacity: 0.7; }
.gl-empty strong { color: var(--ct-text); font-size: var(--ct-fs-base); }

.gl-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.gl-stat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--ct-border);
  border-radius: var(--ct-radius);
  background: var(--gl-sunk);
}
.gl-stat__icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--ct-gold-soft); color: var(--ct-gold); }
.gl-stat__icon .gl-i { width: 21px; height: 21px; }
.gl-stat__label { display: block; color: var(--ct-text-muted); font-size: var(--ct-fs-xs); }
.gl-stat__value { display: block; color: var(--ct-text); font-size: var(--ct-fs-lg); font-weight: 800; line-height: 1.3; font-variant-numeric: tabular-nums; }

.gl-split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--gl-gap); align-items: start; }
.gl-split > * { min-width: 0; }
.gl-stack { display: flex; flex-direction: column; gap: var(--gl-gap); min-width: 0; }
@media (max-width: 900px) { .gl-split { grid-template-columns: minmax(0, 1fr); } }

.gl-quote {
  margin: 0;
  padding: 14px 18px;
  border: 1px solid var(--ct-border);
  border-inline-start: 3px solid var(--ct-gold);
  border-radius: var(--ct-radius-sm);
  background: var(--gl-sunk);
  color: var(--ct-text);
  font-size: var(--ct-fs-sm);
  line-height: 1.95;
  overflow-wrap: anywhere;
}
.gl-quote__label { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; color: var(--ct-gold); font-size: var(--ct-fs-xs); font-weight: 700; }
.gl-quote__label .gl-i { width: 14px; height: 14px; }
.gl-quote--staff { border-inline-start-color: var(--ct-purple-accent); background: linear-gradient(135deg, var(--ct-purple-glow), transparent 70%), var(--gl-sunk); }
.gl-quote--staff .gl-quote__label { color: var(--ct-text); }

.gl-answers { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; counter-reset: gl-step; }
.gl-answers li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--ct-border);
  border-radius: var(--ct-radius-sm);
  background: var(--gl-sunk);
  counter-increment: gl-step;
}
.gl-answers li::before {
  content: counter(gl-step, persian);
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--ct-gold-soft);
  color: var(--ct-gold);
  font-weight: 800;
  font-size: var(--ct-fs-sm);
}
.gl-answers strong { display: block; margin-bottom: 4px; color: var(--ct-text-muted); font-size: var(--ct-fs-sm); }
.gl-answers p { margin: 0; line-height: 1.9; overflow-wrap: anywhere; }

.gl-people { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.gl-people li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--ct-border);
  border-radius: var(--ct-radius-sm);
  background: var(--gl-sunk);
  font-size: var(--ct-fs-sm);
}
.gl-people .gl-i { width: 16px; height: 16px; color: var(--ct-gold); }
.gl-people span { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }

.gl-tech { border: 1px solid var(--ct-border); border-radius: var(--ct-radius-sm); background: var(--gl-sunk); }
.gl-tech > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 10px 16px;
  color: var(--ct-text-muted);
  font-size: var(--ct-fs-sm);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.gl-tech > summary::-webkit-details-marker { display: none; }
.gl-tech > summary .gl-i { transition: transform 0.25s var(--gl-ease-out); }
.gl-tech[open] > summary .gl-i { transform: rotate(180deg); }
.gl-tech > summary:focus-visible { outline: 2px solid var(--ct-gold); outline-offset: 2px; border-radius: var(--ct-radius-sm); }
.gl-tech__body { padding: 0 16px 14px; }
.gl-tech dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: var(--ct-fs-xs); }
.gl-tech dt { color: var(--ct-text-faint); direction: ltr; text-align: right; }
.gl-tech dd { margin: 0; color: var(--ct-text); overflow-wrap: anywhere; }

/* ============================================================
   Effects
   ============================================================ */
.gl-effects { display: flex; flex-direction: column; gap: 16px; margin: 0; padding: 0; list-style: none; }
.gl-effect { display: flex; flex-direction: column; gap: 14px; }
.gl-effect.is-ended { opacity: 0.88; }
.gl-effect.is-waiting { border-color: var(--ct-gold-border); }
.gl-effect__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.gl-effect__title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.gl-effect__title h2 {
  margin: 0;
  font-family: "Lalezar", "Vazir", Tahoma, sans-serif;
  font-size: var(--ct-fs-md);
  font-weight: 400;
  line-height: 1.45;
  color: var(--ct-text);
  overflow-wrap: anywhere;
}
.gl-effect__title small { display: block; color: var(--ct-text-muted); font-size: var(--ct-fs-xs); }
.gl-effect__desc { margin: 0; color: var(--ct-text-muted); font-size: var(--ct-fs-sm); line-height: 1.9; overflow-wrap: anywhere; }
.gl-effect__forms { display: flex; flex-direction: column; gap: 12px; padding-top: 14px; border-top: 1px solid var(--ct-border); }
.gl-effect__forms form { display: flex; flex-direction: column; gap: 12px; margin: 0; }

/* ============================================================
   Pager
   ============================================================ */
.gl-pager { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 4px; }
.gl-pager:empty { display: none; }

/* ============================================================
   Confirm screen
   ============================================================ */
.gl-confirm { display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 520px; margin: 0 auto; padding: 10px 0; text-align: center; }
.gl-confirm__icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: rgba(var(--gl-bad-rgb), 0.12); border: 1px solid rgba(var(--gl-bad-rgb), 0.45); color: var(--ct-danger); }
.gl-confirm__icon .gl-i { width: 30px; height: 30px; }
.gl-confirm h2 { margin: 0; font-family: "Lalezar", "Vazir", Tahoma, sans-serif; font-size: var(--ct-fs-lg); font-weight: 400; }
.gl-confirm p { margin: 0; color: var(--ct-text-muted); line-height: 1.9; }
.gl-confirm .gl-actions { justify-content: center; }

@media (max-width: 600px) {
  .gl-page { padding-top: 0; --gl-gap: 14px; }
  .gl-page .ct-card { padding: 20px 16px; }
  .gl-hero__title { font-size: var(--ct-fs-lg); }
  .gl-hero__icon { width: 48px; height: 48px; border-radius: 15px; }
  .gl-crumbs [aria-current] { max-width: 24ch; }
  .gl-fieldset { padding: 16px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .gl-poster, .gl-poster__media img, .gl-poster__go, .gl-product, .gl-product__media img, .gl-product__front img, .gl-product__flipper, .gl-product__details, .gl-page .gl-btn, .gl-page .gl-tab, .gl-tech > summary .gl-i { transition: none; }
  .gl-poster:hover, .gl-poster:active, .gl-product:not(.is-out):hover, .gl-product:not(.is-out):active { transform: none; }
  .gl-poster:hover .gl-poster__media > img, .gl-product:not(.is-out):hover .gl-product__media > img, .gl-product:not(.is-out):hover .gl-product__front > img { transform: none; }
}

/* Readable small text and a clear keyboard focus across Galleon pages. */
.gl-page { --ct-fs-xs: 0.75rem; }
.gl-page a:focus-visible, .gl-page button:focus-visible, .gl-page summary:focus-visible { outline: 2px solid var(--ct-gold); outline-offset: 2px; }
@media (max-width: 767.98px) {
  .gl-page .gl-tab { min-height: 44px; }
  .gl-page .gl-btn { min-height: 44px; }
}

/* Old-style "label wrapping a field" forms line up with the rest of the module. */
.gl-page .gl-form > p { margin: 0; }
.gl-page .gl-form label.ct-field__label { display: block; }
.gl-page .gl-form label.ct-field__label > .ct-input,
.gl-page .gl-form label.ct-field__label > .ct-select,
.gl-page .gl-form label.ct-field__label > .ct-textarea { display: block; width: 100%; margin-top: 6px; }
.gl-page .gl-form > .gl-btn { justify-self: start; align-self: flex-start; width: fit-content; }
.gl-page .gl-form > noscript .gl-btn { width: fit-content; }
.gl-page .gl-form--filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; align-items: end; }
.gl-page .gl-form--filters > .gl-btn { justify-self: start; }
.gl-sep { width: 100%; margin: 8px 0; border: 0; border-top: 1px solid var(--ct-border); opacity: 1; }
.gl-taste-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.gl-taste-grid .ct-textarea { min-height: 260px; }
.gl-seg--page { align-self: flex-start; width: fit-content; }
.gl-duration { display: block; margin-top: 4px; color: var(--ct-gold); }
.gl-tech > summary .gl-pill { margin-inline-start: 8px; vertical-align: middle; }
.gl-cell-title small { -webkit-line-clamp: 2; }
.gl-stack > .gl-prose { margin: 0; }

/* ============================================================
   Moderation dashboard: work waiting, 30-day numbers, daily chart,
   queues and shortcuts — all limited to the shops the reader manages.
   ============================================================ */
.gl-dash-block { display: flex; flex-direction: column; gap: 12px; }
.gl-dash-block__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.gl-dash-clear { display: inline-flex; align-items: center; gap: 7px; margin: 0; color: rgb(var(--gl-ok-rgb)); font-size: var(--ct-fs-sm); font-weight: 700; }
.gl-dash-clear .gl-i { width: 17px; height: 17px; }

/* Work waiting: big counts that open their queue */
.gl-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.gl-page .gl-tile {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 4px 14px;
  height: 100%;
  min-height: 96px;
  padding: 16px 18px;
  border: 1px solid var(--ct-border);
  border-radius: var(--ct-radius);
  background: var(--ct-glass-bg);
  -webkit-backdrop-filter: blur(var(--ct-glass-blur));
  backdrop-filter: blur(var(--ct-glass-blur));
  color: var(--ct-text);
  text-decoration: none;
  touch-action: manipulation;
  transition: border-color 200ms var(--gl-ease-out), transform 200ms var(--gl-ease-out), box-shadow 200ms var(--gl-ease-out);
}
.gl-tile__icon { grid-row: 1 / 3; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; background: rgba(var(--theme-color-accent-rgb), 0.12); color: var(--ct-text-muted); }
.gl-tile__icon .gl-i { width: 23px; height: 23px; }
.gl-tile__value { color: var(--ct-text); font-size: 1.75rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.gl-tile__value small { color: var(--ct-text-muted); font-size: var(--ct-fs-sm); font-weight: 700; }
.gl-tile__label { color: var(--ct-text-muted); font-size: var(--ct-fs-sm); font-weight: 600; line-height: 1.5; }
.gl-tile__go { position: absolute; inset-inline-end: 14px; inset-block-start: 14px; width: 16px; height: 16px; color: var(--ct-text-faint); transition: transform 200ms var(--gl-ease-out), color 200ms; }
.gl-page .gl-tile:hover { border-color: var(--ct-gold-border); transform: translateY(-2px); box-shadow: 0 12px 28px rgba(var(--gl-photo-rgb), 0.3); }
.gl-page .gl-tile:hover .gl-tile__go { color: var(--gl-gold-text); transform: translateX(-3px); }
.gl-page .gl-tile:focus-visible { outline: 2px solid var(--ct-gold); outline-offset: 2px; }
.gl-page .gl-tile.is-waiting { border-color: var(--ct-gold-border); background: linear-gradient(135deg, var(--ct-gold-soft), transparent 75%), var(--ct-glass-bg); }
.gl-tile.is-waiting .gl-tile__icon { background: var(--ct-gold-soft); color: var(--ct-gold); }
.gl-tile.is-waiting .gl-tile__value { color: var(--gl-gold-text); }

/* Numbers for the last 30 days, each with its change against the 30 before */
.gl-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.gl-page .ct-card.gl-kpi { display: flex; flex-direction: column; gap: 8px; padding: 18px; }
.gl-kpi__label { display: inline-flex; align-items: center; gap: 7px; color: var(--ct-text-muted); font-size: var(--ct-fs-sm); font-weight: 700; }
.gl-kpi__label .gl-i { width: 16px; height: 16px; color: var(--gl-gold-text); }
.gl-kpi__value { display: inline-flex; align-items: center; gap: 8px; color: var(--ct-text); font-size: 1.875rem; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
.gl-kpi__value .gl-coin { width: 22px; height: 22px; }
.gl-trend { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; color: var(--ct-text-muted); font-size: var(--ct-fs-xs); font-weight: 800; font-variant-numeric: tabular-nums; }
.gl-trend .gl-i { width: 15px; height: 15px; }
.gl-i--flip { transform: scaleY(-1); }
.gl-trend--up { color: rgb(var(--gl-ok-rgb)); }
.gl-trend--down { color: rgb(var(--gl-bad-rgb)); }
.gl-trend--new { color: var(--gl-gold-text); }
.gl-trend__note { color: var(--ct-text-faint); font-weight: 600; }

/* Panels */
.gl-dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.gl-page .ct-card.gl-panel { display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 20px; }
.gl-panel--wide { grid-column: 1 / -1; }
.gl-panel__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.gl-panel__title { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--ct-text); font-size: var(--ct-fs-md); font-weight: 800; }
.gl-panel__sub { margin: 2px 0 0; color: var(--ct-text-muted); font-size: var(--ct-fs-xs); }
.gl-panel__peak { display: inline-flex; align-items: center; gap: 6px; color: var(--gl-gold-text); font-weight: 800; font-variant-numeric: tabular-nums; }
.gl-panel__peak .gl-coin { width: 16px; height: 16px; }
.gl-page .gl-panel__more { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 4px; min-height: 32px; color: var(--gl-gold-text); font-size: var(--ct-fs-sm); font-weight: 700; text-decoration: none; }
.gl-page .gl-panel__more .gl-i { width: 15px; height: 15px; }
.gl-page .gl-panel__more:hover { color: var(--ct-text); }
.gl-panel__empty { display: flex; align-items: center; gap: 8px; margin: 0; padding: 18px; border: 1px dashed var(--ct-border); border-radius: var(--ct-radius); color: var(--ct-text-muted); font-size: var(--ct-fs-sm); }
.gl-panel__empty .gl-i { width: 17px; height: 17px; color: rgb(var(--gl-ok-rgb)); }

/* Daily chart: one bar per day, today's highlighted, values written on the bars */
/* Top padding leaves room for the value written above the tallest bar. */
.gl-bars { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 8px; height: 240px; margin: 0; padding: 22px 0 0; list-style: none; direction: ltr; }
.gl-bars__day { display: grid; grid-template-rows: 1fr auto; gap: 6px; min-width: 0; }
.gl-bars__track { position: relative; display: flex; align-items: flex-end; border-bottom: 1px solid var(--ct-border); }
.gl-bars__bar { position: relative; width: 100%; min-height: 0; border-radius: 8px 8px 2px 2px; background: linear-gradient(180deg, rgba(var(--theme-color-accent-rgb), 0.85), rgba(var(--theme-color-accent-rgb), 0.35)); transition: filter 200ms; }
.gl-bars__bar.is-zero { height: 2px !important; border-radius: 2px; background: var(--ct-border); }
.is-today .gl-bars__bar:not(.is-zero) { background: linear-gradient(180deg, var(--ct-gold), var(--theme-color-gold-dark)); }
.gl-bars__day:hover .gl-bars__bar { filter: brightness(1.2); }
.gl-bars__value { position: absolute; inset-inline: 0; bottom: 100%; margin-bottom: 4px; color: var(--ct-text); font-size: 0.7rem; font-weight: 800; text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.gl-bars__label { color: var(--ct-text-faint); font-size: 0.7rem; text-align: center; white-space: nowrap; overflow: hidden; font-variant-numeric: tabular-nums; }
.is-today .gl-bars__label { color: var(--gl-gold-text); font-weight: 800; }

/* Queue and history rows */
.gl-feed, .gl-rank { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.gl-feed__row, .gl-rank > li { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 10px; border-radius: 12px; color: var(--ct-text); text-decoration: none; }
.gl-page a.gl-feed__row { transition: background 200ms; }
.gl-page a.gl-feed__row:hover { background: rgba(var(--theme-color-accent-rgb), 0.08); }
.gl-page a.gl-feed__row:focus-visible { outline: 2px solid var(--ct-gold); outline-offset: -2px; }
.gl-feed li + li, .gl-rank li + li { border-top: 1px solid var(--ct-border); }
.gl-feed__icon { display: grid; flex: 0 0 auto; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: rgba(var(--theme-color-accent-rgb), 0.12); color: var(--ct-text-muted); }
.gl-feed__icon .gl-i { width: 18px; height: 18px; }
.gl-feed__main { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; }
.gl-feed__main strong { overflow: hidden; color: var(--ct-text); font-size: var(--ct-fs-sm); font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.gl-feed__main span { overflow: hidden; color: var(--ct-text-muted); font-size: var(--ct-fs-xs); text-overflow: ellipsis; white-space: nowrap; }
.gl-feed__side { display: flex; flex: 0 0 auto; flex-direction: column; align-items: flex-end; gap: 2px; }
.gl-feed__side time { color: var(--ct-text-faint); font-size: var(--ct-fs-xs); white-space: nowrap; }
.gl-feed__price { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 5px; color: var(--gl-gold-text); font-size: var(--ct-fs-sm); font-weight: 800; font-variant-numeric: tabular-nums; }
.gl-feed__price .gl-coin { width: 15px; height: 15px; }
.gl-rank__pos { display: grid; flex: 0 0 auto; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ct-gold-soft); color: var(--gl-gold-text); font-size: var(--ct-fs-xs); font-weight: 800; }
.gl-rank > li:first-child .gl-rank__pos { background: linear-gradient(135deg, var(--ct-gold), var(--theme-color-gold-base)); color: var(--theme-color-on-accent); }
.gl-rank__thumb { position: relative; display: grid; flex: 0 0 auto; place-items: center; width: 44px; height: 44px; overflow: hidden; border-radius: 12px; background: var(--gl-stage); color: var(--gl-on-photo-soft); }
.gl-rank__thumb .gl-i { width: 18px; height: 18px; }
.gl-rank__thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* Shortcuts */
.gl-quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.gl-page .gl-quick a { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 14px; border: 1px solid var(--ct-border); border-radius: 14px; background: var(--gl-sunk); color: var(--ct-text); font-size: var(--ct-fs-sm); font-weight: 700; text-decoration: none; transition: border-color 200ms, background 200ms; }
.gl-page .gl-quick a .gl-i { width: 18px; height: 18px; color: var(--gl-gold-text); }
.gl-page .gl-quick a:hover { border-color: var(--ct-gold-border); background: var(--ct-gold-soft); }
.gl-page .gl-quick a:focus-visible { outline: 2px solid var(--ct-gold); outline-offset: 2px; }

@media (max-width: 960px) {
  .gl-tiles, .gl-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gl-dash-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .gl-tiles, .gl-kpis { gap: 10px; }
  .gl-page .gl-tile { grid-template-columns: minmax(0, 1fr); min-height: 0; padding: 14px; }
  .gl-tile__icon { grid-row: auto; width: 40px; height: 40px; border-radius: 12px; }
  .gl-tile__value { font-size: 1.5rem; }
  .gl-page .ct-card.gl-kpi { padding: 14px; }
  .gl-kpi__value { font-size: 1.5rem; }
  .gl-page .ct-card.gl-panel { padding: 16px; }
  .gl-bars { gap: 4px; height: 180px; padding-top: 8px; }
  .gl-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gl-page .gl-quick a { padding: 0 10px; font-size: var(--ct-fs-xs); }
  .gl-bars__value { display: none; }
  .gl-bars__day:nth-child(odd) .gl-bars__label { visibility: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  .gl-page .gl-tile, .gl-tile__go, .gl-bars__bar { transition: none; }
  .gl-page .gl-tile:hover { transform: none; }
}

.gl-page hr.gl-sep { border-top: 1px solid var(--ct-border) !important; }
/* Phones: one scrolling row of tabs, so the page content starts near the top. */
@media (max-width: 767.98px) {
  .gl-tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .gl-tabs::-webkit-scrollbar { display: none; }
  .gl-page .gl-tabs .gl-tab { flex: 0 0 auto; white-space: nowrap; width: auto; }
}
/* Long page descriptions wrap instead of running off the phone screen. */
.gl-hero__id { min-width: 0; }
.gl-hero__text { flex: 1 1 auto; min-width: 0; }
.gl-hero__sub { white-space: normal; overflow-wrap: anywhere; }

/* ── Ledger: the row list used by every management table ───────────────────
   Rows instead of wide tables. Each list sets its own columns on the container:
     style="--gl-cols: 52px minmax(0,1fr) 6rem 8.75rem; --gl-cols-mid: …"
   The header and every row share that grid, so headings sit over their column.
   Pieces: __lead (picture/icon), __main (title + meta line), __cell (label + value),
   __actions (one visible button + the "more" menu). Under ~640px of list width a
   row becomes a small card: lead, title and actions on top, labelled cells below.
   Behaviour (search, unsaved-change tracking, menus) lives in galleon_navigation.tpl. */
.gl-page .ct-card:has(.gl-menu[open]) { overflow: visible; z-index: 5; }
.gl-ledger__search { margin-top: 18px; }
.gl-ledger { container: gl-ledger / inline-size; margin-top: 18px; }
.gl-ledger:first-child { margin-top: 0; }
.gl-ledger__head,
.gl-ledger__row {
  display: grid;
  grid-template-columns: var(--gl-cols, minmax(0, 1fr));
  align-items: center;
  column-gap: 16px;
}
.gl-ledger__head { padding: 0 16px 8px; border: 1px solid transparent; border-block: 0; color: var(--ct-text-muted); font-size: 0.75rem; font-weight: 600; }
.gl-ledger__list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.gl-ledger__row {
  position: relative;
  min-height: 64px;
  padding: 12px 16px;
  border: 1px solid var(--ct-border);
  border-radius: var(--ct-radius-sm);
  background: rgba(var(--theme-color-surface-rgb), 0.6);
  transition: border-color 200ms, box-shadow 200ms, background 200ms;
}
.gl-ledger__row[hidden] { display: none; }
.gl-ledger__row:hover { border-color: var(--ct-gold-border); }
/* Unsaved edit / selected row: gold edge on the reading-start side. */
.gl-ledger__row.is-dirty, .gl-ledger__row:has(.gl-ledger__check:checked) { border-color: var(--ct-gold); box-shadow: inset -3px 0 0 var(--ct-gold); }
[dir="ltr"] .gl-ledger__row.is-dirty, [dir="ltr"] .gl-ledger__row:has(.gl-ledger__check:checked) { box-shadow: inset 3px 0 0 var(--ct-gold); }
.gl-ledger__lead { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 12px; overflow: hidden; background: rgb(var(--gl-photo-rgb)); color: var(--ct-gold); }
.gl-ledger__lead img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gl-ledger__lead .gl-i { width: 22px; height: 22px; }
.gl-ledger__lead--icon { width: 44px; height: 44px; border-radius: 50%; background: var(--ct-gold-soft); }
.gl-ledger__lead--icon .gl-i { width: 20px; height: 20px; }
.gl-ledger__main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.gl-page .gl-ledger__title { color: var(--ct-text); font-size: 0.975rem; font-weight: 700; line-height: 1.55; text-decoration: none; overflow-wrap: anywhere; }
.gl-page a.gl-ledger__title:hover { color: var(--ct-gold); }
.gl-page a.gl-ledger__title:focus-visible { outline: 2px solid var(--ct-gold); outline-offset: 2px; border-radius: 4px; }
.gl-ledger__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; color: var(--ct-text-muted); font-size: 0.75rem; line-height: 1.6; font-variant-numeric: tabular-nums; }
.gl-ledger__meta > span { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.gl-ledger__meta .gl-i { width: 13px; height: 13px; flex: none; }
.gl-page .gl-ledger__meta a { color: var(--ct-gold); text-decoration: none; }
.gl-page .gl-ledger__meta a:hover { text-decoration: underline; }
.gl-ledger__meta .gl-pill { padding-block: 0; font-size: inherit; }
.gl-ledger__note { margin: 0; color: var(--ct-text-muted); font-size: 0.8125rem; line-height: 1.7; overflow-wrap: anywhere; }
.gl-page .gl-ledger__sub { display: inline-flex; align-items: center; gap: 5px; width: fit-content; color: var(--ct-gold); font-size: 0.75rem; font-weight: 600; text-decoration: none; }
.gl-ledger__sub .gl-i { width: 13px; height: 13px; }
.gl-ledger__row.is-off .gl-ledger__lead img { filter: grayscale(0.9); opacity: 0.5; }
.gl-page .gl-ledger__row.is-off .gl-ledger__title { color: var(--ct-text-muted); }
.gl-ledger__cell { display: flex; flex-direction: column; justify-content: center; gap: 4px; min-width: 0; font-size: var(--ct-fs-sm); overflow-wrap: anywhere; }
.gl-ledger__cell--end { align-items: flex-end; text-align: end; }
.gl-page .gl-ledger__cell a { color: var(--ct-text); text-decoration: none; }
.gl-page .gl-ledger__cell a:hover { color: var(--ct-gold); }
.gl-ledger__field { display: flex; flex-direction: column; gap: 4px; margin: 0; }
/* Wide rows: the header names each column, so per-cell labels are for screen readers only. */
.gl-ledger__label { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.gl-page .gl-ledger .gl-ledger__input { width: 100%; min-width: 0; min-height: 42px; padding: 6px 8px; text-align: center; font-variant-numeric: tabular-nums; }
.gl-ledger__value { color: var(--ct-text-muted); font-variant-numeric: tabular-nums; }
.gl-ledger__cell .gl-price { white-space: nowrap; }
.gl-ledger__cell .gl-pill { width: fit-content; }
.gl-ledger__check { width: 20px; height: 20px; margin: 0; accent-color: var(--ct-gold); cursor: pointer; }
.gl-ledger__actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.gl-ledger__actions .gl-btn { white-space: nowrap; min-height: 42px; }
.gl-ledger__actions form { margin: 0; }
.gl-ledger__none { margin: 12px 0 0; padding: 18px; border: 1px dashed var(--ct-border-strong); border-radius: var(--ct-radius-sm); color: var(--ct-text-muted); text-align: center; }
.gl-ledger__none[hidden] { display: none; }

/* "More" menu: a native <details>, so it opens without JS and closes with Escape / an outside click. */
.gl-menu { position: relative; }
.gl-menu__toggle {
  display: inline-grid; place-items: center;
  width: 42px; height: 42px;
  border: 1px solid var(--ct-border); border-radius: 999px;
  color: var(--ct-text-muted); cursor: pointer; list-style: none;
  transition: border-color 200ms, color 200ms, background 200ms;
  touch-action: manipulation;
}
.gl-menu__toggle::-webkit-details-marker { display: none; }
.gl-menu__toggle .gl-i { width: 18px; height: 18px; stroke-width: 3; }
.gl-menu__toggle:hover, .gl-menu[open] > .gl-menu__toggle { border-color: var(--ct-gold-border); color: var(--ct-gold); background: var(--ct-gold-soft); }
.gl-menu__toggle:focus-visible { outline: 2px solid var(--ct-gold); outline-offset: 2px; }
.gl-menu__list {
  position: absolute; inset-block-start: calc(100% + 6px); inset-inline-end: 0; z-index: 20;
  display: flex; flex-direction: column; gap: 2px;
  min-width: 200px; padding: 6px;
  border: 1px solid var(--ct-border-strong); border-radius: var(--ct-radius-sm);
  background: rgba(var(--theme-color-surface-rgb), 0.98);
  box-shadow: var(--ct-shadow-hover);
  animation: gl-menu-in 160ms var(--gl-ease-out, ease-out);
}
.gl-menu__list form { display: contents; }
.gl-page .gl-menu__item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 8px 12px; border: 0; border-radius: 8px; background: none; color: var(--ct-text); font: inherit; font-size: var(--ct-fs-sm); font-weight: 600; text-align: start; text-decoration: none; white-space: nowrap; cursor: pointer; }
.gl-menu__item .gl-i { width: 16px; height: 16px; color: var(--ct-text-muted); }
.gl-page .gl-menu__item:hover, .gl-page .gl-menu__item:focus-visible { background: rgba(var(--theme-color-accent-rgb), 0.14); outline: none; }
.gl-page .gl-menu__item--danger, .gl-menu__item--danger .gl-i { color: rgb(var(--gl-bad-rgb)); }
.gl-page .gl-menu__item--danger:hover, .gl-page .gl-menu__item--danger:focus-visible { background: rgba(var(--gl-bad-rgb), 0.12); }
.gl-menu__sep { margin: 4px 6px; border: 0; border-top: 1px solid var(--ct-border); }
@keyframes gl-menu-in { from { opacity: 0; transform: translateY(-4px); } }

/* Save / bulk-action bar under a list: stays in reach while scrolling. */
.gl-savebar {
  position: sticky; inset-block-end: 12px; z-index: 4;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  margin-top: 16px; padding: 12px 16px;
  border: 1px solid var(--ct-border); border-radius: var(--ct-radius);
  background: rgba(var(--theme-color-surface-rgb), 0.97);
  box-shadow: var(--ct-shadow);
  transition: border-color 200ms;
}
.gl-savebar.is-dirty { border-color: var(--ct-gold); }
.gl-savebar__status { display: flex; align-items: center; gap: 8px; margin: 0; flex: 1 1 260px; color: var(--ct-text-muted); font-size: var(--ct-fs-sm); line-height: 1.7; }
.gl-savebar__status .gl-i { flex: none; width: 17px; height: 17px; }
.gl-savebar__buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.gl-savebar.is-dirty .gl-savebar__status { color: var(--ct-text); font-weight: 600; }
.gl-savebar.is-dirty .gl-savebar__status .gl-i { color: var(--ct-gold); }
.gl-savebar[data-gl-ledger-save]:not(.is-dirty) .gl-btn--primary { border-color: var(--ct-gold-border); background: var(--ct-gold-soft); color: var(--gl-gold-text); box-shadow: none; }

/* Mid widths (sidebar layouts, laptops): each list may give slimmer columns; buttons go icon-only. */
@container gl-ledger (max-width: 860px) {
  .gl-ledger__head, .gl-ledger__row { grid-template-columns: var(--gl-cols-mid, var(--gl-cols, minmax(0, 1fr))); column-gap: 12px; }
  .gl-ledger__lead:not(.gl-ledger__lead--icon) { width: 48px; height: 48px; }
  .gl-ledger__actions .gl-btn:has(.gl-ledger__btn-text) { width: 42px; padding: 0; justify-content: center; }
  .gl-ledger__btn-text { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
}
@container gl-ledger (max-width: 640px) {
  .gl-ledger__head { display: none; }
  .gl-ledger__row { display: flex; flex-wrap: wrap; align-items: center; column-gap: 12px; row-gap: 0; padding: 12px; }
  .gl-ledger__check { order: 0; }
  .gl-ledger__lead { order: 1; }
  .gl-ledger__lead:not(.gl-ledger__lead--icon) { width: 48px; height: 48px; }
  .gl-ledger__main { order: 1; flex: 1 1 0; }
  .gl-ledger__actions { order: 2; }
  /* Three or more controls: give them their own line under the cells so the title keeps its width. */
  .gl-ledger__actions:has(> :nth-child(3)) { order: 5; flex-basis: 100%; justify-content: flex-start; margin-top: 12px; }
  .gl-ledger__row::after { content: ""; order: 3; flex-basis: 100%; }
  .gl-ledger__cell { order: 4; flex: 1 1 7.5rem; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--ct-border); }
  .gl-ledger__cell--end { align-items: flex-start; text-align: start; }
  .gl-ledger__label { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; white-space: normal; color: var(--ct-text-muted); font-size: 0.75rem; font-weight: 600; }
}
@media (max-width: 767px) {
  /* Clear the phone tab bar. */
  .gl-savebar { inset-block-end: calc(var(--mui-dock-h, 64px) + 12px + env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-reduced-motion: reduce) {
  .gl-ledger__row, .gl-menu__toggle, .gl-savebar { transition: none; }
  .gl-menu__list { animation: none; }
}
/* A row whose title is its only link: the whole row opens it. */
.gl-ledger__title--stretch::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.gl-ledger__row:has(.gl-ledger__title--stretch) { cursor: pointer; }
.gl-ledger__note .gl-i { width: 13px; height: 13px; vertical-align: -2px; }

/* "Description" chip in a row's meta line; opens the shared modal. */
.gl-page .gl-ledger__desc-btn {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 28px; padding: 2px 10px;
  border: 1px solid var(--ct-gold-border); border-radius: 999px;
  background: var(--ct-gold-soft); color: var(--gl-gold-text, var(--ct-gold));
  font: inherit; font-size: 0.75rem; font-weight: 700; cursor: pointer;
  transition: border-color 200ms, background 200ms;
  position: relative;
}
/* Larger tap area than the visible chip. */
.gl-ledger__desc-btn::before { content: ""; position: absolute; inset: -8px -4px; }
.gl-page .gl-ledger__desc-btn:hover { border-color: var(--ct-gold); background: rgba(var(--theme-color-accent-rgb), 0.23); }
.gl-page .gl-ledger__desc-btn:focus-visible { outline: 2px solid var(--ct-gold); outline-offset: 2px; }
.gl-ledger__desc-btn .gl-i { width: 13px; height: 13px; }

/* Shared modal (native <dialog>: focus trap, Escape and top layer come from the browser). */
.gl-modal { width: min(640px, calc(100vw - 32px)); max-width: none; max-height: min(80dvh, 720px); margin: auto; padding: 0; border: 0; background: transparent; color: var(--ct-text); overflow: visible; }
.gl-modal::backdrop { background: rgba(6, 2, 14, 0.62); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.gl-modal[open] { animation: gl-modal-in 200ms var(--gl-ease-out, ease-out); }
.gl-modal__box { display: flex; flex-direction: column; max-height: min(80dvh, 720px); border: 1px solid var(--ct-border-strong); border-radius: var(--ct-radius-lg, 18px); background: rgba(var(--theme-color-surface-rgb), 0.98); box-shadow: var(--ct-shadow-hover); overflow: hidden; }
.gl-modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--ct-border); }
.gl-modal__title { margin: 0; color: var(--ct-text); font-size: 1.0625rem; font-weight: 700; line-height: 1.6; overflow-wrap: anywhere; }
.gl-modal__close { display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border: 1px solid var(--ct-border); border-radius: 999px; background: none; color: var(--ct-text-muted); cursor: pointer; transition: border-color 200ms, color 200ms; }
.gl-modal__close:hover { border-color: var(--ct-gold-border); color: var(--ct-gold); }
.gl-modal__close:focus-visible { outline: 2px solid var(--ct-gold); outline-offset: 2px; }
.gl-modal__close .gl-i { width: 18px; height: 18px; }
.gl-modal__body { padding: 18px 20px 22px; overflow-y: auto; overscroll-behavior: contain; font-size: 0.9375rem; }
.gl-modal__body img { max-width: 100%; height: auto; }
.gl-page .gl-modal__body a { color: var(--ct-gold); }
@keyframes gl-modal-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@media (max-width: 600px) {
  /* Phones: a sheet from the bottom edge. */
  .gl-modal { width: 100vw; max-height: 85dvh; margin: auto 0 0; }
  .gl-modal__box { max-height: 85dvh; border-radius: 20px 20px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
}
@media (prefers-reduced-motion: reduce) {
  .gl-modal[open] { animation: none; }
}

/* Wand orders: facts grid and image preview */
.gl-wand-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; margin: 0; }
.gl-wand-facts > div { display: grid; gap: 2px; min-width: 0; }
.gl-wand-facts dt { color: var(--ct-text-muted); font-size: 0.8125rem; font-weight: 600; }
.gl-wand-facts dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.gl-wand-image { display: block; max-width: min(100%, 360px); max-height: 260px; margin-inline: auto; object-fit: contain; }
@media (max-width: 560px) { .gl-wand-facts { grid-template-columns: minmax(0, 1fr); } }

/* Wand rules editor (item kind "wand") */
.gl-wand-rules { display: grid; gap: 18px; }
.gl-wand-rules__range { margin: 0; padding: 8px 12px; border-radius: 10px; background: var(--ct-gold-soft, rgba(232,185,74,.12)); border: 1px solid var(--ct-gold-border, rgba(232,185,74,.35)); font-weight: 700; width: fit-content; }
.gl-wand-block { display: grid; gap: 8px; padding-top: 14px; border-top: 1px solid var(--ct-border); }
.gl-wand-block__title { margin: 0; font-size: 1rem; font-weight: 800; }
.gl-wand-block > .gl-help { margin: 0; }
.gl-wand-block > .gl-btn { justify-self: start; }
.gl-wand-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.gl-wand-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--ct-border); border-radius: 12px; background: var(--ct-surface-2, rgba(255,255,255,.03)); }
.gl-wand-row__num { min-width: 2.2em; padding: 2px 8px; border-radius: 999px; background: var(--ct-gold-soft, rgba(232,185,74,.14)); color: var(--ct-gold); font-weight: 800; font-size: .8125rem; text-align: center; white-space: nowrap; }
.gl-wand-row__fields { display: grid; gap: 8px 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); min-width: 0; }
.gl-wand-row--tier .gl-wand-row__fields { grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)); }
.gl-wand-row--flex .gl-wand-row__fields { grid-template-columns: minmax(0, 1fr) 7em; }
.gl-wand-row .ct-field { margin: 0; gap: 4px; }
.gl-wand-row .ct-field__label { font-size: .75rem; }
.gl-wand-row__letter .ct-input { text-align: center; font-weight: 800; }
.gl-wand-row__tools { display: flex; gap: 4px; }
.gl-wand-tool { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--ct-border); border-radius: 8px; background: transparent; color: var(--ct-text-muted); cursor: pointer; }
.gl-wand-tool:hover:not(:disabled), .gl-wand-tool:focus-visible { color: var(--ct-text); border-color: var(--ct-gold-border, var(--ct-gold)); }
.gl-wand-tool--danger:hover:not(:disabled) { color: #e5534b; border-color: rgba(229,83,75,.5); }
.gl-wand-tool:disabled { opacity: .35; cursor: default; }
.gl-wand-tool .gl-i { width: 16px; height: 16px; }
@media (max-width: 720px) {
  .gl-wand-row { grid-template-columns: minmax(0, 1fr) auto; }
  .gl-wand-row__num { grid-column: 1; justify-self: start; }
  .gl-wand-row__tools { grid-column: 2; grid-row: 1; }
  .gl-wand-row__fields, .gl-wand-row--tier .gl-wand-row__fields { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr); }
  .gl-wand-row--tier .gl-wand-row__fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gl-wand-row--tier .gl-wand-row__name { grid-column: 1 / -1; }
}

/* Live link check under link fields (assets/js/link-check.js) */
.gl-linkcheck { display: flex; align-items: center; gap: 10px; margin-top: 6px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--ct-border); font-size: 0.875rem; line-height: 1.6; }
.gl-linkcheck[hidden] { display: none; }
.gl-linkcheck__icon { width: 18px; height: 18px; flex-shrink: 0; }
.gl-linkcheck__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; overflow-wrap: anywhere; }
.gl-linkcheck__body small { color: var(--ct-text-muted); font-size: 0.8125rem; }
.gl-linkcheck__open { margin-inline-start: auto; flex-shrink: 0; min-height: 32px; display: inline-flex; align-items: center; padding: 0 10px; border-radius: 8px; border: 1px solid currentColor; font-weight: 700; font-size: 0.8125rem; text-decoration: none; }
.gl-linkcheck__thumb { width: 72px; height: 72px; object-fit: contain; border-radius: 8px; background: rgba(0, 0, 0, 0.25); flex-shrink: 0; }
.gl-linkcheck--ok { border-color: rgba(var(--gl-ok-rgb), 0.55); background: rgba(var(--gl-ok-rgb), 0.1); }
.gl-linkcheck--ok .gl-linkcheck__icon, .gl-linkcheck--ok .gl-linkcheck__open { color: rgb(var(--gl-ok-rgb)); }
.gl-linkcheck--warn { border-color: rgba(var(--gl-warn-rgb), 0.55); background: rgba(var(--gl-warn-rgb), 0.1); }
.gl-linkcheck--bad { border-color: rgba(var(--gl-bad-rgb), 0.55); background: rgba(var(--gl-bad-rgb), 0.1); }
.gl-linkcheck--bad .gl-linkcheck__icon { color: var(--ct-danger); }
.gl-linkcheck--wait { color: var(--ct-text-muted); }
.gl-linkcheck__spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-inline-end-color: transparent; animation: gl-link-spin .8s linear infinite; flex-shrink: 0; }
@keyframes gl-link-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .gl-linkcheck__spinner { animation: none; } }
.gl-page .ct-input.is-link-ok { border-color: rgba(var(--gl-ok-rgb), 0.7); }
.gl-page .ct-input.is-link-bad { border-color: rgba(var(--gl-bad-rgb), 0.7); }
/* Mana amounts are blue across Galleon pages. */
.gl-page .gl-mana-amount, .gl-page .gl-price--mana { color: var(--gl-mana-text); }

/* ============================================================
   UX review 2026-11-21
   ============================================================ */
/* Light theme: the theme gold measured 3.1–3.7:1 on Galleon's glass cards (field labels, prices, row links,
   counts, step numbers, names). Darkened toward the text colour it passes 4.5:1; icons and borders follow.
   Faint helper text (chart dates, "compared with the 30 days before") was 2.7:1 and now uses the muted tone. */
:root:not([data-theme=dark]) .gl-page {
  --ct-gold: color-mix(in srgb, var(--theme-color-accent) 58%, var(--theme-color-text));
  --gl-gold-text: var(--ct-gold);
  --ct-text-faint: var(--ct-text-muted);
}
/* Dark theme: the same faint helper text measured 4.4:1, just under the line. */
:root[data-theme=dark] .gl-page { --ct-text-faint: var(--ct-text-muted); }
/* Plain links (member names, forums, addresses) take their colour from the site theme, the same light gold. */
:root:not([data-theme=dark]) .gl-page a:not([class]), :root:not([data-theme=dark]) .gl-page a.gl-url { color: var(--gl-gold-text); }

/* Owner colours from [color=…] keep their hue; lightness is clamped so the words stay readable on the theme. */
.gl-ink { color: var(--gl-ink); }
@supports (color: oklch(from red l c h)) {
  :root:not([data-theme=dark]) .gl-ink { color: oklch(from var(--gl-ink) min(l, 0.5) c h) !important; }
  :root[data-theme=dark] .gl-ink { color: oklch(from var(--gl-ink) max(l, 0.8) c h) !important; }
}

/* Bare web addresses inside owner/member text read left to right, with Latin digits (Vazir draws Persian ones). */
.gl-url { direction: ltr; unicode-bidi: isolate; overflow-wrap: anywhere; font-family: Tahoma, Arial, sans-serif; }

/* Breadcrumb links are short words; the tap area grows without moving the line. */
.gl-crumbs a { padding-block: 12px; margin-block: -12px; }

/* Link to the spell's first report on an order: a real button in its own card, not a stray line between cards. */
.gl-page .ct-card.gl-linkcard { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; }
.gl-linkcard__label { display: inline-flex; align-items: center; gap: 8px; margin: 0; color: var(--ct-text); font-weight: 700; }
.gl-linkcard__label .gl-i { color: var(--gl-gold-text); }

/* Phones: one product a row stays (room for both buttons), but a 4:3 picture instead of a square
   halves the scrolling on long shelves; "from this shop" cards have no buttons, so two fit a row. */
@media (max-width: 480px) {
  .gl-shelf:not(.gl-shelf--more) .gl-product__media { aspect-ratio: 4 / 3; }
  .gl-shelf--more { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.gl-page caption { color: var(--ct-text-muted); }
