/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  /* The edge-darkening gradient lives on .main-content, not body -
     the sidebar keeps its own surface and the gradient resizes with
     it instead of hiding underneath */
  background: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  text-shadow: var(--text-shadow);
  -webkit-font-smoothing: antialiased;
}

#app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar - sticky so footer stays pinned to viewport bottom */
.sidebar {
  width: 280px;
  background-color: var(--bg-sidebar);
  /* Bottom padding is 12px slimmer so the footer buttons sit lower */
  padding: 2rem 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  /* Thin divider line + glow both take the current page's hero
     accent (--page-accent lives on body, set per route) - the edge
     reads as part of the page you're on. Glow runs ~5% wider and
     ~5% stronger than the old theme wash */
  border-right: 1px solid var(--page-accent, var(--border-color));
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  /* z-index lifts the sidebar above .main-content's gradient -
     without it the background paints over the glow spilling right */
  z-index: 10;
  box-shadow: 0 0 25px oklch(0% 0 0 / 0.3),
              0 0 36px color-mix(in oklch, var(--page-accent, var(--theme-primary)) 40%, transparent);
  transition: width 0.125s, padding 0.125s, border-color 0.3s, box-shadow 0.3s;
}

/* Collapse toggle - fixed so it can hang 10px off the sidebar's
   right edge (fixed positioning escapes the sidebar's overflow
   clip). left tracks the edge: 280-10 open, 72-10 collapsed */
.sidebar-toggle {
  position: fixed;
  top: 48px;
  left: 259px;
  z-index: 60;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  font-size: 0.8rem;
  box-shadow: 0 2px 10px oklch(0% 0 0 / 0.25);
  transition: left 0.125s, background 0.2s, color 0.2s;
}

.sidebar-toggle:hover {
  color: var(--on-accent);
  background: var(--theme-primary);
}

/* Header = collapse toggle + brand on one line */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-align: left;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  min-width: 0;
  flex: 1; /* fills the header row so the tagline can center over
              the sidebar's full width */
}

/* Full lockup (mark + logotype) on transparency - 15% smaller than
   the old edge-to-edge crop, centered instead of bleeding */
.sidebar-logo-link { display: block; cursor: pointer; }
.sidebar-logo {
  display: block;
  width: 78.8%;
  max-width: none;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar-brand-text { min-width: 0; }

.sidebar-header h1 {
  font-size: 1.794rem;
  font-weight: 700;
  color: var(--theme-primary);
  margin-bottom: 0.1rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  white-space: nowrap;
}

.sidebar-header .tagline {
  font-size: 0.68rem;
  /* Brighter than plain text-secondary - it read too dim on dark */
  color: color-mix(in oklch, var(--text-secondary) 55%, var(--text-primary));
  text-transform: uppercase;
  /* Longer tagline wraps to two lines instead of clipping */
  line-height: 1.35;
  text-align: center;
}

/* Toggle is position:fixed, out of flex flow - its visual spot is
   set entirely by the left/top coordinates above */

.sidebar-nav {
  margin: 2rem 0;
  flex: 1;
}

/* Nav links styled identically to the Settings/Logout buttons */
.nav-link {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0.75rem 1rem;
  background-color: var(--bg-card);
  border: 1px solid color-mix(in oklch, var(--bg-card) 72%, var(--text-primary));
  color: var(--text-primary);
  text-decoration: none;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  /* No transition - hover states snap instantly. A 0.2s fade read
     as input lag */
  transition: none;
  text-transform: uppercase;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}

/* All sidebar buttons share one behavior: hover lifts the fill a
   step and brightens the outline; the label never changes color -
   white on dark, black on light, even on the active page (whose only
   marker is the accent outline) */
.nav-link:hover {
  /* background-color only - the `background` shorthand would wipe
     the edge-band image the tinted buttons carry */
  background-color: var(--bg-input);
  border-color: var(--theme-primary);
  color: var(--text-primary);
}

.nav-link.active {
  /* Active page = accent outline + slightly lifted fill only; the
     label must stay --text-primary like every other sidebar button.
     3px outline makes the current page obvious at a glance - the
     padding shrinks the same 2px so the button's box doesn't grow */
  background-color: var(--bg-input);
  border-color: var(--theme-primary);
  border-width: 3px;
  padding: calc(0.75rem - 2px) calc(1rem - 2px);
  color: var(--text-primary);
}
body.sidebar-collapsed .nav-link.active {
  padding: calc(0.75rem - 2px) calc(0.5rem - 2px);
}

/* Rainbow page tints on the nav buttons - a 22% wash of each page's
   hue, double the card text-block strength. Prominence steps up
   normal -> hover -> active: the tint share in the label text climbs
   45% -> 75% -> 90%, and hover pushes the border + fill toward the
   saturated hue ('a brighter version of the same color'). The hues
   spread red -> purple down the sidebar in nav order, and every
   .page-hero reuses its page's tint so button and banner always
   match */
.nav-link[data-page="dashboard"] { --nav-tint: oklch(60% 0.2 25); }
.nav-link[data-page="analytics"] { --nav-tint: oklch(65% 0.18 50); }
.nav-link[data-page="gallery"] { --nav-tint: oklch(78% 0.15 90); }
.nav-link[data-page="catalogue"] { --nav-tint: oklch(65% 0.17 150); }
.nav-link[data-page="reviews"] { --nav-tint: oklch(65% 0.15 190); }
.nav-link[data-page="rfydrops"] { --nav-tint: oklch(62% 0.15 215); }
.nav-link[data-page="reselling"] { --nav-tint: oklch(58% 0.17 240); }
.nav-link[data-page="tax"] { --nav-tint: oklch(58% 0.18 265); }
.nav-link[data-page="help"] { --nav-tint: oklch(60% 0.17 290); }
.nav-link[data-page="versionhistory"] { --nav-tint: oklch(60% 0.17 312); }
.admin-nav-btn { --nav-tint: oklch(58% 0.17 328); }
.settings-btn { --nav-tint: oklch(58% 0.17 342); }
.logout-btn { --nav-tint: oklch(58% 0.17 12); }

.nav-link[data-page],
.admin-nav-btn, .settings-btn, .logout-btn {
  background-color: color-mix(in oklch, var(--nav-tint, transparent) 22%, var(--bg-card));
  border-color: color-mix(in oklch, var(--nav-tint, transparent) 30%,
    color-mix(in oklch, var(--bg-card) 72%, var(--text-primary)));
  color: color-mix(in oklch, var(--nav-tint, transparent) 45%, var(--text-primary));
}
.nav-link[data-page]:hover,
.admin-nav-btn:hover, .settings-btn:hover, .logout-btn:hover {
  background-color: color-mix(in oklch, var(--nav-tint, transparent) 30%, var(--bg-input));
  border-color: color-mix(in oklch, var(--nav-tint, var(--border-color)) 85%, transparent);
  color: color-mix(in oklch, var(--nav-tint, var(--text-primary)) 75%, var(--text-primary));
}
.nav-link[data-page].active,
.nav-link[data-page].active:hover {
  background-color: color-mix(in oklch, var(--nav-tint, transparent) 30%, var(--bg-input));
  border-color: var(--nav-tint, var(--theme-primary));
  color: color-mix(in oklch, var(--nav-tint, var(--text-primary)) 90%, var(--text-primary));
}

/* The topbar account pill is the 12th rainbow stop - deepest purple */
.account-chip {
  border-color: color-mix(in oklch, oklch(58% 0.17 312) 45%, var(--border-color));
}
.account-chip:hover {
  border-color: oklch(58% 0.17 312);
  background-color: color-mix(in oklch, oklch(58% 0.17 312) 18%, var(--bg-card));
}

/* ---------- Shared list/table cell bits (Reviews, Reselling) ---------- */
.cell-2line {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* Inner block of the auto-applied clamp - preserves normal inline
   flow (bolds, <br>, spans) inside the -webkit-box clamp */
.cell-2line-i { display: block; min-width: 0; }
.cell-num { text-align: center; color: var(--text-secondary); }
.cell-img img { width: 46px; height: 46px; object-fit: contain; border-radius: 6px; background: #fff; padding: 2px; }
.cell-title { min-width: 180px; }
.asin-link { color: var(--theme-primary); font-size: .82rem; }
.num-bad { color: #e5534b !important; }
.num-warn { color: #f0962f !important; }

/* Insights, Reselling + Reviews tables: ~10 visible rows then
   vertical scroll; the header sticks so column labels stay put
   while scrolling */
#pageContainer:has(> .hero-analytics) .table-container,
#pageContainer:has(> .hero-reselling) .table-container,
#pageContainer:has(> .hero-reviews) .table-container {
  max-height: 480px;
  overflow-y: auto;
}
#pageContainer:has(> .hero-analytics) .table-container thead th,
#pageContainer:has(> .hero-reselling) .table-container thead th,
#pageContainer:has(> .hero-reviews) .table-container thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-card);
}

/* My Vine Reviews: star column + the one-time sync card copy */
.rev-stars { color: #f5b942; font-size: .95rem; letter-spacing: 1px; }
.rev-copy-cell { font-size: .82rem; line-height: 1.4; max-width: 340px; }
.rev-sync-copy { font-size: .85rem; color: var(--text-secondary); line-height: 1.5; margin: 0 0 12px; }
.rev-sync-note { font-size: .8rem; color: var(--text-secondary); margin-left: 10px; }

/* Urgency pill - 30-day review window countdowns, age badges */
.rev-urg { display: inline-block; padding: 3px 9px; border-radius: 12px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.rev-good { background: color-mix(in oklch, #3ecf6e 20%, transparent); color: #3ecf6e; }
.rev-warn { background: color-mix(in oklch, #f0962f 20%, transparent); color: #f0962f; }
.rev-bad { background: color-mix(in oklch, #e5534b 22%, transparent); color: #e5534b; }

/* ---------- Review viewer modal ---------- */
.rev-view { padding: 5px 14px; font-size: .78rem; }
.review-modal {
  width: 840px;
  max-width: 94vw;
  position: relative;
  /* Border + glow take the quality colour (--rq); theme-primary is
     the fallback while no review is loaded */
  border: 1px solid var(--rq, var(--theme-primary));
  box-shadow: 0 0 18px color-mix(in oklch, var(--rq, var(--theme-primary)) 38%, transparent);
}
.rev-q-good { --rq: #3ecf6e; }
.rev-q-warn { --rq: #f0962f; }
.rev-q-bad { --rq: #e5534b; }
.rev-q-pending { --rq: #8a8f98; }
.review-modal-x { position: absolute; top: 12px; right: 14px; background: none; border: none; color: var(--text-secondary); font-size: 1.6rem; line-height: 1; cursor: pointer; z-index: 1; }
.review-modal-x:hover { color: var(--text-primary); }
.rev-modal-head { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 14px; }
.rev-modal-head img { width: 115px; height: 115px; object-fit: contain; border-radius: 10px; background: #fff; padding: 4px; flex-shrink: 0; cursor: zoom-in; }
.rev-modal-meta h3 { margin: 0 0 8px; font-size: 1.05rem; line-height: 1.35; }
/* Score row: stars left, "Reviewed on" centered, quality pill
   right - one line above the review title */
.rev-modal-score { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 12px; }
.rev-modal-score .rev-stars { font-size: 1.05rem; }
#revModalReviewedOn { flex: 1; text-align: center; font-size: .78rem; color: var(--text-secondary); opacity: .8; }
.rev-pending { background: color-mix(in oklch, #8a8f98 22%, transparent); color: #aab0b8; }
#revModalTitle { margin: 0 0 8px; font-size: 1rem; }
.rev-modal-text { font-size: .9rem; line-height: 1.65; color: var(--text-primary); white-space: pre-wrap; }

/* ---------- Overview: order aging + year card ---------- */
.aging-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 1.25rem; margin-bottom: 2rem; }
.aging-grid .table-container { margin-bottom: 0; }
.aging-item { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--border-color); }
.aging-item:last-child { border-bottom: 0; }
.aging-item img { width: 42px; height: 42px; object-fit: contain; border-radius: 6px; background: #fff; padding: 2px; flex-shrink: 0; }
.aging-txt { flex: 1; min-width: 0; font-size: .85rem; }
.aging-date { font-size: .72rem; color: var(--text-secondary); }

.year-card {
  position: relative;
  border-radius: 14px;
  padding: 1.4rem 1.6rem;
  margin-bottom: 2rem;
  border: 1px solid color-mix(in oklch, var(--theme-primary) 40%, var(--border-color));
  background: linear-gradient(120deg, color-mix(in oklch, var(--theme-primary) 22%, var(--bg-card)), var(--bg-card) 60%);
  overflow: hidden;
}
.year-card::after {
  content: '🎆';
  position: absolute;
  right: 6px;
  bottom: -65px;
  font-size: 13.5rem;
  opacity: 0.12;
  transform: rotate(12deg);
  pointer-events: none;
}
.year-head { display: flex; align-items: center; gap: 10px; margin-bottom: 1rem; }
.year-title { font-size: 1.15rem; font-weight: 800; text-transform: uppercase; }
/* Copy sits flush right, just inside the fold caret - small and
   quiet so it doesn't compete with the title */
.year-card #yearCopy {
  margin-left: auto;
  padding: 4px 10px;
  font-size: .68rem;
  letter-spacing: .06em;
  background: transparent;
  border: 1px solid color-mix(in oklch, var(--theme-primary) 35%, var(--border-color));
  color: var(--text-secondary);
  border-radius: 8px;
  opacity: .85;
}
.year-card #yearCopy:hover { opacity: 1; color: var(--text-primary); }
.year-card.year-collapsed #yearCopy { display: none; }
.year-card.year-collapsed .year-head { margin-bottom: 0; }
.year-stats { display: flex; flex-wrap: wrap; gap: 10px; }
.mini-stat {
  background: color-mix(in oklch, var(--bg-card) 70%, transparent);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 8px 14px;
  min-width: 90px;
}
.mini-stat b { display: block; font-size: 1.05rem; }
.mini-stat span { font-size: .7rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .4px; }
.year-foot { margin-top: 1rem; font-size: .82rem; color: var(--text-secondary); }
.btn-sm { padding: 6px 12px; font-size: .8rem; }

/* ---------- RFY drop-pattern heatmap ---------- */
.hm-wrap { padding: 0 1rem 1.1rem; overflow-x: auto; }
.hm-grid { display: inline-block; min-width: 560px; }
.hm-row { display: flex; align-items: center; gap: 3px; margin-bottom: 3px; }
.hm-day { width: 34px; font-size: .68rem; color: var(--text-secondary); text-transform: uppercase; flex-shrink: 0; }
.hm-hr { width: 20px; font-size: .6rem; color: var(--text-secondary); text-align: center; flex-shrink: 0; }
.hm-cell { width: 20px; height: 16px; border-radius: 3px; background: oklch(62% 0.15 245); flex-shrink: 0; }
.hm-cell.hm-empty { background: color-mix(in oklch, var(--bg-input) 80%, transparent); }
.hm-legend { display: flex; align-items: center; gap: 8px; font-size: .68rem; color: var(--text-secondary); margin: 8px 0 4px 37px; }
.hm-scale { width: 90px; height: 8px; border-radius: 4px; background: linear-gradient(to right, color-mix(in oklch, oklch(62% 0.15 245) 15%, transparent), oklch(62% 0.15 245)); }
.hm-note { font-size: .78rem; color: var(--text-secondary); margin-left: 37px; }

/* ---------- RFY profile ---------- */
.rfy-profile-stats { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 1rem 1rem; }
.rfy-profile-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 0 2rem; padding: 0 .5rem .5rem; }
.rfy-profile-cols table { width: 100%; }

/* $0 ETV corner badge - bottom-right of RFY card images, taxed
   regions only (rendered by rfydrops.js when region qualifies) */
.badge-etv0 {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: color-mix(in oklch, #3ecf6e 85%, #0a1a10);
  color: #07130b;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .4px;
  padding: 3px 8px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.45);
}

/* Quiet hours picker inside Account > Notifications */
.quiet-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.quiet-row input[type="time"] { font: inherit; font-size: .8rem; background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border-color); border-radius: 6px; padding: 4px 8px; }

/* Account > System Health rows reuse acct-row; status dots color it */
.health-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.health-ok { background: #3ecf6e; }
.health-warn { background: #f0962f; }
.health-bad { background: #e5534b; }
.health-dim { background: var(--text-secondary); }

/* Inventory bulk-select: checkbox column + floating action bar */
.bulk-col { width: 40px !important; min-width: 40px !important; text-align: center; }
.bulk-col input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--theme-primary); cursor: pointer; margin: 0; }
#bulkBar {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 10px;
  background: color-mix(in oklch, var(--bg-card) 92%, transparent);
  border: 1px solid var(--theme-primary);
  border-radius: 12px;
  padding: 9px 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,.5);
  backdrop-filter: blur(10px);
}
#bulkBar.hidden { display: none; }
#bulkBar .bulk-count { font-weight: 700; font-size: .85rem; white-space: nowrap; }
#bulkBar select { font: inherit; font-size: .82rem; background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border-color); border-radius: 7px; padding: 5px 8px; }
#bulkBar .bulk-msg { font-size: .78rem; color: var(--text-secondary); }

.nav-icon {
  margin-right: 0.75rem;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.sidebar-footer {
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

/* Help / Version History: a compact pair sharing one line directly
   the main nav under Tax Details behind a divider now; nav-link
   gives them identical styling + active highlight for free */
/* All sidebar-footer buttons share one skin: card fill + a thin
   outline a step brighter than the fill. Hover lifts BOTH the fill
   and the outline; text stays --text-primary in every state -
   white on dark mode, black on light, even when active. Only the
   border signals the active page */
.admin-nav-btn,.settings-btn,.logout-btn {
  /* font-family: buttons default to the UA button font, which
     renders at a different weight than the body stack - force the
     inherited family so all three buttons look identical. Colors
     come from the shared --nav-tint rules above - setting plain
     background/border here used to erase the rainbow on Settings
     and Logout (Admin only survived via !important below) */
  font-family: inherit;
}

/* One uniform label weight across every sidebar button */
.sidebar .nav-label { font-weight: 600; }

/* Hairline between the main pages and the utility links (Guides /
   Changelog) - same look as the footer's own divider */
.nav-divider {
  border-top: 1px solid var(--border-color);
  /* 1rem on both sides - same gap the footer divider keeps to ADMIN,
     so every divider in the sidebar reads identical */
  margin: 1rem 0;
}

/* Footer actions carry the nav-link class now - same padding,
   border, hover and active styling as every other sidebar button;
   only the button-element defaults need smoothing out */
.admin-nav-btn,.settings-btn,.logout-btn {
  width: 100%;
  cursor: pointer;
}

/* Collapsed sidebar - icon only. Desktop-only: under the mobile
   breakpoint the sidebar is an off-canvas fly-in and this class
   (which can persist in localStorage) must not shrink it */
@media (min-width: 769px) {
body.sidebar-collapsed .sidebar {
  width: 72px;
  padding: 1.5rem 0.5rem 0.75rem;
}

body.sidebar-collapsed .sidebar-header h1,
body.sidebar-collapsed .sidebar-header .tagline,
body.sidebar-collapsed .nav-label {
  display: none;
}

body.sidebar-collapsed .sidebar-header {
  justify-content: center;
}
/* Collapsed: keep the logo, shrunk to fit - only the text goes away */
body.sidebar-collapsed .sidebar-brand {
  align-items: center;
}
body.sidebar-collapsed .sidebar-brand-text {
  display: none;
}
body.sidebar-collapsed .sidebar-logo {
  width: 100%;
  height: 27px;
  max-height: 27px;
  margin-left: 0;
}

body.sidebar-collapsed .nav-link {
  justify-content: center;
  padding: 0.75rem 0.5rem;
}

body.sidebar-collapsed .nav-icon {
  margin-right: 0;
}

body.sidebar-collapsed .settings-btn,
body.sidebar-collapsed .logout-btn {
  justify-content: center;
  padding: 0.75rem 0.5rem;
}

body.sidebar-collapsed .sidebar-toggle {
  left: 51px;
}
}

/* Main Content */
.main-content {
  flex: 1;
  position: relative; /* anchors the scroll-progress strip */
  /* Own stacking context so .page-watermark's z-index:-1 lands ABOVE
     this element's gradient and below its children - without it the
     negative z escapes to the root context and hides behind the
     gradient entirely */
  z-index: 0;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* scrolling lives on .page-scroll so the hero is a
                     full-bleed sibling - it reaches the window edge instead
                     of stopping at the reserved scrollbar gutter */
  /* Smooth left-edge -> center -> right-edge darkening (~10% at the
     edges) across the CONTENT column only - it widens/narrows as the
     sidebar collapses/opens rather than being trapped behind it */
  background: linear-gradient(90deg,
    color-mix(in oklch, var(--bg-main) 90%, oklch(0% 0 0)) 0%,
    var(--bg-main) 50%,
    color-mix(in oklch, var(--bg-main) 90%, oklch(0% 0 0)) 100%);
}

/* Scroll progress - a hairline across the top of the content column
   that fills with the page's scroll depth, tinted by the current
   page's accent (--page-accent is set per render from the hero hue).
   Sits at the very top edge so it reads as an app chrome element,
   not part of the page content */
.page-progress{position:fixed;top:0;left:280px;right:0;height:3px;z-index:70;pointer-events:none;
  /* Faint accent track so the strip reads even before scrolling
     fills it - an empty fill alone was invisible. Fixed to the
     viewport (offset by the live sidebar width) so it never scrolls
     away with page content */
  background:color-mix(in oklch,var(--page-accent,var(--theme-primary)) 16%,transparent)}
@media (min-width:769px){body.sidebar-collapsed .page-progress{left:72px}}
@media (max-width:768px){.page-progress{left:0}}
.page-progress>div{height:100%;width:0;background:var(--page-accent,var(--theme-primary));box-shadow:0 0 8px var(--page-accent,var(--theme-primary));transition:width .12s linear}

#pageContainer {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.page-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-gutter: stable; /* filter toggles must never reflow the layout */
  padding: 0 2rem 2rem;
  /* Content overlaps the hero's faded bottom band - the hero stays
     behind while page content scrolls over it */
  position: relative;
  margin-top: -26px;
}

/* Collapsible table blocks - an <h3> directly inside a
   .table-container is the block's fold handle: click to collapse
   the whole card down to just its title, click again to restore.
   The chevron tracks the state */
.table-container > h3 { cursor: pointer; user-select: none; display: flex; align-items: center; }
.table-container > h3::after { content: '▾'; margin-left: auto; font-size: .8em; color: var(--text-secondary); transition: transform .15s; }
.table-container.tbl-collapsed > h3::after { transform: rotate(-90deg); }
.table-container.tbl-collapsed > :not(h3) { display: none !important; }

/* The year-in-Vine card folds the same way - its .year-head is the
   handle (the Copy button inside is exempt via the JS guard) */
.year-card .year-head { cursor: pointer; user-select: none; }
.year-card .year-head::after { content: '▾'; font-size: .8em; color: var(--text-secondary); transition: transform .15s; }
.year-card.year-collapsed .year-head::after { transform: rotate(-90deg); }
.year-card.year-collapsed > :not(.year-head) { display: none !important; }

/* Every block type folds the same way - the title element is the
   handle, a caret tracks the state, and everything below the title
   hides. eval-card keeps its whole header so the days counter stays
   visible while folded */
.dash-card > h3, .faq-block > h3 { cursor: pointer; user-select: none; display: flex; align-items: center; }
.dash-card > h3::after, .faq-block > h3::after,
.metric-card .metric-label::after, .eval-card .eval-title::after,
.vh-entry .vh-head::after {
  content: '▾'; font-size: .8em; color: var(--text-secondary);
  transition: transform .15s; flex-shrink: 0;
}
.dash-card > h3::after, .faq-block > h3::after { margin-left: auto; }
/* The head's free space used to split between the date's auto
   margin and the caret's, stranding the date mid-row - now only
   the date pushes right and the caret rides on its edge */
.vh-entry .vh-head::after { margin-left: 8px; }
.metric-card .metric-label::after, .eval-card .eval-title::after { margin-left: 8px; }
.tbl-collapsed > h3::after, .tbl-collapsed .metric-label::after,
.tbl-collapsed .eval-title::after, .tbl-collapsed .vh-head::after { transform: rotate(-90deg); }
.dash-card.tbl-collapsed > h3, .faq-block.tbl-collapsed > h3 { margin-bottom: 0; }
.dash-card.tbl-collapsed > :not(h3):not(.vh-head),
.faq-block.tbl-collapsed > :not(h3),
.metric-card.tbl-collapsed > :not(.metric-label),
.eval-card.tbl-collapsed > :not(.eval-header),
.vh-entry.tbl-collapsed > :not(.vh-head) { display: none !important; }
.metric-card .metric-label { cursor: pointer; user-select: none; display: flex; align-items: center; }
.eval-card .eval-title, .vh-entry .vh-head { cursor: pointer; user-select: none; }

/* Drag-to-reorder handles: card titles get a grab cursor, the dragged
   card itself dims so the gap reads as a live slot */
.card-grip { cursor: grab; }
.card-grip:active { cursor: grabbing; }
/* Blocks with no title element drag by their body - keep normal
   cursors over the controls inside so fields still read as fields */
.card-grip-self { cursor: grab; }
.card-grip-self :is(input,button,a,select,textarea,label,.faq-q,.faq-a) { cursor: auto; }
.card-grip-self :is(button,a) { cursor: pointer; }
.card-dragging { opacity: 0.45; }
/* The slot ghost: drags move THIS instead of the real card, so the
   layout under the cursor stays put and can't ping-pong */
.card-ghost {
  border: 1.5px dashed color-mix(in oklch, var(--theme-primary) 55%, var(--border-color));
  border-radius: 12px;
  background: color-mix(in oklch, var(--theme-primary) 7%, transparent);
  break-inside: avoid;
  margin-bottom: 16px;
}
.card-hidden { display: none !important; }

/* Modals */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background-color: var(--bg-card);
  padding: 2rem;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

/* Settings popup gets the drawers' glass skin - the same translucent
   tinted surface + blur/saturate backdrop filter, falling back to a
   neutral card tint since no --card-accent is set here */
#settingsModal .modal-content {
  background-color: color-mix(in oklch, color-mix(in oklch, var(--card-accent, var(--bg-card)) 26%, var(--bg-card)) 88%, transparent);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
}

/* Theme border + soft glow - same treatment the review viewer got */
#changelogModal .modal-content,
#settingsModal .modal-content {
  border: 1px solid var(--theme-primary);
  box-shadow: 0 0 18px color-mix(in oklch, var(--theme-primary) 38%, transparent);
}

.modal-content h2 {
  margin-bottom: 1.5rem;
  color: var(--theme-primary);
}

.auth-modal {
  max-width: 705px;
  border: 1px solid color-mix(in oklch, var(--theme-primary) 55%, var(--border-color));
}

/* Two-column login: form left, feature teaser right */
.auth-cols {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 26px;
  align-items: center;
}
@media (max-width: 600px) {
  .auth-cols { grid-template-columns: 1fr; }
  .auth-col-features { border-left: none; padding-left: 0; border-top: 1px solid var(--border-color); padding-top: 14px; }
}

/* Full logo lockup straight on the modal - the artwork is
   transparent, no white card needed */
.auth-logo {
  display: block;
  width: 240px;
  margin: 0 auto 0.75rem;
}

.auth-tagline {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin: -0.25rem 0 0.9rem;
  line-height: 1.4;
}

/* Feature teaser on the login modal - sells the waitlist */
.auth-col-features {
  padding-left: 20px;
  border-left: 1px solid var(--border-color);
}
.auth-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Full-width submit + the invite-only notice */
.auth-modal #authSubmit { width: 100%; }
#authInvite { text-align: center; }
/* The invite message must be unmissable - bold primary text inside a
   theme-tinted callout card */
.auth-invite-text {
  font-size: .95rem;
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.6;
  background: color-mix(in oklch, var(--theme-primary) 13%, var(--bg-input));
  border: 1px solid color-mix(in oklch, var(--theme-primary) 45%, var(--border-color));
  border-radius: 10px;
  padding: 14px 16px;
  margin: 4px 0 0;
}
.auth-invite-text a { color: var(--theme-primary); font-weight: 800; }
#authBackBtn { width: 100%; margin-top: 27px; }

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--bg-input);
  color: var(--text-primary);
  font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--theme-primary);
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  margin-top: 0.25rem;
  width: 1.25rem;
  height: 1.25rem;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: none;
  text-transform: uppercase;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary:hover {
  box-shadow: 0 0 20px var(--theme-glow);
}

.btn-primary {
  background-color: var(--theme-primary);
  border: 1px solid var(--theme-primary-dark);
  color: var(--on-accent);
  font-weight: 600;
}

.btn-primary:hover {
  background-color: var(--theme-primary-light);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  border-color: var(--theme-primary);
  color: var(--theme-primary);
}

.btn-danger {
  background-color: oklch(50% 0.18 25);
  border: 1px solid oklch(42% 0.16 25);
  color: oklch(97% 0 0);
  font-weight: 600;
}

.btn-danger:hover {
  background-color: oklch(57% 0.19 25);
  transform: translateY(-1px);
}

/* Danger Zone in settings - starts collapsed */
.danger-zone {
  margin-top: 1.5rem;
  border: 1px solid oklch(55% 0.15 25);
  border-radius: 10px;
  overflow: hidden;
  /* 50% darkened pane over a blurred modal backdrop */
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Export Data drawer: same collapsible shell, orange accent instead
   of danger red */
#exportZone {
  border-color: oklch(62% 0.16 60);
}

#exportZone .danger-zone-toggle {
  color: oklch(75% 0.15 60);
}

#exportZone .danger-zone-toggle:hover {
  background-color: oklch(55% 0.12 60 / 0.12);
}

.danger-zone-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1rem;
  background: none;
  border: none;
  color: oklch(65% 0.2 25);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
}

.danger-zone-toggle:hover {
  background-color: oklch(50% 0.1 25 / 0.1);
}

.danger-zone-arrow {
  transition: transform 0.2s;
}

.danger-zone:not(.collapsed) .danger-zone-arrow {
  transform: rotate(90deg);
}

.danger-zone.collapsed .danger-zone-content {
  display: none;
}

.danger-zone-content {
  padding: 0 1rem 1rem;
}

.danger-btns {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-start;
}

.btn-link {
  background: none;
  border: none;
  color: var(--theme-primary);
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: underline;
  padding: 0;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.modal-actions .btn {
  flex: 1;
}

.auth-switch {
  text-align: center;
  margin-top: 1.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Page Header */
.page-header {
  margin-bottom: 2rem;
}

.page-header h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  border-left: 4px solid var(--theme-primary);
  padding-left: 0.9rem;
  background: var(--theme-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 2px 8px var(--theme-glow));
  width: fit-content;
}

.page-header .subtitle {
  color: var(--text-secondary);
  text-transform: uppercase;
}

/* Flag icons (images because Windows cannot render flag emojis) */
.flag-icon {
  width: 1.15em;
  height: auto;
  border-radius: 2px;
  vertical-align: middle;
  display: inline-block;
  margin-left: 0.3em;
  margin-bottom: 0.15em;
}

/* Metric Cards */
.metrics-grid {
  display: grid;
  /* min() floor = 100% on narrow containers - the card never
     exceeds the viewport on phones */
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.metric-card {
  background-color: var(--bg-card);
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  border-top: 3px solid var(--theme-primary);
  transition: transform 0.2s, box-shadow 0.2s;
}

.metric-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 0 24px var(--theme-glow);
}

.metric-card .metric-label {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.metric-card .metric-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--theme-primary);
}

.metric-card .metric-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* Tables */
.table-container {
  background-color: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  overflow-x: auto;
  margin-bottom: 2rem;
  box-shadow: 0 0 20px oklch(0% 0 0 / 0.18);
  /* Card hugs the table: fit-content shrink-wraps to whatever the
     table's current width is (column resizes follow through), capped
     at the page width where the internal scrollbar takes over */
  width: fit-content;
  max-width: 100%;
}

.table-container h3 {
  padding: 1rem;
  color: var(--text-primary);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table-container h3::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 0.9em;
  background-color: var(--theme-primary);
  border-radius: 2px;
  margin-right: 0.6rem;
  vertical-align: -0.1em;
}

table {
  /* Auto layout + auto width = shrink-wrap: each column is sized to its
     content (header text is nowrap so a column is never narrower than
     its title on one line), and the table is exactly as wide as the
     sum of its columns - no stretching to fill the container */
  width: auto;
  border-collapse: collapse;
}

th,
td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  /* Opaque header - backdrop-filter over a scrolling table forced the
     browser to re-rasterize tiles every frame (the missing-blocks
     flicker); the header covers rows beneath it anyway */
  background-color: var(--bg-sidebar);
  color: var(--theme-primary);
  border-bottom: 2px solid var(--theme-primary);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Sticky header stays put while the table scrolls */
  position: sticky;
  top: 0;
  z-index: 6;
}

/* Sortable headers glow on hover so users know they're clickable */
th[data-column]:hover,
th.sortable-th:hover {
  color: var(--theme-primary-light);
  text-shadow: 0 0 10px var(--theme-glow);
}

th.sortable-th {
  cursor: pointer;
  user-select: none;
}

th.sortable-th.sorted-asc::after,
th.sortable-th.sorted-desc::after {
  font-size: 0.7em;
  opacity: 0.9;
  margin-left: 0.35em;
}

th.sortable-th.sorted-asc::after {
  content: '▲';
}

th.sortable-th.sorted-desc::after {
  content: '▼';
}

/* Column drag-resize handle (added by makeTableResizable) - a visible
   grip glyph hugging the inside edge of each header cell (th has
   overflow:hidden, so anything past the edge gets clipped away) */
.col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 12px;
  height: 100%;
  cursor: col-resize;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.col-resizer::after {
  content: '⋮';
  color: color-mix(in oklch, var(--theme-primary) 65%, transparent);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.col-resizer:hover::after,
th.resizing .col-resizer::after {
  color: var(--theme-primary);
  text-shadow: 0 0 8px var(--theme-glow);
}

/* Catalogue table: FIXED layout - every column is exactly its <th>
   width and cell content clips (ellipsis) instead of pushing the
   column wider, so drag-resized widths are honored down to the floor.
   width:auto = shrink-wrap: the table is exactly as wide as the sum of
   its columns. ANY wider width (max-content, 100%) becomes surplus
   that fixed layout redistributes across the columns - which was
   silently inflating Product Title and fighting every shrink drag */
#catalogueTable {
  table-layout: fixed;
  width: auto;
}

#catalogueTable td {
  white-space: nowrap;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* IMAGE column thumbs: theme border + centered glow on hover
   (resting transparent border so there's no layout shift) */
table td img {
  border: 1px solid transparent;
  transition: border-color 0.15s, box-shadow 0.15s;
}

table td img:hover {
  border-color: var(--theme-primary);
  box-shadow: 0 0 18px var(--theme-glow);
}

/* Product Title cells everywhere (catalogue + analytics tables) cap at
   the 480px the column is specified at - full title is on the cell's
   title attribute (hover). In auto-layout tables the nowrap+max-width
   is what keeps a long title from blowing the column wide open */
td.title-cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 480px;
}

td.title-cell {
  white-space: normal;
  overflow-wrap: break-word;
}

/* RFY table cells clamp to TWO lines with an ellipsis - title and
   category alike. The clamp needs -webkit-box, so it lives on an
   inner div: putting box layout on the td itself would forfeit
   table-cell behavior (width, vertical alignment) */
#rfyTable td.title-cell {
  overflow: hidden;
  max-width: 280px;
}
.rfy-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.3;
}

/* RFY card # badge adopts the drop's status accent (blue Available,
   green Ordered, red Gone) */
#rfyGrid .badge-seq {
  color: var(--card-accent);
}

/* Gallery: # and price badges adopt the order's status accent -
   same color as the status pill and the card border/glow. Unset-
   status cards keep the theme fallback */
#galleryGrid .badge-seq,
#galleryGrid .badge-price {
  color: var(--card-accent, var(--theme-primary-light));
}

/* Fixed-layout tables clip cell overflow cleanly */
td {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Links use the accent color */
a {
  color: var(--theme-primary);
}

a:hover {
  color: var(--theme-primary-light);
}

td a {
  font-weight: 600;
  text-decoration: none;
}

td a:hover {
  text-decoration: underline;
}

tbody tr:nth-child(even) {
  background-color: color-mix(in oklch, var(--bg-input) 55%, transparent);
}

tbody tr {
  transition: background-color 0.15s, box-shadow 0.15s;
}

tbody tr:hover {
  background-color: color-mix(in oklch, var(--theme-primary) 12%, var(--bg-input));
  box-shadow: inset 3px 0 0 var(--theme-primary);
}

/* Clean table edge - no dangling border under the last row */
tbody tr:last-child td {
  border-bottom: none;
}

.sub-total-row {
  background-color: var(--bg-input);
  border-top: 2px solid var(--theme-primary);
  color: var(--theme-primary);
  font-weight: 700;
}

.sub-total-row td {
  color: var(--theme-primary);
}

/* Status Pills - translucent 5% wash (white on dark, black on light)
   with the status color living in the text via statusColor(); the 8px
   radius matches the image-overlay badges on gallery cards */
.status-pill {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 500;
  background: oklch(100% 0 0 / 0.05);
}

[data-theme-mode="light"] .status-pill {
  background: oklch(0% 0 0 / 0.05);
}

/* Context suffix inside a status pill (Gifted→recipient, Kept→location)
   - quiet text so the pill keeps its subtle wash look; truncates
   rather than stretching the card */
.pill-suffix {
  color: var(--text-secondary);
  display: inline-block;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

/* Catalogue: recipient / where inputs under the status select */
.gifted-to-select,
.where-sold-select {
  display: block;
  width: 100%;
  margin-top: 4px;
}

/* Review Status - plain text with colored dot, not a button-looking pill */
.review-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 500;
}

.review-badge::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.review-pending {
  color: #e8d44d;
}

.review-pending::before {
  background-color: #e8d44d;
}

.review-cancelled {
  color: oklch(65% 0.02 260);
}

.review-cancelled::before {
  background-color: oklch(65% 0.02 260);
}

.review-unreviewable {
  color: #b48be8;
}

.review-unreviewable::before {
  background-color: #b48be8;
}

/* Catalogue review-status dropdown - sits inside the badge wrapper
   and borrows its colors, so it looks like the badge it replaces */
.review-select {
  color: inherit;
  background: transparent;
  border: none;
  font: inherit;
  padding: 0;
  min-width: 0;
  cursor: pointer;
}

.review-select:focus {
  outline: 1px solid currentColor;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Sell-countdown: months elapsed in the 6-month Vine resale wait.
   Progresses red -> orange -> yellow -> blue -> green (can sell) */
.sell-countdown {
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
}

/* :is() bumps specificity so these win over .card-badge's base color
   on gallery chips while still applying to countdown cells/drawer */
:is(.sell-countdown, .card-badge).sell-red {
  color: oklch(65% 0.2 25);
}

:is(.sell-countdown, .card-badge).sell-orange {
  color: oklch(72% 0.16 55);
}

:is(.sell-countdown, .card-badge).sell-yellow {
  color: oklch(82% 0.16 95);
}

:is(.sell-countdown, .card-badge).sell-blue {
  color: oklch(70% 0.15 240);
}

:is(.sell-countdown, .card-badge).sell-green {
  color: oklch(75% 0.18 145);
}

.price-input {
  width: 80px; /* overridden by .inline-edit's 100% - kept for non-table use */
}

.review-reviewed {
  color: oklch(75% 0.15 150);
}

.review-reviewed::before {
  background-color: oklch(75% 0.15 150);
}

/* Review quality score - same dot + text treatment as .review-badge */
.quality-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.quality-badge::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.quality-excellent { color: oklch(75% 0.16 150); }
.quality-excellent::before { background-color: oklch(75% 0.16 150); }
.quality-good { color: oklch(72% 0.14 240); }
.quality-good::before { background-color: oklch(72% 0.14 240); }
.quality-fair { color: oklch(75% 0.15 75); }
.quality-fair::before { background-color: oklch(75% 0.15 75); }
.quality-poor { color: oklch(70% 0.18 25); }
.quality-poor::before { background-color: oklch(70% 0.18 25); }

/* Catalogue pagination: numbered pages + Prev/Next, top and bottom */
.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
}

.pager:empty {
  display: none;
}

/* "1–250 of 1,317 items" - sits directly left of the page buttons,
   the pair center-aligned as one group */
.pager-range {
  margin-right: 8px; /* 8px + the pager's 6px gap = ~14px separation */
  color: var(--text-secondary);
  font-size: 0.8rem;
  white-space: nowrap;
}

.pager-btn {
  min-width: 34px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.pager-btn:hover:not(:disabled):not(.active) {
  border-color: var(--theme-primary);
  color: var(--theme-primary);
}

.pager-btn.active {
  background: var(--theme-primary);
  border-color: var(--theme-primary);
  color: var(--on-accent, #fff);
}

.pager-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Reseller Mode - Hidden by default. 'revert' restores each element's
   natural display (table-cell for th/td, block for cards) */
.reseller-only {
  display: none;
}

[data-reseller-mode="true"] .reseller-only {
  display: revert;
}

/* 'revert' restores UA defaults, not stylesheet layout - nav-link is
   display:flex, so the Reselling button would collapse to a tiny
   inline pill without this */
[data-reseller-mode="true"] .nav-link.reseller-only {
  display: flex;
}

/* Filter Bar - search and actions are visually separate groups */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.filter-search input[type="text"] {
  width: 100%;
}

/* Clearable search: wrap holds the input + the x button */
.search-wrap {
  position: relative;
  flex: 1;
  display: flex;
}
.search-wrap input[type="text"] {
  flex: 1;
  padding-right: 2rem;
}
.search-clear {
  position: absolute;
  right: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  padding: 0;
  font-size: 1.05rem;
  line-height: 1;
  color: var(--text-secondary);
  cursor: pointer;
  opacity: 0.7;
}
.search-clear:hover {
  opacity: 1;
  color: var(--text-primary);
}

.filter-actions {
  background-color: var(--bg-card);
  padding: 1rem 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

/* One-row filter bar: search input + bordered control group side by side */
.filter-bar-row {
  flex-direction: row;
  align-items: stretch;
  gap: 0.75rem;
}

.filter-bar-row .filter-search {
  flex: 1;
  display: flex;
}

.filter-bar-row .filter-search input[type="text"] {
  flex: 1;
}

.filter-controls {
  background-color: var(--bg-card);
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.export-btns {
  display: flex;
  gap: 0.5rem;
}

/* Global form control styling - no browser-default white boxes */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--theme-primary);
  box-shadow: 0 0 0 3px var(--theme-glow);
}

input::placeholder {
  color: var(--text-secondary);
}

input[type="checkbox"] {
  accent-color: var(--theme-primary);
}

.inline-edit {
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
  /* Fill the cell's content box - column drags resize the control in
     lockstep since the td's content box follows the column width */
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.filter-checkboxes {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.filter-checkboxes label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 1.5rem;
  /* .page-scroll has zero top padding, so row 1 sits flush at the
     scrollport edge - the hover lift + rotateX tilt pushed card tops
     past it and got clipped. This headroom keeps tilted cards whole */
  padding-top: 0.9rem;
}

.gallery-card {
  background-color: var(--bg-card);
  border-radius: 14px;
  /* --card-accent is the order's status color (set inline per card);
     every accent hooks into it so a Kept card reads blue, a Holding
     card orange, etc. Unset-status cards fall back to the page theme */
  border: 1px solid color-mix(in oklch, var(--card-accent, var(--theme-primary)) 55%, transparent);
  overflow: hidden;
  cursor: pointer;
  /* --rx/--ry are driven by mousemove in gallery.js - the card tilts
     toward the cursor for a modern 3D feel. Short transform transition
     keeps the tilt tracking the cursor tightly. */
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--lift, 0)) scale(var(--grow, 1));
  /* Only the tilt/lift eases (it smooths the mousemove tracking) -
     glow + border snap instantly, the 0.18s fades read as lag */
  transition: transform 0.09s ease-out;
  will-change: transform;
  box-shadow: 0 0 10px oklch(0% 0 0 / 0.2);
}

.gallery-card:hover {
  --lift: -7px;
  --grow: 1.02;
  border-color: var(--card-accent, var(--theme-primary));
  /* A 2px accent ring over the 1px border reads as a ~3px-thick edge
     without reflowing the card, plus the tinted glow */
  box-shadow: 0 0 0 2px var(--card-accent, var(--theme-primary)),
    0 0 44px color-mix(in oklch, var(--card-accent, var(--theme-primary)) 45%, transparent);
}

.gallery-card:hover .gallery-card-title {
  color: var(--card-accent, var(--theme-primary-light));
}

/* The review-status dot is dead space on the small corner chip -
   text alone is enough. Other badges (catalogue etc.) keep the dot */
.gallery-card .review-badge::before {
  display: none;
}

/* Touch devices can't hover - the tilt/lift state never changes, so
   the promoted compositor layer, transitions AND the glow/shadow
   paints are all pure overhead */
@media (hover: none) {
  .gallery-card {
    will-change: auto;
    transition: none;
    box-shadow: none;
  }
  .gallery-card:hover {
    box-shadow: none;
    transform: none;
  }
  .gallery-card:hover .gallery-card-imgwrap img {
    transform: none;
  }
}

/* Square image area - Amazon product photos are 1:1, so a square
   frame shows the whole image instead of cropping top and bottom */
.gallery-card-imgwrap {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: oklch(96% 0 0);
}

.gallery-card-imgwrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.18s ease;
}

.gallery-card:hover .gallery-card-imgwrap img {
  transform: scale(1.06);
}

/* Corner badges overlaid on the image - dark glass chips so they stay
   legible on the mostly-white product photos Amazon requires */
.card-badge {
  position: absolute;
  padding: 0.28rem 0.65rem;
  border-radius: 8px;
  background: oklch(18% 0 0 / 0.82);
  color: oklch(95% 0 0);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  max-width: 62%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 0 2px oklch(0% 0 0 / 0.6);
  pointer-events: none;
}

.badge-category {
  top: 8px;
  left: 8px;
}

.badge-price {
  top: 8px;
  right: 8px;
  color: var(--theme-primary-light);
}

/* RFY card price takes the card's status accent - Available reads
   blue, Ordered green, Gone red, all from one rule */
#rfyGrid .badge-price { color: var(--card-accent, var(--theme-primary-light)); }

/* Gone item - red price badge (both the 'N/A' no-price case and a
   real price kept on file after the item died) */
.badge-price-na,
.badge-price-gone,
.price-na {
  color: oklch(66% 0.19 22);
}

/* Price tag turns the Ordered green once the item is grabbed */
.badge-price-ordered {
  color: oklch(72% 0.16 155);
}

.badge-review {
  bottom: 8px;
  left: 8px;
  /* Smaller than the other corner chips - it read too intrusive at
     the shared size. Inner .review-badge inherits font metrics */
  padding: 0.16rem 0.45rem;
  font-size: 0.72rem;
}

/* The inner .review-badge sets its own 0.85rem/500 - inherit the
   chip's metrics so all four corner badges render identical text */
.badge-review .review-badge {
  font-size: inherit;
  font-weight: inherit;
}

.badge-sell {
  bottom: 8px;
  right: 8px;
}

/* Reseller-mode badge must stay positioned when shown */
.badge-sell.reseller-only {
  display: none;
}

[data-reseller-mode="true"] .badge-sell.reseller-only {
  display: inline-block;
}

.gallery-card-content {
  padding: 1rem;
  /* ~11% accent wash behind the text block - the card's status color
     carries from the border/glow into the info area. No accent set
     (statusless card) -> transparent, no tint */
  background-color: color-mix(in oklch, var(--card-accent, transparent) 11%, transparent);
  border-radius: 0 0 12px 12px;
}

/* The info-block text follows the status accent too - title, brand,
   seller and date all read in the same hue as the status pill */
.gallery-card-content .gallery-card-title {
  color: var(--card-accent, inherit);
}
.gallery-card-content .gallery-card-meta {
  color: var(--card-accent, var(--text-secondary));
}
.gallery-card-content .rfy-card-sub {
  color: var(--card-accent, var(--text-secondary));
}

.gallery-card-title {
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  /* Always reserve the 2-line clamp height so the meta row (date +
     status pill) sits at the same spot on 1-line titles too */
  line-height: 1.35;
  min-height: 2.7em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gallery-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.gallery-card-price {
  font-weight: 600;
  color: var(--theme-primary);
}

/* Evaluation countdown card */
.eval-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-top: 3px solid var(--theme-primary);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
}

.eval-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.eval-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.eval-sub {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.eval-days {
  text-align: right;
  flex-shrink: 0;
  margin-left: 1rem;
}

.eval-days-num {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--theme-primary);
  line-height: 1;
}

.eval-days-label {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.eval-bar {
  height: 14px;
  background-color: var(--bg-input);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.eval-bar-fill {
  height: 100%;
  background: linear-gradient(90deg,
    var(--theme-primary-dark) 0%,
    var(--theme-primary) 55%,
    var(--theme-primary-light) 100%);
  border-radius: 8px;
  transition: width 0.6s ease;
  box-shadow: 0 0 12px var(--theme-glow);
}

.eval-footer {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.eval-footer span:nth-child(2) {
  color: var(--text-primary);
  font-weight: 600;
}

/* Drawer backdrop - dims + blurs the page behind an open drawer */
.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 1000;
}

.drawer-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: -500px;
  width: 500px;
  height: 100%;
  /* Full status skin: the order's accent color tints the surface, the
     zebra stripes, the left border and the edge glow. The surface mix
     is strong enough to clearly read as the status hue - no neutral
     black/grey/white anywhere in the drawer - while body text keeps
     full contrast in both themes */
  background-color: color-mix(in oklch, var(--card-accent, var(--bg-card)) 18%, var(--bg-card));
  border-left: 2px solid color-mix(in oklch, var(--card-accent, var(--theme-primary)) 70%, transparent);
  box-shadow: -10px 0 60px color-mix(in oklch, var(--card-accent, var(--theme-primary)) 42%, oklch(0% 0 0 / 0.38));
  padding: 1.25rem 2rem 2rem;
  overflow-y: auto;
  /* Wheel scroll stays inside the drawer - when it hits its scroll
     limit, the page behind must not start scrolling */
  overscroll-behavior: contain;
  transition: right 0.15s ease;
  z-index: 1001;
}

.drawer.open {
  right: 0;
}

.drawer-image {
  width: 100%;
  height: 300px;
  object-fit: contain;
  /* Amazon product photos ship on white - keep the frame white in
     both modes so images blend into it instead of floating on dark */
  background-color: #ffffff;
  border: 1px solid color-mix(in oklch, var(--card-accent, var(--theme-primary)) 35%, transparent);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  box-shadow: 0 0 20px oklch(0% 0 0 / 0.2);
}

/* Standalone product title - centered above the image, clamped to
   3 lines (full text is in the hover tooltip), not a detail row so
   it stays out of the zebra alternation */
.drawer-product-title {
  font-weight: 600;
  font-size: 1.05rem;
  /* Plain readable title - the accent skin carries the status color,
     the title doesn't need to */
  color: var(--text-primary);
  line-height: 1.45;
  text-align: center;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.drawer-details {
  margin-bottom: 1.5rem;
}

.drawer-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0.6rem;
  border-bottom: 1px solid color-mix(in oklch, var(--card-accent, var(--border-color)) 32%, var(--border-color));
  border-radius: 6px;
}

/* Rows toggled by status (Gifted To / Location) carry .row-hidden
   instead of inline display:none so the :nth-child(even of ...)
   zebra selector can EXCLUDE them - a row inserted mid-list then
   shifts every stripe below it back into parity automatically */
.drawer-detail-row.row-hidden { display: none !important; }

/* Zebra rows match the tables so label->value is easy to track.
   Hidden rows (reseller-only or row-hidden) must not count toward
   the alternation - 'even of' strips only rows still in the visible
   set, so inserting/removing a row re-parities the whole list.
   Stripes are a deeper mix of the SAME accent, not a different hue */
body:not([data-reseller-mode="true"]) .drawer-detail-row:nth-child(even of :not(.reseller-only):not(.row-hidden)) {
  background-color: color-mix(in oklch, var(--card-accent, var(--bg-card)) 33%, var(--bg-card));
}

[data-reseller-mode="true"] .drawer-detail-row:nth-child(even of :not(.row-hidden)) {
  background-color: color-mix(in oklch, var(--card-accent, var(--bg-card)) 33%, var(--bg-card));
}

/* Notes field is a single line that fills the rest of its row -
   grows only vertically if the user drags the resize corner */
.drawer-detail-value:has(#drawerNotes) {
  flex: 1;
}

#drawerNotes {
  width: 100%;
  resize: vertical;
}

/* Reseller-mode rows must keep flex layout when shown */
.drawer-detail-row.reseller-only {
  display: none;
}

[data-reseller-mode="true"] .drawer-detail-row.reseller-only {
  display: flex;
}

.checkbox-label.reseller-only {
  display: none;
}

[data-reseller-mode="true"] .checkbox-label.reseller-only {
  display: flex;
}

.drawer-detail-label {
  /* Mostly the primary text color with an accent whisper - was
     secondary-dominant and read too dim against the tinted surface */
  color: color-mix(in oklch, var(--text-primary) 82%, var(--card-accent, var(--text-secondary)));
  font-size: 0.9rem;
  flex-shrink: 0;
}

.drawer-detail-value {
  font-weight: 500;
  text-align: right;
  min-width: 0;
}

.drawer-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

.drawer-actions .btn {
  flex: 1;
}

/* Drawer buttons take the status hue. SAVE = solid brightened accent:
   in dark mode the accents are already bright so they get dark text;
   in light mode the accents run deeper so they get white text. The
   secondary buttons (CLOSE, Upload) are the tinted-fill version -
   accent wash + accent outline + accent-leaning label text */
.drawer .btn-primary {
  background: color-mix(in oklch, var(--card-accent, var(--theme-primary)) 82%, oklch(18% 0 0));
  border: 1px solid color-mix(in oklch, var(--card-accent, var(--theme-primary)) 55%, oklch(28% 0 0));
  color: oklch(16% 0.03 0);
}
.drawer .btn-primary:hover {
  background: color-mix(in oklch, var(--card-accent, var(--theme-primary)) 92%, oklch(25% 0 0));
  box-shadow: 0 0 18px color-mix(in oklch, var(--card-accent, var(--theme-primary)) 45%, transparent);
}
[data-theme-mode="light"] .drawer .btn-primary {
  background: color-mix(in oklch, var(--card-accent, var(--theme-primary)) 78%, oklch(90% 0 0));
  border-color: color-mix(in oklch, var(--card-accent, var(--theme-primary)) 62%, oklch(72% 0 0));
  color: oklch(98% 0 0);
}
.drawer .btn-secondary {
  background: color-mix(in oklch, var(--card-accent, var(--bg-input)) 24%, var(--bg-input));
  border: 1px solid color-mix(in oklch, var(--card-accent, var(--border-color)) 55%, var(--border-color));
  color: color-mix(in oklch, var(--card-accent, var(--text-primary)) 65%, var(--text-primary));
}
.drawer .btn-secondary:hover {
  background: color-mix(in oklch, var(--card-accent, var(--bg-input)) 34%, var(--bg-input));
  border-color: var(--card-accent, var(--theme-primary));
  color: var(--card-accent, var(--theme-primary));
}

/* Drawer image opens the full-size lightbox */
.drawer-image {
  cursor: zoom-in;
}

/* Custom photo upload sits directly under the drawer image */
.drawer-upload-btn {
  width: 100%;
  margin-bottom: 4px;
  font-size: 0.85rem;
}

.drawer-upload-note {
  font-size: 0.78rem;
  text-align: center;
  min-height: 0;
  margin-bottom: 2px;
  color: var(--text-secondary);
}

.drawer-upload-note.ok {
  color: oklch(75% 0.15 150);
}

.drawer-upload-note.error {
  color: oklch(70% 0.18 25);
}

/* Review Score row in the drawer - read-only, colored per score.
   Unreviewable/unset use --text-secondary so they stay a quiet grey
   in both dark and light mode */
.score-excellent { color: oklch(75% 0.16 150); font-weight: 600; }
.score-good      { color: oklch(82% 0.16 95);  font-weight: 600; }
.score-fair      { color: oklch(72% 0.16 55);  font-weight: 600; }
.score-poor      { color: oklch(70% 0.18 25);  font-weight: 600; }
.score-unreviewable, .score-unset { color: var(--text-secondary); }

/* Full-screen image lightbox - dims + blurs everything behind the
   themed frame so the photo is the only focus */
.image-lightbox {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 2000;
}

.image-lightbox.show {
  opacity: 1;
  pointer-events: auto;
}

/* Page scroll is locked while the lightbox is up */
body.lightbox-open {
  overflow: hidden;
}

.lightbox-frame {
  background-color: var(--bg-card);
  border: 1px solid color-mix(in oklch, var(--theme-primary) 70%, transparent);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: 0 0 80px oklch(0% 0 0 / 0.55),
              0 0 36px var(--theme-glow);
  max-width: 92vw;
  max-height: 88vh;
  display: flex;
  transform: scale(0.94);
  transition: transform 0.25s ease;
}

.image-lightbox.show .lightbox-frame {
  transform: scale(1);
}

.lightbox-frame img {
  display: block;
  max-width: 100%;
  max-height: calc(88vh - 2.5rem);
  object-fit: contain;
  border-radius: 10px;
  /* Product photos ship on white - frame stays white in both modes */
  background-color: #ffffff;
  cursor: zoom-out; /* clicking the image closes the lightbox */
}

.lightbox-close {
  position: fixed;
  top: 1.25rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid color-mix(in oklch, var(--theme-primary) 55%, transparent);
  background-color: var(--bg-card);
  color: var(--text-secondary);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.lightbox-close:hover {
  color: var(--theme-primary);
  box-shadow: 0 0 18px var(--theme-glow);
  transform: scale(1.08);
}

/* Location Combobox */
.location-combobox {
  position: relative;
}

.location-combobox input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--bg-input);
  color: var(--text-primary);
}

.location-combobox-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  display: none;
}

.location-combobox-dropdown.show {
  display: block;
}

.location-combobox-option {
  padding: 0.75rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.location-combobox-option:hover {
  background-color: var(--theme-primary);
  color: var(--on-accent);
}

/* Responsive */
/* Column width + fit helpers for the catalogue table */
#catalogueTable td:nth-child(2),
#catalogueTable td:nth-child(4),
#catalogueTable td:nth-child(5),
#catalogueTable td:nth-child(13),
#catalogueTable td:nth-child(14) {
  white-space: nowrap;
}

/* Unset status select shows a dimmed placeholder */
select.status-unset {
  color: var(--text-secondary);
  font-style: italic;
}

/* Theme color swatch grid */
.theme-color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 36px);
  gap: 8px;
  padding: 4px 0;
}

.theme-swatch {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 2px solid var(--border-color);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  padding: 0;
}

.theme-swatch:hover {
  transform: scale(1.12);
}

.theme-swatch.selected {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 3px var(--theme-glow);
  transform: scale(1.12);
}

/* Text selection highlight uses the accent color */
::selection {
  background-color: var(--theme-primary);
  color: var(--on-accent);
}

::-moz-selection {
  background-color: var(--theme-primary);
  color: var(--on-accent);
}

/* Native select options - checked/highlighted option uses accent
   (supported in Firefox; Chrome styles the closed control only) */
select option:checked {
  background-color: var(--theme-primary);
  color: var(--on-accent);
}

select option:hover {
  background-color: var(--theme-primary);
  color: var(--on-accent);
}

/* Unset status pill - muted placeholder look */
.status-unset-pill {
  background-color: var(--bg-input);
  color: var(--text-secondary);
  font-style: italic;
  border: 1px dashed var(--border-color);
}

/* Flag select - custom dropdown for region pickers (shows flag images) */
.flag-select {
  position: relative;
}

.flag-select-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.95rem;
  cursor: pointer;
  text-align: left;
}

.flag-select-btn:hover {
  border-color: var(--theme-primary);
}

.flag-select-caret {
  margin-left: auto;
  color: var(--text-secondary);
}

.flag-select-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  max-height: 250px;
  overflow-y: auto;
  z-index: 60;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.3);
}

.flag-select-list.hidden {
  display: none;
}

.flag-select-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 0.95rem;
  cursor: pointer;
  text-align: left;
}

.flag-select-item:hover {
  background-color: var(--theme-primary);
  color: var(--on-accent);
}

.flag-select-item .flag-icon,
.flag-select-btn .flag-icon {
  margin-left: 0;
}

/* Light-mode readability adjustments */
[data-theme-mode="light"] .review-reviewed {
  color: oklch(45% 0.15 150);
}

/* The ::before dots must match their label's light variant or they
   stay bright while the text darkens */
[data-theme-mode="light"] .review-pending { color: oklch(55% 0.16 90); }
[data-theme-mode="light"] .review-pending::before { background-color: oklch(55% 0.16 90); }
[data-theme-mode="light"] .review-awaiting { color: #a84e14; }
[data-theme-mode="light"] .review-awaiting::before { background-color: #a84e14; }
[data-theme-mode="light"] .review-reviewed::before { background-color: oklch(45% 0.15 150); }
[data-theme-mode="light"] .review-cancelled { color: oklch(45% 0.02 260); }
[data-theme-mode="light"] .review-cancelled::before { background-color: oklch(45% 0.02 260); }
[data-theme-mode="light"] .review-unreviewable { color: oklch(45% 0.18 300); }
[data-theme-mode="light"] .review-unreviewable::before { background-color: oklch(45% 0.18 300); }

[data-theme-mode="light"] .quality-excellent { color: oklch(45% 0.16 150); }
[data-theme-mode="light"] .quality-good { color: oklch(45% 0.14 240); }
[data-theme-mode="light"] .quality-fair { color: oklch(48% 0.15 70); }
[data-theme-mode="light"] .quality-poor { color: oklch(45% 0.18 25); }
[data-theme-mode="light"] .quality-excellent::before { background-color: oklch(45% 0.16 150); }
[data-theme-mode="light"] .quality-good::before { background-color: oklch(45% 0.14 240); }
[data-theme-mode="light"] .quality-fair::before { background-color: oklch(48% 0.15 70); }
[data-theme-mode="light"] .quality-poor::before { background-color: oklch(45% 0.18 25); }

/* Score badges (drawer Review Score, dashboard score rows) */
[data-theme-mode="light"] .score-excellent { color: #1f8a4f; }
[data-theme-mode="light"] .score-good { color: #8a7008; }
[data-theme-mode="light"] .score-fair { color: #b3500f; }
[data-theme-mode="light"] .score-poor { color: #a82e2e; }

/* Sell-countdown on page surfaces gets deeper colors in light mode -
   card badges keep the bright set (they sit on a dark pill either way) */
[data-theme-mode="light"] .sell-countdown.sell-red { color: oklch(50% 0.2 25); }
[data-theme-mode="light"] .sell-countdown.sell-orange { color: oklch(52% 0.16 55); }
[data-theme-mode="light"] .sell-countdown.sell-yellow { color: oklch(50% 0.15 95); }
[data-theme-mode="light"] .sell-countdown.sell-blue { color: oklch(46% 0.15 240); }
[data-theme-mode="light"] .sell-countdown.sell-green { color: oklch(42% 0.18 145); }

/* Settings collapsible panels: light tint instead of dark */
[data-theme-mode="light"] .danger-zone { background: rgba(255, 255, 255, 0.55); }
[data-theme-mode="light"] #exportZone .danger-zone-toggle { color: oklch(58% 0.16 60); }

/* Misc accents that were tuned for dark surfaces only */
[data-theme-mode="light"] .tax-warning { color: #9c7208; }
[data-theme-mode="light"] .drawer-upload-note.ok { color: oklch(45% 0.15 150); }
[data-theme-mode="light"] .drawer-upload-note.error { color: oklch(48% 0.18 25); }


/* Nicer scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

*::-webkit-scrollbar {
  width: 13px;
  height: 13px;
}

*::-webkit-scrollbar-thumb {
  border-radius: 7px;
}

*::-webkit-scrollbar-thumb:hover {
  background-color: var(--theme-primary);
}

*::-webkit-scrollbar-track {
  background: transparent;
}

/* Theme-tinted scrollbar: the thumb carries ~38% of the mode's text
     color, so it brightens on dark mode and deepens on light mode -
     visible in both without shouting. Accent takes over on hover */
*::-webkit-scrollbar-thumb {
  background-color: color-mix(in oklch, var(--text-primary) 38%, transparent);
}
*::-webkit-scrollbar-thumb:hover {
  background-color: var(--theme-primary);
}

/* Subtle entrance lift for stable containers (not applied to gallery
   cards - they re-render on every keystroke and would flicker) */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-header,
.table-container,
.metric-card,
.eval-card,
.filter-bar {
  animation: fadeUp 0.35s ease-out both;
}

/* ---- Topbar account chip ---- */
.topbar{position:absolute;top:14px;right:20px;z-index:50;display:flex;align-items:center;gap:10px}

/* Daily quota pill - left of the notification bell. Mirrors the
   account-chip look; count greens at the daily cap */
.day-pill{display:flex;flex-direction:column;align-items:center;gap:1px;padding:5px 14px;border-radius:14px;border:1px solid var(--border-color);background:var(--bg-card);color:var(--text-primary);font-size:.88rem;font-weight:600;white-space:nowrap;cursor:pointer;transition:border-color .15s}
.day-pill:hover{border-color:var(--theme-primary)}
.day-pill .day-pill-row{display:flex;align-items:center;gap:6px}
.day-pill-sep{color:var(--text-secondary);font-weight:400}
.day-pill #dayPillValue{color:var(--text-primary);font-weight:600}
/* Yesterday's pick count - its own centered line under today's */
.day-pill-yest{display:block;text-align:center;font-size:.7rem;color:var(--text-secondary);font-weight:600;letter-spacing:.4px;text-transform:uppercase}
.day-pill.day-pill-full #dayPillCount{color:oklch(70% 0.17 145)}

/* Header notification bell + dropdown */
.notif-wrap{position:relative}
.notif-btn{position:relative;display:flex;align-items:center;justify-content:center;width:38px;height:38px;border-radius:50%;border:1px solid var(--border-color);background:var(--bg-card);color:var(--text-primary);cursor:pointer;font-size:1.05rem}
.notif-btn:hover{border-color:var(--theme-primary)}
.notif-badge{position:absolute;top:-4px;right:-4px;min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:var(--theme-primary);color:var(--on-accent,#fff);font-size:.68rem;font-weight:700;display:flex;align-items:center;justify-content:center;line-height:1}
/* RFY Radar nav badge - identical circle to the bell's notif-badge,
   anchored to the nav link's top-right corner */
.nav-badge{position:absolute;top:-4px;right:-4px;min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:var(--theme-primary);color:var(--on-accent,#fff);font-size:.68rem;font-weight:700;display:flex;align-items:center;justify-content:center;line-height:1}
.nav-badge.hidden{display:none}
.notif-dropdown{position:absolute;top:calc(100% + 8px);right:0;width:340px;max-height:420px;display:flex;flex-direction:column;background:var(--bg-card);border:1px solid var(--border-color);border-radius:12px;box-shadow:0 12px 34px rgba(0,0,0,.45);overflow:hidden;z-index:60}
.notif-head{display:flex;align-items:center;justify-content:space-between;padding:10px 14px;border-bottom:1px solid var(--border-color);font-weight:700;font-size:.85rem}
.notif-head button{background:none;border:none;color:var(--theme-primary);cursor:pointer;font:inherit;font-size:.78rem;font-weight:600;padding:0}
.notif-head button:hover{text-decoration:underline}
.notif-list{overflow-y:auto;flex:1}
.notif-empty{padding:24px;text-align:center;color:var(--text-secondary);font-size:.85rem}
.notif-item{display:flex;gap:10px;padding:11px 12px;border-bottom:1px solid var(--border-color);cursor:pointer;align-items:flex-start}
.notif-item:last-child{border-bottom:none}
.notif-item:hover{background:oklch(100% 0 0 / 0.04)}
[data-theme-mode="light"] .notif-item:hover{background:oklch(0% 0 0 / 0.04)}
.notif-item-icon{font-size:1.05rem;line-height:1.3}
.notif-item-text{flex:1;min-width:0}
.notif-item-title{font-size:.85rem;font-weight:600;line-height:1.3}
.notif-item-body{font-size:.78rem;color:var(--text-secondary);margin-top:2px;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.notif-item-time{font-size:.68rem;color:var(--text-secondary);margin-top:3px;opacity:.75}
.notif-item-x{background:none;border:none;color:var(--text-secondary);cursor:pointer;font-size:.8rem;padding:2px 4px;align-self:center}
.notif-item-x:hover{color:var(--text-primary)}

/* Zebra striping - alternating rows stay distinguishable at a glance */
.notif-item:nth-child(even){background:oklch(100% 0 0 / 0.035)}
[data-theme-mode="light"] .notif-item:nth-child(even){background:oklch(0% 0 0 / 0.03)}
.notif-item:nth-child(even):hover{background:oklch(100% 0 0 / 0.06)}
[data-theme-mode="light"] .notif-item:nth-child(even):hover{background:oklch(0% 0 0 / 0.06)}

/* Subtle footer link under the dropdown list - "View all" leads to
   the Notification History page */
.notif-foot{border-top:1px solid var(--border-color)}
.notif-foot button{width:100%;padding:9px;background:none;border:none;color:var(--text-secondary);font-size:.78rem;font-weight:600;cursor:pointer;letter-spacing:.3px}
.notif-foot button:hover{color:var(--text-primary);background:oklch(100% 0 0 / 0.04)}
[data-theme-mode="light"] .notif-foot button:hover{background:oklch(0% 0 0 / 0.04)}

/* Notification History page - same row anatomy as the dropdown, full
   width, no delete controls. Every row renders at full strength; a
   NEW chip marks whatever is under an hour old instead of dimming
   the rest */
.notif-history{max-width:1210px;margin:0 auto}
.notif-history-item{border-bottom:1px solid var(--border-color)}
.notif-new-chip{display:inline-block;font-size:.6rem;font-weight:800;letter-spacing:.6px;color:oklch(75% 0.15 150);border:1px solid oklch(75% 0.15 150);border-radius:4px;padding:1px 5px;margin-left:6px;vertical-align:middle}
.notif-history-more{text-align:center;padding:18px 0 8px}
/* History page runs a size up from the compact dropdown metrics */
.notif-history .notif-item-title{font-size:1rem;font-weight:600}
.notif-history .notif-item-body{font-size:.92rem}
.notif-history .notif-item-time{font-size:.8rem}
.notif-history .notif-item{padding:13px 14px}
.notif-history-bar{display:flex;align-items:center;gap:10px;max-width:1210px;margin:0 auto 14px}
.notif-pager{display:flex;align-items:center;justify-content:center;gap:6px;flex-wrap:wrap;padding:18px 0 8px}
.notif-page-btn{min-width:38px;padding:6px 10px}
.notif-page-ellipsis{color:var(--text-secondary);padding:0 4px}

/* RFY table viewport - ~10 rows tall, scrolls inside the current
   page; header sticks while scrolling. Fixed layout + the declared
   column widths scaling down means the table fits its container -
   a horizontal scrollbar only appears on truly narrow viewports */
.rfy-table-scroll{max-height:600px;overflow-y:auto;overflow-x:auto}
.rfy-table-scroll thead th{position:sticky;top:0;z-index:2;background:var(--bg-card)}
#rfyTable{width:100%;min-width:620px;table-layout:fixed}
/* .table-container's fit-content shrink-wrap sized itself to the
   table's ~1250px preferred width, then overflowed the column -
   that was the phantom scrollbar. Full-width here instead, and its
   own overflow locked off - only .rfy-table-scroll may scroll, and
   only when resized columns or a tiny viewport actually need it */
.table-container:has(.rfy-table-scroll){width:100%;overflow-x:hidden}
#rfyPager:empty{display:none}

/* New-order status prompt - dims+blurs the whole site behind it;
   only an answer or the × dismisses (no backdrop-click, no ESC) */
.op-backdrop{position:fixed;inset:0;z-index:400;display:flex;align-items:center;justify-content:center;background:oklch(8% 0 0 / 0.6);backdrop-filter:blur(10px) saturate(1.05);-webkit-backdrop-filter:blur(10px) saturate(1.05);padding:20px;animation:opFade .18s ease}
@keyframes opFade{from{opacity:0}to{opacity:1}}
.op-card{position:relative;max-width:460px;width:100%;background:color-mix(in oklch, var(--bg-card) 90%, transparent);border:1px solid color-mix(in oklch, var(--theme-primary) 45%, var(--border-color));border-radius:16px;padding:22px;box-shadow:0 18px 60px oklch(0% 0 0 / 0.5),0 0 34px color-mix(in oklch, var(--theme-primary) 20%, transparent);backdrop-filter:blur(16px) saturate(1.15)}
.op-card-wide{max-width:520px}
.op-close{position:absolute;top:10px;right:10px;width:26px;height:26px;border-radius:7px;border:1px solid var(--border-color);background:var(--bg-input);color:var(--text-secondary);cursor:pointer;font-size:.72rem;line-height:1;display:flex;align-items:center;justify-content:center}
.op-close:hover{color:var(--text-primary);border-color:var(--theme-primary)}
.op-counter{margin-top:12px;font-size:.68rem;font-weight:700;letter-spacing:.4px;color:var(--text-secondary);text-transform:uppercase;text-align:center}
.op-head{font-size:.72rem;font-weight:800;letter-spacing:.6px;text-transform:uppercase;color:var(--theme-primary);margin-bottom:14px;padding-right:30px}
.op-body{display:flex;gap:14px;align-items:flex-start;margin-bottom:16px}
.op-img{width:96px;height:96px;object-fit:contain;border-radius:10px;background:oklch(100% 0 0 / 0.06);border:1px solid var(--border-color);flex-shrink:0}
.op-info{min-width:0}
.op-title{font-size:.98rem;font-weight:600;line-height:1.35;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.op-meta{margin-top:6px;font-size:.82rem;color:var(--text-secondary)}
.op-statuses{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.op-status-btn{padding:9px 6px;border-radius:9px;border:1.5px solid;background:transparent;font:inherit;font-weight:700;font-size:.82rem;cursor:pointer;transition:background .12s,transform .12s}
.op-status-btn:hover{background:oklch(100% 0 0 / 0.07);transform:translateY(-1px)}
.op-status-btn:disabled{opacity:.5;cursor:default;transform:none}
.op-bulk-icon{font-size:2.2rem;text-align:center;margin:8px 0 10px}
.op-sub{font-size:.85rem;color:var(--text-secondary);text-align:center;margin:8px 0 16px}
/* Step-2 detail picker (Gifted->recipient, Kept->location) */
.op-mini{font-size:.8rem;color:var(--text-secondary);margin:-6px 0 12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.op-chips{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:12px;max-height:120px;overflow-y:auto}
.op-chip{padding:6px 12px;border-radius:999px;border:1px solid color-mix(in oklch, var(--theme-primary) 55%, var(--border-color));background:transparent;color:var(--text-primary);font:inherit;font-size:.78rem;font-weight:600;cursor:pointer;transition:background .12s,border-color .12s}
.op-chip:hover{background:color-mix(in oklch, var(--theme-primary) 18%, transparent);border-color:var(--theme-primary)}
.op-input{width:100%;padding:9px 12px;border-radius:9px;border:1px solid var(--border-color);background:var(--bg-input);color:var(--text-primary);font:inherit;font-size:.85rem;margin-bottom:14px;box-sizing:border-box}
.op-input:focus{outline:none;border-color:var(--theme-primary)}
.op-actions{display:flex;justify-content:flex-end;gap:8px}
.op-actions .btn-primary{display:inline-block;margin:0;padding:9px 26px}
.op-actions .btn-secondary{padding:9px 18px}
.op-card .btn-primary{display:block;margin:0 auto;padding:9px 26px}

/* Version-tag changelog popup - truncated top-5 view of the newest
   release, then a hop to the full Changelog page. ~16px of air on
   both sides of the version/date row keeps the header tight */
#changelogModal .modal-hero{margin-bottom:16px}
.cl-head{display:flex;justify-content:space-between;align-items:baseline;margin-bottom:16px;line-height:1.2}
.cl-ver{font-size:1.15rem;font-weight:800;color:var(--theme-primary);letter-spacing:.3px}
.cl-date{font-size:.78rem;color:var(--text-secondary)}
.cl-list{list-style:none;padding:0;margin:0 0 14px;display:flex;flex-direction:column;gap:8px}
.cl-list li{font-size:.88rem;line-height:1.4;padding-left:14px;position:relative;color:var(--text-primary)}
.cl-list li::before{content:'';position:absolute;left:0;top:.55em;width:6px;height:6px;border-radius:50%;background:var(--theme-primary)}
.cl-more{font-size:.82rem;font-weight:700;letter-spacing:.4px;color:var(--theme-primary);text-decoration:none;text-transform:uppercase}
.cl-more:hover{text-decoration:underline}
.account-chip{display:flex;align-items:center;gap:9px;padding:5px 12px 5px 14px;border-radius:22px;border:1px solid var(--border-color);background:var(--bg-card);color:var(--text-primary);cursor:pointer;font:inherit}
.account-chip:hover{border-color:var(--theme-primary)}
.account-avatar{width:30px;height:30px;border-radius:50%;background:var(--theme-primary);color:var(--on-accent);display:flex;align-items:center;justify-content:center;font-weight:700;font-size:.9rem;overflow:hidden;flex-shrink:0}
.account-avatar img{width:100%;height:100%;object-fit:cover}
.account-name{font-size:.85rem;max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* ---- Notification toasts ---- */
.notify-host{position:fixed;bottom:18px;right:18px;z-index:9999;display:flex;flex-direction:column;gap:10px;max-width:340px}
.notify-toast{display:flex;gap:10px;align-items:flex-start;background:var(--bg-card);border:1px solid var(--border-color);border-left:3px solid var(--theme-primary);border-radius:10px;padding:12px 14px;cursor:pointer;box-shadow:0 0 24px rgba(0,0,0,.35);animation:notify-in .25s ease}
@keyframes notify-in{from{transform:translateX(30px);opacity:0}to{transform:none;opacity:1}}
.notify-icon{font-size:1.2rem;line-height:1}
.notify-title{font-weight:600;font-size:.9rem}
.notify-body{font-size:.8rem;color:var(--text-secondary);margin-top:3px}
.notify-close{margin-left:auto;background:none;border:none;color:var(--text-secondary);cursor:pointer;font-size:.8rem}

/* ---- Dashboard ---- */
.page-sub{color:var(--text-secondary);font-size:.85rem;margin:4px 0 0}
/* Masonry card areas: CSS columns make every card exactly as tall as
   its content (grid rows used to stretch all cards to the tallest).
   380px column width mirrors the old auto-fill minimum - one column
   on narrow screens, and card DOM order flows down each column so
   drag-reorder works everywhere */
/* Masonry = real flex-column drop zones. JS counts the columns that
   fit (~396px each) and deals cards across them, so a card can be
   dropped into ANY column - including an empty one, which only
   claims width while a drag is active. The .vr-masonry wrapper holds
   the columns inside ANY container (grid, flex or block) so non-card
   siblings keep their normal flow; grid-column makes it span the
   full row when the parent is a grid (metrics-grid, acct-grid,
   aging-grid) */
.dash-grid{display:block;margin-top:16px}
.vr-masonry{display:flex;align-items:flex-start;gap:16px;grid-column:1/-1;min-width:0;margin-bottom:16px}
.masonry-col{display:flex;flex-direction:column;gap:16px;flex:1 1 0;min-width:0}
.masonry-col>*{min-width:0}
.masonry-col:empty{flex:0 0 0}
/* vr-solo = its own full-width row: the card fills the row AND its
   table stretches too. Without this a slim table (few narrow cols)
   shrink-wraps via fit-content and looks stuck in a masonry column */
.vr-solo{width:100%}
.vr-solo.table-container table{width:100%}
.vr-masonry.drag-active .masonry-col:empty{
  flex:1 1 0;min-width:180px;min-height:120px;
  outline:1.5px dashed color-mix(in oklch,var(--theme-primary) 45%,transparent);
  border-radius:12px;
}
.dash-card{background:var(--bg-card);border:1px solid var(--border-color);border-radius:12px;padding:18px}
.dash-card h3{margin:0 0 10px;font-size:.95rem}
.dash-big{font-size:2rem;font-weight:700;color:var(--theme-primary)}
.dash-num{font-size:1.4rem;font-weight:800}
.dash-num-sm{font-size:.82rem;color:color-mix(in oklch,var(--text-secondary) 72%,var(--text-primary));margin-top:6px}
.dash-lbl{font-size:.78rem;color:color-mix(in oklch,var(--text-secondary) 78%,var(--text-primary));line-height:1.45}
.dash-note{font-size:.82rem;color:color-mix(in oklch,var(--text-secondary) 72%,var(--text-primary))}

/* Review Standing: the two headline ratios share one size and wear
   fixed semantic hues - period in green, all-time in indigo, never
   the theme color */
.pct-period{color:oklch(72% 0.17 150)}
.pct-alltime{color:oklch(74% 0.13 268)}
[data-theme-mode="light"] .pct-period{color:#1f8a4f}
[data-theme-mode="light"] .pct-alltime{color:#4a3fc9}

/* Labeled stat rows replace the old run-on paragraph: quiet key on
   the left, value right-aligned and colored by what it means */
.dash-stats{display:flex;flex-direction:column;gap:1px;margin-top:14px;border-top:1px solid var(--border-color);padding-top:9px}
.dash-stat{display:flex;justify-content:space-between;align-items:baseline;gap:12px;padding:3px 0;font-size:.84rem}
.dash-stat-k{font-size:.7rem;font-weight:700;letter-spacing:.5px;text-transform:uppercase;color:var(--text-secondary);flex-shrink:0}
.dash-stat-v{font-weight:700;text-align:right}
.dash-stat-v.ok{color:oklch(75% 0.16 150)}
.dash-stat-v.warn{color:oklch(78% 0.16 75)}
.dash-stat-v.await{color:#e07b3c}
.dash-stat-v.dim{color:var(--text-primary)}
.dash-tier{margin-top:10px;padding-top:8px;border-top:1px solid var(--border-color);font-size:.74rem;color:var(--text-secondary);line-height:1.55}

/* Values get the weight, labels stay quiet - applies to every
   score-row block on the dashboard (Sync Health included) */
.dash-score-row>span:last-child{font-weight:700}
.dash-score-pct{color:var(--text-secondary);font-weight:400;font-size:.78rem}
.metric-card .metric-sub{color:color-mix(in oklch,var(--text-secondary) 72%,var(--text-primary))}
.dash-grid-3{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;text-align:center}
.dash-grid-2{display:grid;grid-template-columns:repeat(2,1fr);gap:10px;text-align:center}
.dash-score-row{display:flex;justify-content:space-between;font-size:.85rem;padding:3px 0}
.score-excellent{color:#3ecf6e}.score-good{color:#e8d44d}.score-fair{color:#f0962f}.score-poor{color:#e5534b}

/* ---- Live Feed ---- */
.feed-count{font-size:.82rem;color:var(--text-secondary);margin:12px 0}
.feed-grid{display:flex;flex-direction:column;gap:10px}
.feed-card{display:flex;align-items:center;gap:14px;background:var(--bg-card);border:1px solid var(--border-color);border-radius:10px;padding:10px 14px}
.feed-card.feed-new{border-left:3px solid var(--theme-primary)}
.feed-img{width:64px;height:64px;object-fit:contain;flex-shrink:0}
.feed-info{flex:1;min-width:0}
.feed-title{color:var(--text-primary);text-decoration:none;font-size:.9rem;display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.feed-title:hover{color:var(--theme-primary)}
.feed-meta{display:flex;gap:14px;font-size:.75rem;color:var(--text-secondary);margin-top:4px}
.feed-order{white-space:nowrap;flex-shrink:0}
.feed-empty{padding:30px;text-align:center;color:var(--text-secondary)}

/* ---- Tax ---- */
.tax-controls{display:flex;gap:14px;align-items:center;margin:14px 0}
.tax-controls select,.tax-controls input{font:inherit}
.tax-h3{margin:22px 0 10px}
.tax-table{width:100%;border-collapse:collapse;background:var(--bg-card);border:1px solid var(--border-color);border-radius:10px;overflow:hidden}
.tax-table th,.tax-table td{padding:9px 14px;text-align:left;font-size:.87rem;border-bottom:1px solid var(--border-color)}
.tax-table th{color:var(--text-secondary);font-weight:600}
.tax-total td{border-bottom:none;background:var(--bg-input)}
.tax-warning{color:#e8b33f;font-size:.85rem;margin:12px 0}
.tax-disclaimer{color:var(--text-secondary);font-size:.8rem;margin:16px 0;line-height:1.5}

/* ---- Account ---- */
.acct-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(380px,100%),1fr));gap:16px;margin-top:16px}
.acct-profile{display:flex;flex-direction:column;align-items:center;text-align:center}
.acct-avatar{width:96px;height:96px;border-radius:50%;object-fit:cover;margin-bottom:10px}
.acct-initial{background:var(--theme-primary);color:var(--on-accent);display:flex;align-items:center;justify-content:center;font-size:2.4rem;font-weight:700}
.acct-rows{width:100%;margin-top:14px;text-align:left}
.acct-row{display:flex;justify-content:space-between;font-size:.85rem;padding:6px 0;border-bottom:1px solid var(--border-color)}
.acct-row:last-child{border-bottom:none}
.acct-plan{color:var(--theme-primary);font-weight:600}
.acct-actions{display:flex;gap:10px;margin-top:14px}
.acct-save-row{margin-top:16px;text-align:right}
.np-list{display:flex;flex-direction:column;gap:4px;margin:8px 0 0 18px}
#acctAddresses{width:100%;background:var(--bg-input);color:var(--text-primary);border:1px solid var(--border-color);border-radius:8px;padding:9px;font:inherit;resize:vertical}

/* ---- Help / FAQ ---- */
/* No max-width - the masonry columns inside size to the window like
   every other page (860px pinned Help at 2 columns forever) */
.faq{margin-top:8px}
.faq h3{margin:24px 0 10px;color:var(--theme-primary)}
.faq-q{font-weight:600;font-size:.92rem;margin:14px 0 4px}
.faq-a{color:var(--text-secondary);font-size:.87rem;line-height:1.55}

/* ---- Fixes + additions round 2 ---- */
.hidden{display:none!important}
.topbar .account-avatar{background:var(--theme-primary);color:var(--on-accent)}
/* An uploaded avatar keeps the theme circle ONLY for the letter
   fallback - a real photo/transparent PNG sits on the same card
   surface as the rest of the chip */
.account-avatar:has(img){background:var(--bg-card)}
img.acct-avatar{background:var(--bg-card)}

/* Page hero banner - full-bleed top strip, per-page gradient */
.page-body .page-header h1{display:none}
.page-hero{flex-shrink:0;height:110px;margin:0 0 2.75rem;position:relative;overflow:hidden;
  --hero-a:#6d6de8;--hero-b:#171233;--hero-c:#0d0d16;
  background:linear-gradient(120deg,var(--hero-b) 0%,color-mix(in oklch,var(--hero-a) 45%,var(--hero-b)) 55%,var(--hero-c) 100%)}
.page-hero::before{content:"";position:absolute;inset:0;opacity:.45;
  background:repeating-linear-gradient(115deg,transparent 0 46px,color-mix(in oklch,var(--hero-a) 18%,transparent) 46px 48px)}
.page-hero::after{content:"";position:absolute;inset:0;
  background:radial-gradient(700px 160px at 85% 40%,color-mix(in oklch,var(--hero-a) 55%,transparent),transparent 70%)}
/* Hero accents reuse the nav rainbow exactly - each page's banner
   is the same hue as its sidebar button, deepening to a dark base
   of the same tint. Notifications keeps its standalone gold (it
   lives behind the bell, not the rainbow nav) */
.hero-dashboard{--hero-a:oklch(60% 0.2 25);--hero-b:oklch(22% 0.05 25)}
.hero-analytics{--hero-a:oklch(65% 0.18 50);--hero-b:oklch(24% 0.05 50)}
.hero-gallery{--hero-a:oklch(78% 0.15 90);--hero-b:oklch(26% 0.05 90)}
.hero-catalogue{--hero-a:oklch(65% 0.17 150);--hero-b:oklch(22% 0.05 150)}
.hero-tax{--hero-a:oklch(58% 0.18 265);--hero-b:oklch(22% 0.05 265)}
.hero-help{--hero-a:oklch(60% 0.17 290);--hero-b:oklch(22% 0.05 290)}
.hero-account{--hero-a:oklch(58% 0.17 312);--hero-b:oklch(22% 0.05 312)}
.hero-admin{--hero-a:oklch(58% 0.17 328);--hero-b:oklch(22% 0.05 328)}
.hero-reviews{--hero-a:oklch(65% 0.15 190);--hero-b:oklch(22% 0.05 190)}
.hero-rfydrops{--hero-a:oklch(62% 0.15 215);--hero-b:oklch(22% 0.05 215)}
.hero-reselling{--hero-a:oklch(58% 0.17 240);--hero-b:oklch(22% 0.05 240)}
.hero-notifications{--hero-a:#c9a83c;--hero-b:#2e260d}
.hero-versionhistory{--hero-a:oklch(60% 0.17 312);--hero-b:oklch(22% 0.05 312)}
.hero-settings{--hero-a:oklch(58% 0.17 342);--hero-b:oklch(22% 0.05 342)}

/* Mini hero strip for popups - same gradient/stripes/glow recipe as
   .page-hero, cropped to a banner inside the modal's rounded top */
.modal-hero{height:76px;margin:-2rem -2rem 1.5rem;position:relative;overflow:hidden;flex-shrink:0;
  --hero-a:var(--theme-primary);--hero-b:#171233;
  background:linear-gradient(120deg,var(--hero-b) 0%,color-mix(in oklch,var(--hero-a) 45%,var(--hero-b)) 55%,var(--hero-c,#0d0d16) 100%)}
.modal-hero::before{content:"";position:absolute;inset:0;opacity:.45;
  background:repeating-linear-gradient(115deg,transparent 0 46px,color-mix(in oklch,var(--hero-a) 18%,transparent) 46px 48px)}
.modal-hero::after{content:"";position:absolute;inset:0;
  background:radial-gradient(500px 110px at 85% 40%,color-mix(in oklch,var(--hero-a) 55%,transparent),transparent 70%)}
.modal-hero .modal-hero-title{position:absolute;left:24px;bottom:20px;z-index:2;font-size:1.35rem;font-weight:800;color:#fff;text-shadow:0 0 10px rgba(0,0,0,.5);letter-spacing:.3px;text-transform:uppercase}
/* Title sits at the same top line as the topbar cluster (bell/avatar)
   instead of floating in the hero's vertical center */
.page-hero .hero-title{position:absolute;left:30px;top:39px;z-index:2;font-size:2.1rem;font-weight:800;color:#fff;text-shadow:0 0 10px rgba(0,0,0,.5);letter-spacing:.3px;line-height:1.25}

/* Dashboard grid fixes */
.dash-grid-3{grid-template-columns:repeat(auto-fit,minmax(88px,1fr))}
.dash-grid-3>div{min-width:0}
.dash-num{font-size:clamp(1rem,1.6vw,1.4rem);overflow:hidden;text-overflow:ellipsis}

/* Version tag + changelog */
.version-tag{position:fixed;bottom:8px;right:10px;z-index:9998;font-size:9.5px;letter-spacing:.5px;color:var(--text-secondary);opacity:.81;cursor:pointer;user-select:none}
.version-tag:hover{opacity:1}
/* normal, not pre-wrap: the markup branch renders template newlines
   as visible blank lines otherwise. The plain-text fallback opts
   back into pre-wrap via .cl-pre */
.changelog-body{max-height:50vh;overflow-y:auto;white-space:normal;font-size:.88rem;line-height:1.6;color:var(--text-secondary)}
.changelog-body.cl-pre{white-space:pre-wrap}

/* Admin */
body.is-admin .admin-nav-btn{display:flex;align-items:center;gap:8px}
.admin-code{font-family:monospace;color:var(--theme-primary)}
.acct-save-row .btn{width:100%}
/* Awaiting: same dot+text treatment as the other statuses, in orange */
.review-awaiting{color:#e07b3c}
.review-awaiting::before{background-color:#e07b3c}
.faq-legend{font-size:.78rem;color:var(--text-secondary);margin:8px 0 18px;line-height:1.5}
.faq .table-container{margin:6px 0 14px}

/* ---- Round-3 polish ---- */
.page-body .page-header{display:none}
/* Hero reads taller (+15%) and dissolves at its bottom edge - the
   mask fades the lowest 15% to transparent so the hero melts into
   the page instead of ending on a hard line. The v-centered title
   sits above the fade band */
.page-hero{height:137px;-webkit-mask-image:linear-gradient(to bottom,oklch(0% 0 0) 78%,transparent 100%);mask-image:linear-gradient(to bottom,oklch(0% 0 0) 78%,transparent 100%)}
/* Unified card titles: every stat/card header across the site shares
   one voice - bold, small-caps, full-contrast text with an accent
   undercut so it reads as a title at a glance */
/* Card/block titles get the same left accent bar as table-container
   h3 (3px x .9em theme-colored tick) instead of the old underline */
.dash-card h3,.metric-card .metric-label,.eval-title{
  font-size:.82rem;font-weight:800;letter-spacing:.7px;text-transform:uppercase;
  color:var(--text-primary);margin:0 0 10px;
}
.dash-card h3::before,.metric-card .metric-label::before,.eval-title::before{
  content:'';display:inline-block;width:3px;height:.9em;
  background-color:var(--theme-primary);border-radius:2px;
  margin-right:.6rem;vertical-align:-.1em;
}
.metric-card .metric-label{display:block;width:fit-content}
/* NEW ribbon sits over the seq badge's corner - nudge the pill right
   just enough that its text clears the diagonal tag */
.badge-seq-offset{left:28px}
/* Version History timeline */
.vh-timeline{display:flex;flex-direction:column;gap:1.25rem}
.vh-head{display:flex;align-items:center;gap:10px;margin-bottom:10px;flex-wrap:wrap}
.vh-ver{font-size:1.15rem;font-weight:800;color:var(--theme-primary)}
.vh-tag{font-size:.65rem;font-weight:800;letter-spacing:.8px;text-transform:uppercase;background:var(--theme-primary);color:#fff;padding:2px 8px;border-radius:99px}
.vh-tag{color:oklch(99% 0 0)}
.vh-date{margin-left:auto;font-size:.8rem;color:var(--text-secondary)}
.vh-list{margin:0;padding-left:1.15rem;display:flex;flex-direction:column;gap:.35rem}
.vh-list li{font-size:.9rem}
.table-container h3{margin:0;padding:.85rem 1rem}
.dash-grid{margin-bottom:1.25rem}
th,td{padding:.55rem .8rem}
#catalogueTable th,#catalogueTable td{padding:1rem}
.cell-center{text-align:center}

.hero-title{text-transform:uppercase}
/* Kept just above the 26px overlap band where .page-scroll slides
   over the hero's bottom - any lower and scrolling content covers it */
.hero-sub{position:absolute;right:30px;bottom:34px;z-index:2;font-size:.7rem;font-weight:700;letter-spacing:1.5px;text-transform:uppercase;color:rgba(255,255,255,.72);text-align:right;max-width:55%}

.account-name{text-transform:uppercase}
.account-chip .flag-icon{width:20px;height:auto;border-radius:2px;display:block;transform:translateY(1.5px)}

.admin-nav-btn{display:none;width:100%;padding:.75rem;margin-bottom:.5rem;border-radius:8px;cursor:pointer;font-family:inherit;font-size:.9rem;font-weight:600;text-transform:uppercase;align-items:center;justify-content:center;gap:8px;white-space:nowrap;transition:all .2s}
body.is-admin .admin-nav-btn{display:flex}

/* Fixed, not absolute - the giant emoji stays glued to the bottom-
   right of the viewport while the page scrolls beneath it */
.page-watermark{position:fixed;bottom:-35px;right:-92px;font-size:27.9rem;line-height:1;transform:rotate(15deg);opacity:.3;pointer-events:none;z-index:-1;user-select:none}
.modal-watermark{position:absolute;bottom:20px;right:-110px;font-size:22rem;transform:rotate(15deg);opacity:.3;pointer-events:none;user-select:none;z-index:-1}
.modal-content{overflow:hidden;position:relative;z-index:0}
.emoji-shift{display:inline-block;transform:translateY(-2px)}
.admin-nav-btn .nav-icon{display:inline-block;transform:translateY(-2px)}

/* Gallery filter panel */
.gal-toolbar{margin-bottom:14px;display:flex;flex-direction:column;gap:8px}
.gal-toggle{margin:0;padding:.4rem .7rem;font-size:.72rem;letter-spacing:.4px}
.gal-panel{display:flex;flex-direction:column;gap:8px}
.gal-panel.collapsed{display:none}
/* One compact controls row - search + sort + Ordered Today */
.gal-controls{display:flex;align-items:center;gap:12px;flex-wrap:wrap;background:var(--bg-card);border:1px solid var(--border-color);border-top:3px solid var(--theme-primary);border-radius:10px;padding:8px 12px}
.gal-controls .filter-search{flex:1;min-width:180px}
.fctl-label{font-size:.68rem;font-weight:800;letter-spacing:1px;text-transform:uppercase;color:var(--text-secondary)}
.gal-sort{min-width:170px}
.gal-today{font-size:.85rem;white-space:nowrap}
/* Checkbox sits a touch low against the label text - raise it into
   optical alignment */
.gal-today input[type="checkbox"]{position:relative;top:-3px}
/* Related groups pair side-by-side when the panel is wide enough -
   container width (not viewport) so the sidebar collapse state is
   accounted for automatically */
.gal-toolbar{container-type:inline-size;container-name:galtb}
.gal-filter-pair{display:grid;grid-template-columns:1fr;gap:8px}
@container galtb (min-width:920px){
  /* Two-across only when the pair actually holds two filters -
     a lone filter (Category) keeps the full row width */
  .gal-filter-pair:has(> .gal-filter:nth-child(2)){grid-template-columns:1fr 1fr;align-items:start}
  /* reseller-off: a pair's hidden reseller-only block is still a DOM
     child - collapse the pair or the visible filter gets half a row */
  body:not([data-reseller-mode="true"]) .gal-filter-pair:has(> .gal-filter.reseller-only){grid-template-columns:1fr}
}
/* Expanded head reads "Hide"; collapsed flips to the live summary */
.gal-hide-tag,.gal-show-tag{display:none;margin-left:auto;font-size:.68rem;font-weight:800;letter-spacing:.8px;text-transform:uppercase;color:var(--text-secondary)}
.gal-filter:not(.collapsed) .gal-hide-tag{display:inline}
.gal-filter.collapsed .gal-show-tag{display:inline}
/* Live summary stays populated in markup but hidden - heads read
   HIDE / SHOW now */
.gal-filter-count{display:none}
/* Collapsible filter groups - slim bordered rows, head shows the
   group's name + a live N-of-M summary + caret, body is the chip set */
.gal-filter{background:var(--bg-card);border:1px solid var(--border-color);border-radius:10px}
.gal-filter-head{display:flex;align-items:center;gap:10px;width:100%;padding:8px 12px;background:none;border:none;cursor:pointer;font:inherit;text-align:left;color:inherit}
.gal-filter-head:hover .gal-group-label{color:var(--theme-primary)}
.gal-filter-count{margin-left:auto;font-size:.75rem;font-weight:700;color:var(--text-secondary)}
.gal-caret{color:var(--text-secondary);font-size:.75rem;transition:transform .15s}
.gal-filter.collapsed .gal-caret{transform:rotate(-90deg)}
.gal-filter-body{display:flex;align-items:center;gap:6px 16px;flex-wrap:wrap;padding:0 12px 10px}
.gal-filter.collapsed .gal-filter-body{display:none}
.gal-group{display:flex;align-items:center;gap:6px 14px;flex-wrap:wrap;flex:1}
.gal-group-label{font-size:.7rem;font-weight:800;letter-spacing:1.2px;text-transform:uppercase;color:var(--theme-primary);margin-right:4px}
.gal-check{display:inline-flex;align-items:center;gap:6px;font-size:.83rem;color:var(--text-secondary);cursor:pointer;white-space:nowrap;user-select:none}
.gal-check input{accent-color:var(--theme-primary);margin:0;cursor:pointer}
.gal-check:hover{color:var(--text-primary)}
.badge-seq{color:var(--theme-primary-light);font-weight:800}

/* ---- Round-4 polish ---- */
/* Help page: each section in its own rounded block */
.faq-block{background:var(--bg-card);border:1px solid var(--border-color);border-top:3px solid var(--theme-primary);border-radius:12px;padding:18px 20px;margin-bottom:18px}
.faq-block h3{margin:0 0 8px}
.faq-block .table-container{margin-top:10px}

/* (?) hover tooltips */
.info-dot{display:inline-flex;align-items:center;justify-content:center;width:15px;height:15px;border-radius:50%;border:1px solid var(--text-secondary);color:var(--text-secondary);font-size:10px;font-weight:700;cursor:help;margin-left:6px;vertical-align:middle}
.info-dot:hover{border-color:var(--theme-primary);color:var(--theme-primary)}

/* Theme swatches centered */
#themeColorGrid{display:flex;flex-wrap:wrap;gap:10px;justify-content:center}

/* Settings cog: lower, clipping ~5-8% of the glyph */
.modal-watermark{bottom:-155px}

/* Gallery stats strip: one row of metric cards above the filters -
   wraps on narrower windows */
.gal-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(150px,100%),1fr));gap:12px;margin-bottom:1.25rem}

/* Cards everywhere: theme top-accent always, thin theme border +
   glow on hover (matches the Analytics metric cards) */
.dash-card,.metric-card,.table-container,.faq-block,.mini-stat,.stat-block,.eval-card,.gal-panel-row,.filter-actions,.filter-controls,.year-card{border-top:3px solid var(--theme-primary)}
.dash-card,.metric-card,.table-container,.faq-block,.mini-stat,.stat-block,.eval-card,.gal-panel-row,.filter-actions,.filter-controls,.year-card{transition:transform .2s,box-shadow .2s,border-color .2s}
.dash-card:hover,.metric-card:hover,.table-container:hover,.faq-block:hover,.mini-stat:hover,.stat-block:hover,.eval-card:hover,.gal-panel-row:hover,.filter-actions:hover,.filter-controls:hover,.year-card:hover{border-color:var(--theme-primary);box-shadow:0 0 24px var(--theme-glow)}

/* Drawer: glow follows the ORDER STATUS accent (--card-accent set by
   the gallery), not the site theme - plus tighter spacing + uniform
   rows + row hover */
.drawer{box-shadow:0 0 60px oklch(0% 0 0 / .45),0 0 45px color-mix(in oklch, var(--card-accent, var(--theme-primary)) 35%, transparent),0 0 110px color-mix(in oklch, var(--card-accent, var(--theme-primary)) 20%, transparent)}
.drawer-details{margin-top:4px}
/* Fixed 40px rows: controls are capped at 30px so every row - text or
   input - renders identical. min-height can't do this because a
   44px-tall input would just push its row taller */
.drawer-detail-row{display:flex;align-items:center;height:40px;padding:0 6px;margin:0 -6px;border-radius:6px}
.drawer-detail-row input[type="text"],.drawer-detail-row input[type="number"],.drawer-detail-row select,.drawer-detail-row textarea{height:30px;padding:4px 8px;box-sizing:border-box;font-size:.85rem;
  /* Fields take the status tint too - a mid wash of the accent over
     the input base so the whole drawer stays in-hue; text color is
     untouched so everything stays legible */
  background-color:color-mix(in oklch, var(--card-accent, var(--bg-input)) 16%, var(--bg-input));
  border:1px solid color-mix(in oklch, var(--card-accent, var(--border-color)) 42%, var(--border-color));
  border-radius:6px}
.drawer-detail-row input[type="text"]:focus,.drawer-detail-row input[type="number"]:focus,.drawer-detail-row select:focus,.drawer-detail-row textarea:focus{outline:none;border-color:color-mix(in oklch, var(--card-accent, var(--theme-primary)) 80%, var(--border-color));box-shadow:0 0 0 2px color-mix(in oklch, var(--card-accent, var(--theme-primary)) 28%, transparent)}
/* textarea is baseline-aligned by default - the reserved descender
   space below it pushes the box ~3px up inside the row. middle aligns
   the box itself so it centers like every other control */
.drawer-detail-row textarea{resize:none;vertical-align:middle}
/* Hover DARKENS every row - including the zebra-striped ones, whose
   higher-specificity stripe rule needs an equally-specific :hover
   twin or it silently wins */
/* Hover lifts the stripe one step deeper in the same hue */
.drawer-detail-row:hover{background:color-mix(in oklch, var(--card-accent, var(--bg-card)) 50%, var(--bg-card))}
body:not([data-reseller-mode="true"]) .drawer-detail-row:nth-child(even of :not(.reseller-only):not(.row-hidden)):hover,
[data-reseller-mode="true"] .drawer-detail-row:nth-child(even of :not(.row-hidden)):hover{background:color-mix(in oklch, var(--card-accent, var(--bg-card)) 45%, var(--bg-card))}
.drawer-detail-label{flex:0 0 110px}

/* # badge on gallery cards: not bold */
.badge-seq{font-weight:600}

/* Floating 400x400 image preview for the catalogue IMAGE column */
#imgHoverPreview{position:fixed;z-index:10001;pointer-events:none;background:var(--bg-card);border:1px solid color-mix(in oklch, var(--theme-primary) 55%, transparent);border-radius:10px;padding:6px;box-shadow:0 0 30px rgba(0,0,0,.55),0 0 40px var(--theme-glow)}
#imgHoverPreview img{width:400px;height:400px;object-fit:contain;display:block;border-radius:6px}


/* ---------- Visual polish ---------- */

/* Skeleton shimmer while a page's data loads - the layout is already
   on screen, the cells just haven't filled yet */
@keyframes skeletonShimmer {
  0% { background-position: -300px 0 }
  100% { background-position: calc(300px + 100%) 0 }
}
.skeleton {
  background: linear-gradient(90deg,
    oklch(100% 0 0 / 0.045) 25%,
    oklch(100% 0 0 / 0.11) 50%,
    oklch(100% 0 0 / 0.045) 75%);
  background-size: 600px 100%;
  animation: skeletonShimmer 1.5s linear infinite;
  border-radius: 8px;
}
[data-theme-mode="light"] .skeleton {
  background: linear-gradient(90deg,
    oklch(0% 0 0 / 0.05) 25%,
    oklch(0% 0 0 / 0.1) 50%,
    oklch(0% 0 0 / 0.05) 75%);
  background-size: 600px 100%;
  animation: skeletonShimmer 1.5s linear infinite;
}
.skeleton-card { border-radius: 14px; overflow: hidden; border: 1px solid var(--border-color); }
.skeleton-card .sk-img { aspect-ratio: 1 / 1; }
.skeleton-card .sk-line { height: 14px; margin: 12px; }
.skeleton-card .sk-line.short { width: 42%; margin-bottom: 16px; }

/* Glassmorphism - the drawer floats over page content, so a hint of
   it bleeds through a blurred translucent panel instead of an opaque
   wall */
.drawer {
  /* Keep the status-tinted surface under the glass blur - the plain
     neutral override is what made drawers read black despite the
     accent skin */
  background-color: color-mix(in oklch, color-mix(in oklch, var(--card-accent, var(--bg-card)) 26%, var(--bg-card)) 88%, transparent);
  /* Diagonal hairlines over the accent glass - neutral, not tinted */
  background-image: repeating-linear-gradient(115deg, transparent 0 46px, var(--diag-line) 46px 48px);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
}

/* Confetti micro-burst - tiny tinted squares popping outward from a
   toast when something worth celebrating happens (item went Sellable) */
.vr-confetti {
  position: fixed; width: 7px; height: 7px; border-radius: 2px;
  pointer-events: none; z-index: 10003;
  animation: confettiPop .85s cubic-bezier(.15,.6,.4,1) forwards;
}
@keyframes confettiPop {
  0% { transform: translate(0,0) rotate(0deg) scale(1); opacity: 1 }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(.3); opacity: 0 }
}

/* Ambient hero - the giant watermark icon slowly floats behind the
   page. transform is animated (not position) so it stays on the GPU */
/* Watermark drifts on two axes at once - vertical float and
   horizontal sway on different periods (9s/13s) so the combined path
   is a slow Lissajous that never visibly loops */
@keyframes heroFloatY {
  0%, 100% { translate: 0 0 }
  50% { translate: 0 -16px }
}
@keyframes heroSwayX {
  0%, 100% { transform: rotate(15deg) translateX(0) }
  50% { transform: rotate(15deg) translateX(14px) }
}
.page-watermark { animation: heroFloatY 9s ease-in-out infinite, heroSwayX 13s ease-in-out infinite; }

/* Fresh RFY drops (<24h old): a soft accent ring pulses out of the
   card edge so a brand-new drop reads at a glance without a badge */
@keyframes dropPulse {
  0% { box-shadow: 0 0 0 0 color-mix(in oklch, var(--card-accent, var(--theme-primary)) 50%, transparent) }
  70% { box-shadow: 0 0 0 11px transparent }
  100% { box-shadow: 0 0 0 0 transparent }
}
.gallery-card.drop-fresh { animation: dropPulse 2.6s ease-out infinite; }

/* Card grid sits flush against whatever follows - give the table on
   the RFY Drops page the same 1.5rem breathing room the cards have */
.gallery-grid + .table-container { margin-top: 2.25rem; }

/* RFY card's brand · seller line - sits between title and meta.
   min-height keeps the row's space reserved when empty so the meta
   line doesn't shift up like a 1-line title would */
.rfy-card-sub { min-height: 1.3em; }

.rfy-card-sub{font-size:.78rem;color:var(--text-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:-2px}

/* Corner ribbon - diagonal "NEW" tag on items ordered today */
.card-ribbon {
  position: absolute; top: 13px; left: -36px; transform: rotate(-45deg);
  background: var(--card-accent, var(--theme-primary)); color: #fff;
  font-size: .6rem; font-weight: 800; letter-spacing: 1.2px;
  padding: 3px 38px; box-shadow: 0 2px 8px rgba(0,0,0,.45); z-index: 3;
  pointer-events: none;
}

/* Page transitions - .page-hero and .page-scroll are re-created on
   every navigation, so the same keyframes replay each time: a soft
   fade + rise instead of a hard cut. Fill mode is BACKWARDS, not
   'both': retaining the end-state transform (even translateY(0)) makes
   the animated element a containing block, which breaks position:fixed
   descendants - the flyout drawer + lightbox live inside .page-scroll */
@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px) }
  to { opacity: 1; transform: translateY(0) }
}
.page-hero { animation: pageIn .3s ease backwards }
.page-scroll { animation: pageIn .34s .04s ease backwards }

/* ==================== Responsive ==================== */
/* These rules intentionally live at the END of the file - equal-
   specificity desktop rules above must not outrank the mobile
   overrides. Two tiers: <=768px takes nav/drawer/structure,
   <=600px handles phones (hero, topbar, modals, cards) */

@media (max-width: 768px) {
  /* No element may push the page wider than the viewport - rogue
     fixed decorations (watermark, dropdowns) clip instead of
     producing a sideways scroll */
  html, body { overflow-x: hidden; }

  .sidebar {
    position: fixed;
    left: -280px;
    height: 100%;
    z-index: 1002;
    transition: left 0.15s ease;
  }

  .sidebar.open {
    left: 0;
  }

  /* Dim + blur behind the fly-in nav - click/tap outside closes it */
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 1001;
  }
  .sidebar-backdrop.show {
    opacity: 1;
    pointer-events: auto;
  }

  /* Toggle becomes a real hamburger at the viewport edge while the
     sidebar is off-screen; it rides along to the sidebar's inner
     right edge when open */
  .sidebar-toggle {
    left: 10px;
    top: 10px;
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    border-radius: 8px;
    transition: left 0.15s ease, background 0.2s, color 0.2s;
  }

  .sidebar.open .sidebar-toggle {
    left: 234px;
  }

  .page-scroll {
    padding: 0 1rem 1rem;
  }

  /* Drawers keep the phone's edge visible - 75% of the screen, still
     capped at the desktop width on wider tablets */
  .drawer {
    width: 75%;
    max-width: 500px;
    right: -75%;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  /* The bell's wrapper is the dropdown's position anchor - but the
     account chip sits to its right, so right:0 pushed the panel ~70px
     inward and its left edge clipped off-screen. Static wrap anchors
     the dropdown to the whole .topbar instead: right edge = topbar's
     right edge, and top:100% still lands just under the row. The bell
     badge anchors to .notif-btn (still relative) so it doesn't move */
  .notif-wrap { position: static; }
  .notif-dropdown {
    right: 0;
    width: min(340px, calc(100vw - 20px));
  }

  /* Mobile browser chrome eats vh - dvh tracks the real visible
     height (vh stays as the fallback) */
  #app { min-height: 100vh; min-height: 100dvh; }
}

/* ---- Phones: hero, topbar, modal + card compression ---- */
@media (max-width: 600px) {
  /* Hero: shorter banner, smaller type, and the title drops below
     the topbar pill row instead of colliding with it */
  .page-hero { height: 112px; margin-bottom: 2rem; }
  .page-hero .hero-title { font-size: 1.35rem; left: 16px; top: 52px; }
  .hero-sub { right: 16px; bottom: 14px; font-size: .58rem; max-width: 60%; }

  /* Topbar cluster: compact pills, avatar-only account chip */
  .topbar { top: 10px; right: 10px; gap: 6px; }
  .day-pill { padding: 4px 10px; font-size: .78rem; border-radius: 11px; }
  .day-pill-yest { display: none; }
  .account-name { display: none; }
  .notif-btn { width: 34px; height: 34px; font-size: .95rem; }

  /* Modals: slimmer padding - the hero banner's negative margins
     track it so it still bleeds edge-to-edge */
  .modal-content { padding: 1.25rem; }
  .modal-hero { margin: -1.25rem -1.25rem 1.25rem; height: 64px; }
  .modal-hero .modal-hero-title { font-size: 1.1rem; left: 18px; bottom: 15px; }
  .modal-actions { flex-direction: column; }
  .modal-actions .btn { width: 100%; }
  .auth-logo { width: 190px; }
  .auth-tagline { font-size: .72rem; }

  /* Drawer internals: tighter rows + smaller image on the 75% pane */
  .drawer { padding: 1rem; }
  .drawer-image { height: 190px; }
  .drawer-product-title { font-size: .95rem; }
  .drawer-detail-label { flex-basis: 92px; font-size: .8rem; }
  .drawer-detail-row { height: 38px; padding: 0 4px; margin: 0 -4px; }

  /* Cards + filters: tighter padding on phones */
  .dash-card, .faq-block { padding: 14px; }
  .metric-card { padding: 1rem; }
  .metric-card .metric-value { font-size: 1.45rem; }
  .eval-card { padding: 1rem 1.25rem; }
  .eval-days-num { font-size: 1.75rem; }
  .year-card { padding: 1rem 1.1rem; }
  .table-container h3 { padding: .7rem .8rem; }
  .filter-actions { padding: .8rem 1rem; }
  .gal-controls .filter-search { min-width: 140px; }

  /* Filter rows: controls wrap under the search instead of
     squeezing into half the row */
  .filter-bar-row { flex-wrap: wrap; }
  .filter-bar-row .filter-search { min-width: 160px; }
  .notif-history-bar { flex-wrap: wrap; }
  .eval-header { flex-wrap: wrap; }

  /* Review viewer head: smaller thumb keeps the title beside it
     instead of pushing it out of the modal */
  .rev-modal-head { gap: 12px; }
  .rev-modal-head img { width: 88px; height: 88px; }
}

/* ==================== Edge bands ==================== */
/* Darkened bands at the edges of every block - 28px top, deeper
   52px bottom, ~21% black fading to transparent. One var so they
   can never drift apart */
:root{--edge-bands:
  linear-gradient(to bottom, oklch(0% 0 0 / .207) 0, transparent 28px),
  linear-gradient(to top,    oklch(0% 0 0 / .207) 0, transparent 52px);
  /* Control-scale twin for small surfaces (nav buttons, toasts) -
     same bands, scaled so a ~45px control keeps a clear middle */
  --edge-bands-sm:
  linear-gradient(to bottom, oklch(0% 0 0 / .207) 0, transparent 9px),
  linear-gradient(to top,    oklch(0% 0 0 / .207) 0, transparent 12px);}

/* Every card/block/table surface, plus the chrome shells: sidebar,
   popups, drawers, dropdowns */
.dash-card,.metric-card,.table-container,.faq-block,.mini-stat,.stat-block,.eval-card,.gal-panel-row,.filter-actions,.filter-controls,.gal-filter,.gal-controls,.sidebar,.modal-content,.notif-dropdown,.op-card,.gallery-card{
  background-image:var(--edge-bands);
}

/* Small surfaces: sidebar buttons and the bottom-right toasts */
.nav-link,.admin-nav-btn,.settings-btn,.logout-btn,.notify-toast{
  background-image:var(--edge-bands-sm);
}

/* Surfaces that already paint imagery keep it - bands go on top
   (first layer paints highest) */
.year-card{background-image:var(--edge-bands),linear-gradient(120deg, color-mix(in oklch, var(--theme-primary) 22%, var(--bg-card)), var(--bg-card) 60%)}
.drawer{background-image:var(--edge-bands),repeating-linear-gradient(115deg, transparent 0 46px, var(--diag-line) 46px 48px)}
