/* ==========================================================================
   TUMAN PANEL — DESIGN SYSTEM
   Palli Animation identity: deep violet-black surfaces, purple primary,
   gold accent, restrained motion.

   Layers, in order:
     1  Tokens            9  Tables
     2  Reset / base     10  Modal / dialog
     3  Typography       11  Toast
     4  Layout           12  Loading / skeleton / empty
     5  Buttons          13  Navigation
     6  Forms            14  Product card
     7  Cards            15  Utilities
     8  Badges           16  Motion + reduced motion
                         17  Legacy class bridge
   ========================================================================== */

/* ==========================================================================
   1. TOKENS
   ========================================================================== */
:root {
  /* --- Surfaces: near-black with a cool violet cast for depth --- */
  --surface-0:      #0B0D11;   /* page */
  --surface-1:      #111419;   /* card */
  --surface-2:      #171B22;   /* input, raised */
  --surface-3:      #1E232C;   /* hover, active row */
  --surface-inset:  #0E1116;   /* wells, image backdrops */

  /* --- Borders --- */
  --border-subtle:  #1F242E;
  --border:         #262D3A;
  --border-strong:  #333C4D;

  /* --- Brand: purple --- */
  --purple-300: #C4B5FD;
  --purple-400: #A78BFA;
  --purple-500: #8B5CF6;
  --purple-600: #7C3AED;
  --purple-700: #6D28D9;
  --purple-800: #5B21B6;

  /* --- Brand: gold --- */
  --gold-300:   #FCD34D;
  --gold-400:   #FBBF24;
  --gold-500:   #F59E0B;
  --gold-600:   #D97706;

  /* --- Semantic roles --- */
  --primary:        var(--purple-600);
  --primary-hover:  var(--purple-500);
  --primary-press:  var(--purple-700);
  --on-primary:     #FFFFFF;
  --accent:         var(--gold-500);
  --on-accent:      #1A1206;

  /* --- Text: all pass 4.5:1 on --surface-0 --- */
  --text:           #F4F6FA;
  --text-secondary: #A6AFC0;
  --text-muted:     #7F8A9C;
  --text-disabled:  #5A6474;

  /* --- Status --- */
  --success:     #22C55E;
  --success-bg:  rgba(34, 197, 94, .12);
  --success-br:  rgba(34, 197, 94, .30);
  --warning:     #F59E0B;
  --warning-bg:  rgba(245, 158, 11, .12);
  --warning-br:  rgba(245, 158, 11, .30);
  --danger:      #F26D6D;
  --danger-bg:   rgba(239, 68, 68, .12);
  --danger-br:   rgba(239, 68, 68, .32);
  --info:        #38BDF8;
  --info-bg:     rgba(56, 189, 248, .12);
  --info-br:     rgba(56, 189, 248, .30);

  /* --- Typography --- */
  --font-body:    'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Rajdhani', 'Inter', system-ui, sans-serif;
  --font-mono:    ui-monospace, 'SFMono-Regular', 'JetBrains Mono', Menlo, monospace;

  --text-2xs: .6875rem;  /* 11 — badges only */
  --text-xs:  .75rem;    /* 12 — meta */
  --text-sm:  .8125rem;  /* 13 — dense table text */
  --text-base:.875rem;   /* 14 — UI default */
  --text-md:  1rem;      /* 16 — body copy */
  --text-lg:  1.125rem;
  --text-xl:  1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.25rem;
  --text-4xl: 3rem;

  --leading-tight: 1.2;
  --leading-snug:  1.4;
  --leading:       1.55;

  /* --- Spacing (density 7 / standard-dense) --- */
  --space-1: .25rem;  --space-2: .5rem;   --space-3: .75rem;
  --space-4: 1rem;    --space-5: 1.25rem; --space-6: 1.5rem;
  --space-8: 2rem;    --space-10: 2.5rem; --space-12: 3rem;
  --space-16: 4rem;

  /* --- Radii --- */
  --radius-sm:  .375rem;
  --radius:     .625rem;
  --radius-md:  .75rem;
  --radius-lg:  1rem;
  --radius-xl:  1.25rem;
  --radius-pill: 999px;

  /* --- Elevation: dark UI needs depth from shadow + hairline, not glow --- */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow:    0 2px 8px rgba(0,0,0,.45);
  --shadow-md: 0 8px 24px -6px rgba(0,0,0,.6);
  --shadow-lg: 0 20px 48px -12px rgba(0,0,0,.7);
  --glow-primary: 0 0 0 1px rgba(124,58,237,.45), 0 8px 28px -8px rgba(124,58,237,.45);
  --glow-accent:  0 0 0 1px rgba(245,158,11,.40), 0 8px 28px -8px rgba(245,158,11,.35);

  /* --- Motion: short for feedback, longer for entrances --- */
  --dur-instant: 90ms;
  --dur-fast:    150ms;
  --dur:         220ms;
  --dur-slow:    320ms;
  --dur-slower:  480ms;
  --ease:          cubic-bezier(.4, 0, .2, 1);
  --ease-out:      cubic-bezier(.16, 1, .3, 1);
  --ease-emphasis: cubic-bezier(.2, .8, .2, 1);

  /* --- Layout --- */
  --sidebar-w:   16rem;
  --topbar-h:    3.5rem;
  --bottomnav-h: 3.75rem;
  --container:   80rem;
  --focus-ring:  0 0 0 2px var(--surface-0), 0 0 0 4px var(--purple-400);
}

/* ==========================================================================
   2. RESET / BASE
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + var(--space-4));
}

body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--surface-0);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }

/* Interactive elements inherit type instead of the browser default */
button, input, select, textarea { font: inherit; color: inherit; }

/* Keyboard-only focus ring — never removed, never invisible */
:focus { outline: none; }
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

/* Chrome that should not be text-selected; content stays selectable so users
   can copy license keys, order IDs and API tokens. */
.no-select, .nav-item, .btn, .badge, .stat-label { user-select: none; }

::selection { background: var(--purple-700); color: #fff; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--surface-0); }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-pill);
  border: 2px solid var(--surface-0);
}
::-webkit-scrollbar-thumb:hover { background: var(--purple-700); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) var(--surface-0); }

/* Skip link for keyboard users */
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100%;
  z-index: 200;
  padding: var(--space-2) var(--space-4);
  background: var(--purple-600);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: top var(--dur) var(--ease-out);
}
.skip-link:focus-visible { top: var(--space-4); }

/* ==========================================================================
   3. TYPOGRAPHY
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: .01em;
  color: var(--text);
  text-wrap: balance;
}
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4, h5, h6 { font-size: var(--text-md); }

@media (min-width: 768px) {
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
}

p { margin: 0 0 var(--space-3); text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

a { color: var(--purple-400); text-decoration: none; transition: color var(--dur-fast) var(--ease); }
a:hover { color: var(--purple-300); }

.font-display { font-family: var(--font-display); }
.font-mono { font-family: var(--font-mono); font-variant-ligatures: none; }

/* Tabular figures keep money columns from jittering as values change */
.tabular, .stat-value, .money, td.num { font-variant-numeric: tabular-nums; }

.eyebrow {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--purple-400);
}

.page-title { font-size: var(--text-xl); text-transform: uppercase; letter-spacing: .03em; }
@media (min-width: 768px) { .page-title { font-size: var(--text-2xl); } }

.page-subtitle { color: var(--text-secondary); font-size: var(--text-base); margin-top: var(--space-1); }

.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-gold      { color: var(--gold-400); }
.text-purple    { color: var(--purple-400); }
.text-success   { color: var(--success); }
.text-danger    { color: var(--danger); }

/* Gradient wordmark — the one place gradient text is used */
.text-gradient {
  background: linear-gradient(100deg, var(--purple-300), var(--purple-500) 45%, var(--gold-400));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-right { text-align: right; }
.label-mini {
  font-size: var(--text-2xs);
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.clamp-2 {
  display: -webkit-box; -webkit-box-orient: vertical;
  -webkit-line-clamp: 2; overflow: hidden;
}

/* ==========================================================================
   4. LAYOUT
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-4);
}
@media (min-width: 768px) { .container { padding-inline: var(--space-6); } }

/* App shell: content clears the desktop sidebar and the mobile bottom nav,
   including the iOS home-indicator inset. */
.app-body {
  padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px) + var(--space-4));
}
@media (min-width: 768px) {
  .app-body { padding-bottom: var(--space-8); padding-left: var(--sidebar-w); }
}

.page { padding-block: var(--space-5) var(--space-10); }

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.section { margin-bottom: var(--space-10); }

.page-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* Centered rule + label, used for product section titles */
.section-heading {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: 0 0 var(--space-5);
}
.section-heading::before, .section-heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
}
.section-heading > span, .section-heading > h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
}
@media (min-width: 768px) { .section-heading > span, .section-heading > h2 { font-size: var(--text-xl); } }

/* Auto-fit grids: no breakpoint maintenance, never overflows */
.grid-cards {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
}
@media (min-width: 768px) {
  .grid-cards { gap: var(--space-5); grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); }
}
.grid-stats {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
}
.grid-form {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}
/* Search + filter toolbar that sits above a list or table */
.filters { display: grid; gap: var(--space-3); align-items: end; }
@media (min-width: 768px) { .filters { grid-template-columns: minmax(0, 1fr) 12rem auto; } }
.filters .field { margin-bottom: 0; }

/* Label/value rows for detail panels and modals */
.detail-list { display: flex; flex-direction: column; margin: 0; }
.detail-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}
.detail-row:last-child { border-bottom: 0; }
.detail-row > dt {
  flex: none;
  font-size: var(--text-2xs);
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.detail-row > dd { margin: 0; min-width: 0; text-align: right; font-weight: 600; color: var(--text); }

.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.row   { display: flex; align-items: center; gap: var(--space-3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.wrap  { flex-wrap: wrap; }
.spacer { flex: 1 1 auto; }

/* ==========================================================================
   5. BUTTONS
   ========================================================================== */
.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  --btn-br: var(--border);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 2.75rem;              /* 44px touch target */
  padding: var(--space-2) var(--space-5);
  border: 1px solid var(--btn-br);
  border-radius: var(--radius);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  transition: background-color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease),
              filter var(--dur-fast) var(--ease);
}
.btn:hover:not(:disabled):not([aria-disabled="true"]) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.985); transition-duration: var(--dur-instant); }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
  filter: grayscale(.35);
}
.btn > i, .btn > svg { flex: none; font-size: 1em; }

/* Primary — gradient + hairline, the only high-emphasis action per view */
.btn-primary {
  --btn-fg: var(--on-primary);
  --btn-br: transparent;
  background: linear-gradient(135deg, var(--purple-500), var(--purple-700));
  box-shadow: 0 1px 0 rgba(255,255,255,.10) inset, var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--purple-400), var(--purple-600));
  box-shadow: 0 1px 0 rgba(255,255,255,.14) inset, var(--glow-primary);
}
.btn-primary:active:not(:disabled) { background: linear-gradient(135deg, var(--purple-600), var(--purple-800)); }

.btn-accent {
  --btn-fg: var(--on-accent);
  --btn-br: transparent;
  background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
  box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, var(--shadow-sm);
}
.btn-accent:hover:not(:disabled) { box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, var(--glow-accent); }

.btn-secondary { --btn-bg: var(--surface-2); --btn-br: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { --btn-bg: var(--surface-3); --btn-br: var(--purple-700); }

.btn-outline { --btn-bg: transparent; --btn-br: var(--purple-700); --btn-fg: var(--purple-300); }
.btn-outline:hover:not(:disabled) { --btn-bg: rgba(124,58,237,.14); --btn-br: var(--purple-500); }

.btn-ghost { --btn-bg: transparent; --btn-br: transparent; --btn-fg: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { --btn-bg: var(--surface-2); --btn-fg: var(--text); }

.btn-danger  { --btn-bg: #DC2626; --btn-fg: #fff; --btn-br: transparent; }
.btn-danger:hover:not(:disabled)  { --btn-bg: #B91C1C; box-shadow: 0 8px 24px -10px rgba(220,38,38,.7); }
.btn-success { --btn-bg: #16A34A; --btn-fg: #fff; --btn-br: transparent; }
.btn-success:hover:not(:disabled) { --btn-bg: #15803D; }

/* Sizes */
.btn-sm { min-height: 2.25rem; padding: var(--space-1) var(--space-3); font-size: var(--text-xs); border-radius: var(--radius-sm); }
.btn-lg { min-height: 3.25rem; padding: var(--space-3) var(--space-8); font-size: var(--text-md); border-radius: var(--radius-md); }
.btn-block { display: flex; width: 100%; }
.btn-icon { width: 2.75rem; min-height: 2.75rem; padding: 0; border-radius: var(--radius); }
.btn-icon.btn-sm { width: 2.25rem; min-height: 2.25rem; }

/* Loading: reserves label width so the button does not resize mid-submit */
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: '';
  position: absolute;
  inset: 50% auto auto 50%;
  width: 1.125rem; height: 1.125rem;
  margin: -.5625rem 0 0 -.5625rem;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* Tap ripple, CSS-only (no JS node injection) */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--rx, 50%) var(--ry, 50%), rgba(255,255,255,.35), transparent 60%);
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease-out);
  pointer-events: none;
}
.btn:active::after { opacity: .5; transition-duration: 0ms; }
.btn.is-loading::after { background: none; }

/* Button group */
.btn-group { display: inline-flex; gap: var(--space-2); flex-wrap: wrap; }

/* ==========================================================================
   6. FORMS
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-4); }

.label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.label .req { color: var(--danger); }

.input-field, .input, .select, .textarea,
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="search"], input[type="tel"], input[type="url"], input[type="date"],
input[type="datetime-local"], select, textarea {
  width: 100%;
  min-height: 2.75rem;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: var(--text-base);
  transition: border-color var(--dur-fast) var(--ease),
              background-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}
textarea, .textarea { min-height: 6rem; resize: vertical; line-height: var(--leading); }

::placeholder { color: var(--text-muted); opacity: 1; }

.input-field:hover:not(:disabled), input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) {
  border-color: var(--border-strong);
}
.input-field:focus, .input:focus, input:focus, select:focus, textarea:focus {
  outline: none;
  background: var(--surface-3);
  border-color: var(--purple-500);
  box-shadow: 0 0 0 3px rgba(124,58,237,.22);
}
input:disabled, select:disabled, textarea:disabled, .input-field:disabled {
  background: var(--surface-inset);
  color: var(--text-disabled);
  cursor: not-allowed;
}
input[readonly], textarea[readonly] { background: var(--surface-inset); color: var(--text-secondary); }

/* Validation. Never colour-only: an icon + message carries the meaning too. */
.field.is-invalid .input-field, .field.is-invalid input, .field.is-invalid select, .field.is-invalid textarea,
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] {
  border-color: var(--danger);
  background: var(--danger-bg);
}
.field.is-invalid .input-field:focus, input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgba(239,68,68,.25);
}
.field-error {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--danger);
}
.field-hint { font-size: var(--text-xs); color: var(--text-muted); }

/* Custom select arrow (native arrow is unstyleable and looks foreign here) */
select, .select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: var(--space-10);
  background-image: linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%),
                    linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%);
  background-position: calc(100% - 1.25rem) 50%, calc(100% - .9rem) 50%;
  background-size: .35rem .35rem, .35rem .35rem;
  background-repeat: no-repeat;
  cursor: pointer;
}
select option { background: var(--surface-2); color: var(--text); }

/* Input with a leading icon */
.input-group { position: relative; display: flex; align-items: center; }
.input-group > i, .input-group > .input-icon {
  position: absolute;
  left: var(--space-4);
  color: var(--text-muted);
  pointer-events: none;
  font-size: var(--text-base);
}
.input-group > input, .input-group > .input-field { padding-left: var(--space-10); }
.input-group > .input-action {
  position: absolute;
  right: var(--space-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem; height: 2.25rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.input-group > .input-action:hover { color: var(--text); background: var(--surface-3); }

/* Checkbox / radio */
input[type="checkbox"], input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1.15rem; height: 1.15rem;
  min-height: 0;
  padding: 0;
  flex: none;
  background: var(--surface-2);
  border: 1.5px solid var(--border-strong);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
input[type="checkbox"] { border-radius: var(--radius-sm); }
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]:checked, input[type="radio"]:checked {
  background: var(--purple-600);
  border-color: var(--purple-500);
}
input[type="checkbox"]:checked::after {
  content: '';
  display: block;
  width: .3rem; height: .55rem;
  margin: .1rem auto 0;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
input[type="radio"]:checked::after {
  content: '';
  display: block;
  width: .4rem; height: .4rem;
  margin: .275rem auto;
  border-radius: 50%;
  background: #fff;
}
.check-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 2.75rem;
  cursor: pointer;
  font-size: var(--text-base);
}

/* Toggle */
.switch { position: relative; display: inline-flex; align-items: center; gap: var(--space-3); cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track {
  width: 2.75rem; height: 1.5rem;
  flex: none;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.switch .track::after {
  content: '';
  display: block;
  width: 1.05rem; height: 1.05rem;
  margin: .175rem;
  border-radius: 50%;
  background: var(--text-secondary);
  transition: transform var(--dur) var(--ease-emphasis), background-color var(--dur) var(--ease);
}
.switch input:checked + .track { background: var(--purple-600); border-color: var(--purple-500); }
.switch input:checked + .track::after { transform: translateX(1.2rem); background: #fff; }
.switch input:focus-visible + .track { box-shadow: var(--focus-ring); }

/* File input */
input[type="file"] {
  padding: var(--space-2);
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
}
input[type="file"]::file-selector-button {
  margin-right: var(--space-3);
  padding: var(--space-2) var(--space-4);
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

/* ==========================================================================
   7. CARDS & PANELS
   ========================================================================== */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: var(--space-5); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}
.card-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.card-title > i { color: var(--purple-400); }
.card-body   { padding: var(--space-5); }
.card-footer { padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border-subtle); }

/* Only cards that navigate somewhere get lift-on-hover */
.card-interactive { cursor: pointer; transition: transform var(--dur) var(--ease-out), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.card-interactive:hover { transform: translateY(-3px); border-color: var(--purple-700); box-shadow: var(--shadow-md); }
.card-interactive:active { transform: translateY(-1px); }

/* A card that is itself the control (row that opens a detail dialog) */
button.card {
  width: 100%;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

/* Glass panel — reserved for overlays sitting above imagery or the aurora */
.glass {
  background: rgba(17, 20, 25, .72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid rgba(255,255,255,.07);
}
@supports not (backdrop-filter: blur(4px)) { .glass { background: var(--surface-1); } }

/* Stat tile */
.stat {
  position: relative;
  padding: var(--space-4);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.stat::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--stat-accent, var(--purple-600));
}
.stat-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.stat-value {
  display: block;
  margin-top: var(--space-1);
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: 1.1;
}
.stat-meta { margin-top: var(--space-1); font-size: var(--text-xs); color: var(--text-secondary); }
.stat-icon {
  position: absolute;
  right: var(--space-4); top: var(--space-4);
  font-size: var(--text-lg);
  color: var(--stat-accent, var(--purple-500));
  opacity: .5;
}
.stat--gold    { --stat-accent: var(--gold-500); }
.stat--success { --stat-accent: var(--success); }
.stat--danger  { --stat-accent: #EF4444; }
.stat--info    { --stat-accent: var(--info); }

/* ==========================================================================
   8. BADGES, CHIPS, ALERTS
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3em;
  padding: .2em .55em;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: var(--text-2xs);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;          /* a wrapped badge looks broken */
}
.badge-purple  { background: rgba(124,58,237,.16); border-color: rgba(124,58,237,.38); color: var(--purple-300); }
.badge-gold    { background: var(--warning-bg);  border-color: var(--warning-br); color: var(--gold-300); }
.badge-success { background: var(--success-bg);  border-color: var(--success-br); color: #6EE7A0; }
.badge-danger  { background: var(--danger-bg);   border-color: var(--danger-br);  color: #FCA5A5; }
.badge-info    { background: var(--info-bg);     border-color: var(--info-br);    color: #7DD3FC; }
.badge-neutral { background: var(--surface-3);   border-color: var(--border-strong); color: var(--text-secondary); }
.badge-solid-gold   { background: var(--gold-500); color: var(--on-accent); border-color: transparent; }
.badge-solid-purple { background: var(--purple-600); color: #fff; border-color: transparent; }

/* Status pill with a dot — shape/text carry meaning, not just hue */
.status { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); font-weight: 600; }
.status::before {
  content: '';
  width: .5rem; height: .5rem;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 22%, transparent);
}
.status-success { color: var(--success); }
.status-pending { color: var(--warning); }
.status-failed  { color: var(--danger); }
.status-muted   { color: var(--text-muted); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 2.25rem;
  padding: var(--space-1) var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.chip:hover { background: var(--surface-3); color: var(--text); }
.chip.is-active { background: rgba(124,58,237,.16); border-color: var(--purple-600); color: var(--purple-300); }

/* Scrollable filter bar — no wrap, no horizontal page scroll */
.chip-bar {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding-bottom: var(--space-1);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.chip-bar::-webkit-scrollbar { display: none; }
.chip-bar > * { scroll-snap-align: start; }

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius);
  background: var(--surface-1);
  font-size: var(--text-base);
}
.alert > i { flex: none; margin-top: .15em; font-size: var(--text-md); }
.alert-title { font-weight: 700; margin-bottom: var(--space-1); }
.alert-success { border-left-color: var(--success); background: var(--success-bg); }
.alert-warning { border-left-color: var(--warning); background: var(--warning-bg); }
.alert-danger  { border-left-color: #EF4444;       background: var(--danger-bg); }
.alert-info    { border-left-color: var(--info);   background: var(--info-bg); }
.alert-success > i { color: var(--success); }
.alert-warning > i { color: var(--warning); }
.alert-danger  > i { color: var(--danger); }
.alert-info    > i { color: var(--info); }

/* ==========================================================================
   9. TABLES
   ========================================================================== */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  -webkit-overflow-scrolling: touch;
}
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th, .table td { padding: var(--space-3) var(--space-4); text-align: left; white-space: nowrap; }
.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.table tbody tr { border-bottom: 1px solid var(--border-subtle); transition: background-color var(--dur-fast) var(--ease); }
.table tbody tr:last-child { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .cell-actions { display: flex; gap: var(--space-2); justify-content: flex-end; }
.table caption { padding: var(--space-3); color: var(--text-muted); font-size: var(--text-xs); text-align: left; }

/* Below 768px a wide table becomes stacked cards. Each td exposes its column
   name through data-label, so no header context is lost. */
@media (max-width: 767px) {
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr {
    margin: var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }
  .table-cards td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-2) 0;
    white-space: normal;
    border-bottom: 1px dashed var(--border-subtle);
  }
  .table-cards td:last-child { border-bottom: 0; }
  .table-cards td::before {
    content: attr(data-label);
    flex: none;
    font-size: var(--text-2xs);
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-muted);
  }
  .table-cards td:not([data-label])::before { content: none; }
  .table-cards .cell-actions { justify-content: flex-start; }
  .table-wrap:has(.table-cards) { border: 0; background: transparent; }
}

/* Scroll affordance for tables kept as tables on mobile */
.table-scroll-hint { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-4) 0; font-size: var(--text-xs); color: var(--text-muted); }
@media (min-width: 768px) { .table-scroll-hint { display: none; } }

/* ==========================================================================
   10. MODAL / DIALOG
   ========================================================================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: rgba(6, 8, 11, .78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal.is-open { display: flex; animation: fade-in var(--dur) var(--ease-out) both; }

.modal-panel {
  width: 100%;
  max-width: 28rem;
  max-height: min(85dvh, 44rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: modal-in var(--dur-slow) var(--ease-out) both;
}
.modal-panel--wide { max-width: 44rem; }
.modal-media { width: 100%; max-height: 12rem; object-fit: cover; border-bottom: 1px solid var(--border); }
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-5) var(--space-3);
}
.modal-title { font-size: var(--text-lg); }
.modal-body { padding: 0 var(--space-5) var(--space-5); color: var(--text-secondary); }
.modal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-subtle);
}
.modal-footer > .btn { flex: 1 1 8rem; }
.modal-close {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem; height: 2.25rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.modal-close:hover { background: var(--surface-3); color: var(--text); }

/* Sheet variant: on phones a bottom sheet beats a centred dialog */
@media (max-width: 640px) {
  .modal--sheet { align-items: flex-end; padding: 0; }
  .modal--sheet .modal-panel {
    max-width: none;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    animation: sheet-in var(--dur-slow) var(--ease-out) both;
  }
}

body.modal-open { overflow: hidden; }

/* ==========================================================================
   11. TOAST
   ========================================================================== */
#toast-container {
  position: fixed;
  z-index: 9999;
  top: calc(var(--space-4) + env(safe-area-inset-top, 0px));
  right: var(--space-4);
  left: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}
@media (min-width: 640px) { #toast-container { left: auto; width: 22rem; } }

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--purple-500);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  color: var(--text);
  font-size: var(--text-base);
  pointer-events: auto;
  animation: toast-in var(--dur-slow) var(--ease-out) both;
}
.toast.is-leaving { animation: toast-out var(--dur) var(--ease) both; }
.toast > i { flex: none; margin-top: .1em; font-size: var(--text-md); }
.toast-close {
  flex: none;
  margin: -.25rem -.25rem -.25rem 0;
  width: 1.75rem; height: 1.75rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.toast-close:hover { color: var(--text); background: var(--surface-3); }
.toast.success { border-left-color: var(--success); }
.toast.success > i { color: var(--success); }
.toast.error   { border-left-color: #EF4444; }
.toast.error > i   { color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.warning > i { color: var(--warning); }
.toast.info    { border-left-color: var(--info); }
.toast.info > i    { color: var(--info); }

/* ==========================================================================
   12. LOADING / SKELETON / EMPTY
   ========================================================================== */
#loader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(11, 13, 17, .8);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
#loader.is-active { display: flex; animation: fade-in var(--dur-fast) var(--ease) both; }

.spinner {
  width: 2.5rem; height: 2.5rem;
  border: 3px solid var(--border-strong);
  border-top-color: var(--purple-500);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner-sm { width: 1.125rem; height: 1.125rem; border-width: 2px; }

/* Skeletons reserve the final layout, so nothing shifts when data lands */
.skeleton {
  background: linear-gradient(100deg, var(--surface-2) 30%, var(--surface-3) 50%, var(--surface-2) 70%);
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  animation: shimmer 1.4s var(--ease) infinite;
}
.skeleton-text { height: .8rem; margin-bottom: var(--space-2); }
.skeleton-text:nth-child(even) { width: 80%; }
.skeleton-title { height: 1.25rem; width: 45%; margin-bottom: var(--space-3); }
.skeleton-card { height: 11rem; border-radius: var(--radius-md); }
.skeleton-avatar { width: 2.5rem; height: 2.5rem; border-radius: 50%; }

/* Empty state — always names the next action */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-12) var(--space-5);
  text-align: center;
}
.empty-icon {
  display: grid;
  place-items: center;
  width: 4rem; height: 4rem;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--purple-400);
  font-size: var(--text-xl);
}
.empty-title { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 700; }
.empty-text { max-width: 28rem; color: var(--text-secondary); font-size: var(--text-base); }
.empty-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: center; margin-top: var(--space-2); }

/* Error state reuses the empty layout with a danger-tinted mark */
.empty--error .empty-icon { color: var(--danger); border-color: var(--danger-br); background: var(--danger-bg); }
.empty--success .empty-icon { color: var(--success); border-color: var(--success-br); background: var(--success-bg); }
.empty--warning .empty-icon { color: var(--warning); border-color: var(--warning-br); background: var(--warning-bg); }
.empty--compact { padding: var(--space-4) 0; }

/* Inline progress bar */
.progress {
  height: .5rem;
  background: var(--surface-3);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--purple-600), var(--purple-400));
  border-radius: inherit;
  transition: width var(--dur-slow) var(--ease-out);
}

/* ==========================================================================
   13. NAVIGATION
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--topbar-h);
  padding: var(--space-2) var(--space-4);
  background: rgba(17, 20, 25, .82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
@supports not (backdrop-filter: blur(4px)) { .topbar { background: var(--surface-1); } }

.brand { display: inline-flex; align-items: center; gap: var(--space-3); min-width: 0; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 2.25rem; height: 2.25rem;
  flex: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--purple-500), var(--purple-700));
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.brand-name {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text);
}

/* Wallet pill */
.wallet-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 2.25rem;
  padding: var(--space-1) var(--space-3);
  background: rgba(124,58,237,.12);
  border: 1px solid rgba(124,58,237,.4);
  border-radius: var(--radius-pill);
  color: var(--purple-300);
  font-size: var(--text-base);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.wallet-pill:hover { background: rgba(124,58,237,.2); border-color: var(--purple-500); color: var(--purple-300); }

.avatar {
  display: grid;
  place-items: center;
  width: 2.25rem; height: 2.25rem;
  flex: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
  color: var(--on-accent);
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 700;
  text-transform: uppercase;
}
.avatar-lg { width: 3.5rem; height: 3.5rem; font-size: var(--text-xl); }
.avatar-purple { background: linear-gradient(135deg, var(--purple-400), var(--purple-700)); color: #fff; }

/* Desktop sidebar */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  display: none;
  flex-direction: column;
  width: var(--sidebar-w);
  background: var(--surface-1);
  border-right: 1px solid var(--border);
}
@media (min-width: 768px) { .sidebar { display: flex; } }
.sidebar-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--topbar-h);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: var(--space-4) var(--space-3); }
.sidebar-group-label {
  padding: var(--space-4) var(--space-3) var(--space-2);
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.sidebar-foot { padding: var(--space-3); border-top: 1px solid var(--border-subtle); }

.side-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 2.75rem;
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-1);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: var(--text-base);
  font-weight: 500;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.side-link > i { width: 1.25rem; flex: none; text-align: center; font-size: var(--text-md); }
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link.is-active {
  background: rgba(124,58,237,.14);
  color: var(--purple-300);
  font-weight: 600;
}
.side-link.is-active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--purple-500);
}
.side-link .count {
  margin-left: auto;
  padding: 0 .4em;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  font-size: var(--text-2xs);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Mobile drawer — same links as the sidebar, for areas with deep navigation */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  background: rgba(6, 8, 11, .7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.drawer.is-open { display: block; animation: fade-in var(--dur-fast) var(--ease) both; }
.drawer-panel {
  width: min(19rem, 86vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface-1);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: drawer-in var(--dur-slow) var(--ease-out) both;
}
@media (min-width: 768px) { .drawer, .drawer-toggle { display: none !important; } }

/* Bottom navigation — max 5 destinations, 44px targets, safe-area aware */
.bottom-nav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 50;
  display: flex;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(17, 20, 25, .92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
@media (min-width: 768px) { .bottom-nav { display: none; } }
@supports not (backdrop-filter: blur(4px)) { .bottom-nav { background: var(--surface-1); } }

.nav-item {
  position: relative;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .125rem;
  min-height: var(--bottomnav-h);
  padding: var(--space-2) var(--space-1);
  color: var(--text-muted);
  font-size: var(--text-2xs);
  font-weight: 600;
  text-align: center;
  transition: color var(--dur-fast) var(--ease);
}
.nav-item > i { font-size: 1.125rem; transition: transform var(--dur) var(--ease-emphasis); }
button.nav-item { border: 0; background: none; font-family: inherit; cursor: pointer; }
.nav-item:hover { color: var(--purple-300); }
.nav-item:active > i { transform: scale(.9); }
.nav-item.is-active, .nav-item.active { color: var(--purple-300); }
.nav-item.is-active > i, .nav-item.active > i { transform: translateY(-1px); }
/* Single 2px indicator sitting on the nav border — no double lines, no pill */
.nav-item.is-active::before, .nav-item.active::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 2.25rem; height: 2px;
  border-radius: 0 0 2px 2px;
  background: linear-gradient(90deg, var(--purple-500), var(--purple-300));
}
.nav-item.is-active::after, .nav-item.active::after { content: none; }

/* Topbar internals */
.topbar-title { flex: 1; min-width: 0; }
.topbar-page {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-actions { display: flex; align-items: center; gap: var(--space-2); flex: none; }
.topbar-actions.push { margin-left: auto; }
.drawer-close { margin-left: auto; }

/* Public pages carry no sidebar, so they keep the full width */
.app-body.no-chrome { padding-left: 0; }
.app-body.no-bottom-nav { padding-bottom: var(--space-8); }

/* Floating support link — clears the bottom nav and the home indicator */
.support-fab {
  position: fixed;
  right: var(--space-4);
  bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px) + var(--space-4));
  z-index: 45;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 2.75rem;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--text-base);
  font-weight: 600;
  box-shadow: var(--shadow-md);
  transition: transform var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.support-fab > i { color: #29A9EB; font-size: var(--text-md); }
.support-fab:hover { transform: translateY(-2px); border-color: var(--purple-600); color: var(--text); }
@media (min-width: 768px) { .support-fab { bottom: var(--space-6); right: var(--space-6); } }
@media (max-width: 400px) { .support-fab-label { display: none; } .support-fab { padding-inline: var(--space-3); } }

/* Site footer */
.site-footer {
  margin-top: var(--space-12);
  padding-block: var(--space-8);
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-1);
}
.site-footer-inner { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); text-align: center; }
.site-footer-brand {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text);
}
.site-footer-text { color: var(--text-secondary); font-size: var(--text-base); max-width: 36rem; }
.site-footer-social { display: flex; gap: var(--space-2); list-style: none; }
.site-footer-legal { color: var(--text-muted); font-size: var(--text-xs); }

/* Tabs */
.tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab-panel { margin-top: var(--space-5); animation: fade-in-up var(--dur-slow) var(--ease-out) both; }
.tab {
  position: relative;
  padding: var(--space-3) var(--space-4);
  min-height: 2.75rem;
  border: 0;
  background: none;
  color: var(--text-secondary);
  font-size: var(--text-base);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease);
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"], .tab.is-active { color: var(--purple-300); }
.tab[aria-selected="true"]::after, .tab.is-active::after {
  content: '';
  position: absolute;
  inset: auto 0 -1px 0;
  height: 2px;
  background: var(--purple-500);
  border-radius: 2px 2px 0 0;
}

/* Breadcrumb */
.crumbs { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); color: var(--text-muted); }
.crumbs a { color: var(--text-secondary); }
.crumbs a:hover { color: var(--purple-300); }

/* Pagination */
.pagination { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; justify-content: center; margin-top: var(--space-6); }
.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0 var(--space-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--text-base);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.page-link:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-strong); }
.page-link[aria-current="page"] { background: var(--purple-600); border-color: var(--purple-500); color: #fff; }
.page-link[aria-disabled="true"] { opacity: .4; pointer-events: none; }

/* ==========================================================================
   14. PRODUCT CARD
   ========================================================================== */
.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease-out),
              border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
.product-card:hover {
  transform: translateY(-4px);
  border-color: var(--purple-700);
  box-shadow: var(--shadow-md);
}
.product-card:active { transform: translateY(-1px); }
.product-media {
  position: relative;
  aspect-ratio: 1 / 1;      /* reserved space, so the grid never reflows */
  background: var(--surface-inset);
  overflow: hidden;
}
.product-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slower) var(--ease-out), opacity var(--dur) var(--ease);
}
.product-card:hover .product-media img { transform: scale(1.05); }

.product-badges {
  position: absolute;
  inset: var(--space-2) auto auto var(--space-2);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
}
.product-body { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-3); border-top: 1px solid var(--border-subtle); }
.product-name {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  line-height: var(--leading-snug);
  text-transform: uppercase;
  color: var(--text);
}
.product-price { font-size: var(--text-xs); color: var(--text-muted); }
.product-price strong { color: var(--gold-400); font-size: var(--text-base); font-variant-numeric: tabular-nums; }
.product-cta { margin-top: var(--space-2); }

/* Product detail: media/description beside a sticky purchase panel */
.product-detail { display: grid; gap: var(--space-5); align-items: start; }
@media (min-width: 1024px) {
  .product-detail { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
  .product-detail > .buy-panel { position: sticky; top: calc(var(--topbar-h) + var(--space-4)); }
}
.media-frame { aspect-ratio: 16 / 9; overflow: hidden; background: #000; border-bottom: 1px solid var(--border); }
.media-frame > img, .media-frame > video { display: block; width: 100%; height: 100%; object-fit: contain; }

/* Feature checklist */
.feature-list { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
@media (min-width: 640px) { .feature-list { grid-template-columns: 1fr 1fr; } }
.feature-list > li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.feature-list > li > i { flex: none; color: var(--success); }

/* Radio cards — plan/duration/method pickers */
.option-list { display: flex; flex-direction: column; gap: var(--space-2); }
.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 3.25rem;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.option:hover { border-color: var(--purple-700); }
.option > input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.option-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.15rem;
  height: 1.15rem;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  transition: border-color var(--dur) var(--ease);
}
.option-mark::after {
  content: '';
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: var(--purple-400);
  transform: scale(0);
  transition: transform var(--dur) var(--ease-emphasis);
}
.option > input:checked ~ .option-mark { border-color: var(--purple-400); }
.option > input:checked ~ .option-mark::after { transform: scale(1); }
.option:has(> input:checked) { background: rgba(124, 58, 237, .12); border-color: var(--purple-500); }
.option:has(> input:focus-visible) { box-shadow: var(--focus-ring); }
.option-label { font-family: var(--font-display); font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.option-price { color: var(--gold-400); font-weight: 700; font-variant-numeric: tabular-nums; }
.option.is-disabled { cursor: not-allowed; opacity: .55; }
.option.is-disabled:hover { border-color: var(--border); }
.option.is-disabled .option-price { color: var(--text-muted); text-decoration: line-through; }

/* Number stepper — quantity pickers */
.stepper {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.stepper:focus-within { border-color: var(--purple-600); box-shadow: var(--focus-ring); }
.stepper > input {
  flex: 1;
  min-width: 0;
  padding: 0;
  text-align: center;
  background: none;
  border: 0;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stepper > input:focus { box-shadow: none; }
.stepper > input::-webkit-outer-spin-button,
.stepper > input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper > input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* Key / code display block — must stay selectable and legible */
.code-box {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-inset);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: var(--text-base);
  color: var(--gold-300);
  word-break: break-all;
  user-select: all;
}
.code-box .btn { flex: none; }
.label-mini + .code-box { margin-top: var(--space-2); }

/* Payment QR — needs a white quiet zone to stay scannable on a dark page */
.qr {
  display: block;
  width: 13.75rem;
  max-width: 100%;
  height: auto;
  padding: var(--space-3);
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

/* Multi-line code sample with a copy button in the corner */
.code-sample { position: relative; }
.code-sample > .btn { position: absolute; top: var(--space-2); right: var(--space-2); z-index: 1; }
.code-sample pre {
  margin: 0;
  padding: var(--space-10) var(--space-4) var(--space-4);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.7;
  color: var(--text-secondary);
  white-space: pre;
}
.inline-code {
  padding: .1em .4em;
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
  font-family: var(--font-mono);
  font-size: .95em;
  color: var(--purple-300);
}

/* List row that opens a detail dialog (orders, deposits, transactions) */
.order-row { gap: var(--space-4); }
.order-row .row { min-width: 0; }
.order-row .stack { min-width: 0; gap: var(--space-1); }
.order-name {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--text);
}
.order-meta { font-size: var(--text-xs); color: var(--text-muted); }
.news-body { color: var(--text-secondary); white-space: pre-line; line-height: 1.7; }
.order-price { font-size: var(--text-md); font-weight: 700; }

/* Small square icon tile for step/feature cards */
.icon-tile {
  display: grid;
  place-items: center;
  width: 2.5rem; height: 2.5rem;
  border-radius: var(--radius);
  background: rgba(124, 58, 237, .14);
  color: var(--purple-300);
  font-size: var(--text-md);
}
.icon-tile--gold { background: var(--warning-bg); color: var(--gold-300); }
.icon-tile--lg { width: 4rem; height: 4rem; font-size: var(--text-2xl); margin-inline: auto; }
.icon-tile--success { background: var(--success-bg); color: var(--success); }

/* ==========================================================================
   15. UTILITIES
   ========================================================================== */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.hide-mobile { display: none; }
@media (min-width: 768px) { .hide-mobile { display: initial; } .hide-desktop { display: none !important; } }

.divider { height: 1px; background: var(--border-subtle); border: 0; margin: var(--space-5) 0; }

/* Vertical rhythm helpers — the only spacing utilities, kept to the token scale */
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.divider-gradient {
  height: 1px; border: 0; margin: var(--space-6) 0;
  background: linear-gradient(90deg, transparent, var(--border-strong) 50%, transparent);
}

.surface-1 { background: var(--surface-1); }
.surface-2 { background: var(--surface-2); }
.bordered { border: 1px solid var(--border); }
.rounded { border-radius: var(--radius); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }

.glow-purple { box-shadow: var(--glow-primary); }
.glow-gold   { text-shadow: 0 0 18px rgba(245,158,11,.45); }
.glow-text   { text-shadow: 0 0 14px rgba(167,139,250,.5); }

/* Print: strip chrome so receipts and key lists print cleanly */
@media print {
  .topbar, .sidebar, .bottom-nav, .drawer, #toast-container, #loader, .btn, .aurora, .particles { display: none !important; }
  body { background: #fff; color: #000; padding: 0; }
  .card, .table-wrap { border-color: #ccc; box-shadow: none; }
}

/* ==========================================================================
   16. MOTION
   Entrances are longer than exits; feedback is near-instant. Only opacity
   and transform are animated, so nothing triggers layout.
   ========================================================================== */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes fade-in-up {
  from { opacity: 0; transform: translate3d(0, 12px, 0); }
  to   { opacity: 1; transform: none; }
}
@keyframes modal-in {
  from { opacity: 0; transform: translate3d(0, 12px, 0) scale(.97); }
  to   { opacity: 1; transform: none; }
}
@keyframes sheet-in {
  from { transform: translate3d(0, 100%, 0); }
  to   { transform: none; }
}
@keyframes drawer-in {
  from { transform: translate3d(-100%, 0, 0); }
  to   { transform: none; }
}
@keyframes toast-in {
  from { opacity: 0; transform: translate3d(0, -10px, 0) scale(.98); }
  to   { opacity: 1; transform: none; }
}
@keyframes toast-out {
  to { opacity: 0; transform: translate3d(0, -6px, 0) scale(.98); }
}
@keyframes shimmer {
  from { background-position: 150% 0; }
  to   { background-position: -50% 0; }
}
@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50%      { opacity: .55; }
}

.fade-in-up { animation: fade-in-up var(--dur-slow) var(--ease-out) both; }
.fade-in    { animation: fade-in var(--dur-slow) var(--ease) both; }

/* Scroll reveal: elements start hidden only when JS is present to reveal
   them, so content is never stranded invisible. */
.js .reveal { opacity: 0; transform: translate3d(0, 14px, 0); }
.js .reveal.is-visible {
  opacity: 1;
  transform: none;
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

/* Staggered children, capped so a long list never waits seconds to appear */
.js .reveal-group > * { opacity: 0; transform: translate3d(0, 12px, 0); }
.js .reveal-group.is-visible > * {
  opacity: 1;
  transform: none;
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}
.js .reveal-group.is-visible > *:nth-child(1) { transition-delay: 0ms; }
.js .reveal-group.is-visible > *:nth-child(2) { transition-delay: 45ms; }
.js .reveal-group.is-visible > *:nth-child(3) { transition-delay: 90ms; }
.js .reveal-group.is-visible > *:nth-child(4) { transition-delay: 135ms; }
.js .reveal-group.is-visible > *:nth-child(5) { transition-delay: 180ms; }
.js .reveal-group.is-visible > *:nth-child(n+6) { transition-delay: 210ms; }

/* Respect the OS setting: hold the final state, animate nothing decorative */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .js .reveal, .js .reveal-group > * { opacity: 1 !important; transform: none !important; }
  .btn:hover, .card-interactive:hover, .product-card:hover { transform: none !important; }
  .spinner { animation-duration: .7s !important; }   /* keep busy state readable */
}

/* ==========================================================================
   17. LEGACY CLASS BRIDGE
   Older markup still uses these names. They resolve to design tokens so every
   page picks up the new system, refactored or not. Do not add new usages.
   ========================================================================== */
.bg-page   { background-color: var(--surface-0); }
.bg-card   { background-color: var(--surface-1); }
.bg-input  { background-color: var(--surface-2); }
.border-custom { border: 1px solid var(--border); }
.font-rajdhani { font-family: var(--font-display); }

/* Notice / announcement banner */
.notice-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: linear-gradient(100deg, var(--purple-700), var(--purple-600) 60%, var(--purple-800));
  border-bottom: 1px solid rgba(255,255,255,.10);
  color: #fff;
  font-size: var(--text-base);
  animation: fade-in var(--dur-slow) var(--ease-out) both;
}
.notice-banner button { background: none; border: 0; color: rgba(255,255,255,.75); cursor: pointer; padding: var(--space-2); }
.notice-banner button:hover { color: #fff; }

.modal-bg {
  background: rgba(6, 8, 11, .78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Slider */
.slider {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  aspect-ratio: 16 / 7;
}
@media (max-width: 640px) { .slider { aspect-ratio: 16 / 9; } }
.slider-slide {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0;
  transition: opacity var(--dur-slower) var(--ease);
}
.slider-slide.active { opacity: 1; z-index: 2; }
.slider-slide img { width: 100%; height: 100%; object-fit: cover; }
.slider-dots { position: absolute; inset: auto 0 var(--space-3) 0; z-index: 3; display: flex; justify-content: center; gap: var(--space-2); }
.slider-dot {
  width: .5rem; height: .5rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,.4);
  cursor: pointer;
  transition: width var(--dur) var(--ease-emphasis), background-color var(--dur) var(--ease);
}
.slider-dot.active { width: 1.25rem; background: var(--purple-400); }
.slider-arrow {
  position: absolute;
  top: 50%;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 2.5rem; height: 2.5rem;
  transform: translateY(-50%);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 50%;
  background: rgba(6,8,11,.55);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--dur) var(--ease), background-color var(--dur-fast) var(--ease);
}
.slider:hover .slider-arrow, .slider-arrow:focus-visible { opacity: 1; }
.slider-arrow:hover { background: var(--purple-600); }
/* Touch devices have no hover, so arrows stay visible there */
@media (hover: none) { .slider-arrow { opacity: 1; } }
.slider-arrow.prev { left: var(--space-3); }
.slider-arrow.next { right: var(--space-3); }

/* ==========================================================================
   AUTH PAGES — sign in, register, password recovery
   ========================================================================== */
.auth-shell {
  display: grid;
  place-items: center;
  min-height: calc(100dvh - var(--topbar-h) - var(--space-12));
  padding: var(--space-6) 0;
}
.auth-card {
  width: 100%;
  max-width: 27rem;
  padding: var(--space-6);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.auth-head { text-align: center; margin-bottom: var(--space-6); }
.auth-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.auth-sub { margin-top: var(--space-2); color: var(--text-secondary); font-size: var(--text-sm); }
.auth-alt {
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.auth-alt a { font-weight: 700; }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.captcha { display: flex; justify-content: center; margin-bottom: var(--space-4); }

/* Password strength meter */
.meter {
  height: .25rem;
  margin-top: var(--space-2);
  overflow: hidden;
  background: var(--surface-3);
  border-radius: var(--radius-pill);
}
.meter-bar {
  width: 0;
  height: 100%;
  background: var(--danger);
  border-radius: inherit;
  transition: width var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.meter-bar.is-mid    { background: var(--warning); }
.meter-bar.is-strong { background: var(--success); }

/* ==========================================================================
   LANDING HERO + LIVE ORDER FEED (public home)
   ========================================================================== */
.hero { padding: var(--space-8) 0 var(--space-6); text-align: center; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--gold-400); background: rgba(212,175,55,.08);
  border: 1px solid rgba(212,175,55,.28); border-radius: var(--radius-pill);
}
.hero-title {
  margin-top: var(--space-4);
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.875rem, 6vw, 3.25rem); line-height: 1.1;
  letter-spacing: .01em; text-wrap: balance;
}
.hero-title em {
  font-style: normal;
  background: linear-gradient(100deg, var(--purple-300), var(--gold-400));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub {
  max-width: 42rem; margin: var(--space-4) auto 0;
  color: var(--text-secondary); font-size: var(--text-base); text-wrap: pretty;
}
.hero-actions {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: var(--space-3); margin-top: var(--space-6);
}
.hero-actions > .btn { flex: 1 1 12rem; max-width: 16rem; }
.hero-trust {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: var(--space-4) var(--space-6); margin-top: var(--space-8);
  color: var(--text-muted); font-size: var(--text-sm);
}
.hero-trust li { display: flex; align-items: center; gap: var(--space-2); }
.hero-trust i { color: var(--success); }

.feed { display: grid; gap: var(--space-2); }
.feed-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-1); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}
.feed-item > i { color: var(--success); flex: none; }
.feed-body { min-width: 0; flex: 1 1 auto; }
.feed-title { font-size: var(--text-sm); font-weight: 600; }
.feed-meta { margin-top: 2px; font-size: var(--text-xs); color: var(--text-muted); }
.feed-amount { flex: none; font-weight: 700; color: var(--gold-400); font-variant-numeric: tabular-nums; }

/* ==========================================================================
   LUCKY SPIN WHEEL (reseller/spin.php)
   ========================================================================== */
.spin-layout {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .spin-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}

.wheel-stage {
  position: relative;
  width: min(320px, 78vw);
  aspect-ratio: 1;
  margin: 0 auto;
}
.wheel-stage::after {
  content: '';
  position: absolute; inset: -6%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 58, 237, .22), transparent 68%);
  pointer-events: none;
}
.wheel {
  position: relative;
  width: 100%; height: 100%;
  border-radius: 50%;
  border: 6px solid var(--border-strong);
  background: var(--surface-2);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .04), inset 0 0 28px rgba(0, 0, 0, .7);
  overflow: hidden;
  transition: transform 4.6s cubic-bezier(.16, .84, .17, 1);
  will-change: transform;
}
.wheel-label {
  position: absolute;
  top: 50%; left: 50%;
  width: 50%; height: 22px;
  margin-top: -11px;
  transform-origin: 0 50%;
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: var(--space-4);
  font-family: var(--font-display);
  font-weight: 700; font-size: var(--text-sm);
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .85);
}
.wheel-pointer {
  position: absolute;
  top: -2px; left: 50%;
  z-index: 2;
  width: 0; height: 0;
  transform: translateX(-50%);
  border-left: 13px solid transparent;
  border-right: 13px solid transparent;
  border-top: 26px solid var(--gold-400);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .6));
}
.wheel-hub {
  position: absolute;
  top: 50%; left: 50%;
  z-index: 2;
  width: 46px; height: 46px;
  transform: translate(-50%, -50%);
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface-1);
  border: 2px solid var(--purple-500);
  color: var(--gold-400);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .55);
}

.spin-cost {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-display);
  font-size: var(--text-sm); font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gold-400);
  background: rgba(212, 175, 55, .08);
  border: 1px solid rgba(212, 175, 55, .28);
  border-radius: var(--radius-pill);
}

.spin-log {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}
.spin-log:last-child { border-bottom: 0; }
.spin-log-icon {
  flex: none;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.spin-log--win .spin-log-icon {
  background: var(--success-bg); border-color: var(--success-br); color: var(--success);
}
.spin-log-body { flex: 1 1 auto; min-width: 0; }
.spin-log-cost { flex: none; font-size: var(--text-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  .wheel { transition-duration: 1ms; }
}
