/* ==========================================================================
   SwapR — marketplace skin
   Loaded AFTER app.css and deliberately kept OUTSIDE @layer, so these rules
   win the cascade against every layered rule in the base sheet. It re-skins
   the existing component vocabulary (.card, .btn, .stat, .admin-nav, …) and
   adds the new marketplace pieces (hero, category strip, widget rail, side
   navigation, KPI tiles).

   Palette: light canvas + white cards, SwapR green for action, near-black
   panels for hero/sidebar, gold for the secondary "get started" accent.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens — light is the default look; every other theme resolves here too
   -------------------------------------------------------------------------- */
:root,
:root[data-theme="light"],
:root[data-theme="ocean"],
:root[data-theme="sunset"],
:root[data-theme="forest"],
:root[data-theme="violet"] {
  color-scheme: light;

  --brand: #16a34a;
  --brand-strong: #11823c;
  --brand-bright: #22c55e;
  --brand-hover: #178a3f;
  --brand-dim: #0f7a38;
  --brand-lime: #4ade80;
  --brand-ink: #ffffff;
  --brand-soft: #e8f8ee;
  --brand-soft-2: #d6f2e1;

  --gold: #f5b800;
  --gold-soft: #fff5d6;

  --ink: #0b1210;
  --ink-2: #121b17;
  --ink-3: #1b2621;
  --ink-line: #223029;
  --ink-text: #e9f2ec;
  --ink-dim: #93a89c;

  --bg: #f4f6f8;
  --bg-raised: #ffffff;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --surface-3: #eef2f5;
  --border: #e5e9ee;
  --border-strong: #d5dce4;

  --text: #0e1620;
  --text-2: #5b6675;
  /* "dim" secondary text: kept dark enough to clear WCAG AA (4.5:1) on both
     --surface (#fff) and --bg (#f4f6f8). The old #8b95a3 only reached ~3.0:1,
     which made price captions, seller names and stat labels hard to read. */
  --text-3: #64707e;

  --danger: #dc2626;
  --danger-bg: #fdeceb;
  --warn: #b45309;
  --warn-bg: #fdf3e2;
  --info: #1d64c4;
  --info-bg: #eaf3ff;
  --ok: #12803c;
  --ok-bg: #e8f8ee;

  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgb(16 24 40 / .05);
  --shadow: 0 1px 3px rgb(16 24 40 / .06), 0 10px 26px -16px rgb(16 24 40 / .22);
  --shadow-lg: 0 28px 70px -28px rgb(16 24 40 / .35);

  --nav-h: 72px;
  --max: 1320px;
  --side-w: 248px;
}

/* Dark variant — kept for the theme picker (Midnight) */
:root[data-theme="dark"] {
  color-scheme: dark;

  --brand: #22c55e;
  --brand-strong: #16a34a;
  --brand-bright: #4ade80;
  --brand-hover: #2fbf62;
  --brand-dim: #15803d;
  --brand-lime: #86efac;
  --brand-ink: #05230f;
  --brand-soft: #10281b;
  --brand-soft-2: #14331f;

  --gold: #fbbf24;
  --gold-soft: #2b2410;

  --bg: #0a0f0d;
  --bg-raised: #111815;
  --surface: #111815;
  --surface-2: #0d1412;
  --surface-3: #17211d;
  --border: #1f2b26;
  --border-strong: #2b3a33;

  --text: #e9f2ec;
  --text-2: #9aab9f;
  --text-3: #71857a;

  --danger: #f87171;
  --danger-bg: rgb(248 113 113 / .12);
  --warn: #fbbf24;
  --warn-bg: rgb(251 191 36 / .13);
  --info: #7ab6ff;
  --info-bg: rgb(122 182 255 / .12);
  --ok: #4ade80;
  --ok-bg: rgb(34 197 94 / .14);

  --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
  --shadow: 0 8px 26px -14px rgb(0 0 0 / .6);
  --shadow-lg: 0 28px 70px -28px rgb(0 0 0 / .7);
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
body {
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
}

h1, h2, h3 { letter-spacing: -0.028em; }
h2 { font-size: clamp(1.25rem, 1.6vw, 1.55rem); font-weight: 800; }
h3 { font-weight: 750; }

.container { width: min(var(--max), 100% - 2.5rem); }
.section { padding: 2.2rem 0; }
.section-head { align-items: flex-end; gap: 1rem; margin-bottom: 1.1rem; }
.section-head .sub { color: var(--text-2); font-size: .92rem; }

/* --------------------------------------------------------------------------
   3. Header — white bar, brand mark, nav, search, actions
   -------------------------------------------------------------------------- */
.site-header {
  height: var(--nav-h);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 2px rgb(16 24 40 / .03);
}
.site-header .container { gap: 1rem; }

/* Wordmark drawn with CSS — never an image asset */
.brand { gap: .62rem; font-weight: 800; font-size: 1.24rem; letter-spacing: -0.04em; color: var(--text); }
.brand img { display: none !important; }
.brand::before {
  content: "";
  width: 34px; height: 34px; flex: none;
  border-radius: 10px;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 3 4 7l4 4'/%3E%3Cpath d='M4 7h16'/%3E%3Cpath d='m16 21 4-4-4-4'/%3E%3Cpath d='M20 17H4'/%3E%3C/svg%3E"),
    linear-gradient(140deg, var(--brand-bright), var(--brand) 55%, var(--brand-strong));
  background-repeat: no-repeat, no-repeat;
  background-position: center, center;
  background-size: 19px 19px, cover;
  box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--brand) 70%, transparent);
}

.nav { gap: .1rem; }
.nav a, .nav button.navlink {
  padding: .55rem .82rem;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-2);
}
.nav a:hover, .nav button.navlink:hover { color: var(--text); background: var(--surface-3); }
.nav a.active { color: var(--brand-strong); background: var(--brand-soft); }
.nav .icon-btn { color: var(--text-2); }
.nav .icon-btn:hover { color: var(--text); background: var(--surface-3); }

/* Search field in the top bar */
.h-search { position: relative; flex: 1 1 320px; max-width: 520px; margin: 0 auto; }
/* input[type="search"] selector (global rule below) has equal specificity to
   .h-search input and comes later, so qualify the type to keep these wins. */
.h-search input[type="search"] {
  width: 100%; height: 42px; padding: 0 1rem 0 2.5rem;
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  background: var(--surface-2); color: var(--text); font-size: .9rem;
}
.h-search input[type="search"]::placeholder { color: var(--text-3); }
.h-search input[type="search"]:focus-visible { outline: none; border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent); }
.h-search .h-search-ico { position: absolute; left: .95rem; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
@media (max-width: 1024px) { .h-search { display: none; } }

.user-btn { border-radius: var(--radius-pill); padding: .25rem .5rem .25rem .25rem; }
.user-btn:hover { background: var(--surface-3); }
.avatar { background: var(--brand-soft); color: var(--brand-strong); font-weight: 750; }
.dot-badge { background: var(--brand); color: var(--brand-ink); }

/* --------------------------------------------------------------------------
   4. Buttons, pills, chips, badges
   -------------------------------------------------------------------------- */
.btn {
  border-radius: var(--radius-pill);
  padding: .62rem 1.15rem;
  font-size: .88rem;
  font-weight: 650;
  border: 1px solid transparent;
  transition: transform var(--speed), background var(--speed), border-color var(--speed), box-shadow var(--speed);
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--brand); color: var(--brand-ink);
  box-shadow: 0 8px 18px -10px color-mix(in srgb, var(--brand) 85%, transparent);
}
.btn-primary:hover { background: var(--brand-hover); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand-strong); background: var(--surface); }
.btn-quiet { background: var(--surface-3); color: var(--text-2); }
.btn-quiet:hover { background: var(--border); color: var(--text); }
.btn-gold { background: var(--gold); color: #241a02; }
.btn-gold:hover { background: #e2a900; }
.btn-sm { padding: .42rem .82rem; font-size: .79rem; }
.btn-lg { padding: .82rem 1.6rem; font-size: .95rem; }

.pill {
  border-radius: var(--radius-pill);
  font-size: .7rem; font-weight: 700;
  padding: .2rem .6rem;
  background: var(--surface-3); color: var(--text-2);
  border: 1px solid transparent;
}
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.info { background: var(--info-bg); color: var(--info); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.danger { background: var(--danger-bg); color: var(--danger); }
.pill.neutral { background: var(--surface-3); color: var(--text-2); }
.pill.gold { background: var(--gold-soft); color: #8a6400; }

.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .75rem; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: var(--surface);
  font-size: .8rem; font-weight: 600; color: var(--text-2);
}
.chip:hover { border-color: var(--brand); color: var(--brand-strong); }
.chip.on { background: var(--brand-soft); border-color: var(--brand-soft-2); color: var(--brand-strong); }

/* app.css draws this as a filled --brand circle (15px, border-radius 50%) with
   a --brand-ink glyph. Overriding `color` to --brand left the tick the same
   green as its own background, so the checkmark was invisible everywhere. */
.verified-tick { color: var(--brand-ink); }

/* --------------------------------------------------------------------------
   5. Cards & section furniture
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card.pad-lg { padding: 1.6rem; }
.card-head { padding: 1.05rem 1.25rem; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 1rem; font-weight: 750; }
.card-head .xs[href] { color: var(--brand-strong); font-weight: 650; }
.card > .stack, .card > p { padding: 0 1.25rem; }
.card-head + .stack { padding-top: 1rem; }
.card > .stack:last-child, .card > p:last-child { padding-bottom: 1.25rem; }

.kv { padding: 0 1.25rem 1.1rem; }
.kv dt { color: var(--text-3); font-size: .78rem; }
.kv dd { font-weight: 650; }

.strip {
  border-radius: var(--radius); padding: .7rem .95rem;
  border: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: center; gap: .6rem; font-size: .86rem;
}
.strip.ok { border-color: var(--brand-soft-2); background: var(--brand-soft); color: var(--brand-strong); }
.strip.danger { border-color: #f7c9c6; background: var(--danger-bg); color: var(--danger); }

.empty {
  border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
  background: var(--surface); padding: 3rem 1.5rem; text-align: center;
}
.empty .big { color: var(--text-3); display: grid; place-items: center; margin-bottom: .8rem; }
/* Landing-page empty states — illustration-led, same dashed shell */
.empty .es-art { display: block; width: min(230px, 72%); height: auto; margin: 0 auto .4rem; }
.empty h3 { font-size: 1.05rem; margin: .1rem 0 0; }
.empty p { color: var(--text-3); margin: .35rem auto 0; max-width: 46ch; }
.empty .es-cta { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; margin-top: 1rem; }
.empty.compact { padding: 1.4rem 1rem; }
.empty.compact .es-art { width: 130px; }
.empty.compact p { margin-top: 0; }
.empty.compact .es-cta { margin-top: .7rem; }

/* --------------------------------------------------------------------------
   6. Listing cards
   -------------------------------------------------------------------------- */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 1rem; }

.listing-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--speed) var(--ease), box-shadow var(--speed), border-color var(--speed);
}
.listing-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.listing-card .thumb { aspect-ratio: 4 / 3; background: var(--surface-3); position: relative; }
.listing-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.listing-card .noimg { display: grid; place-items: center; height: 100%; color: var(--text-3); font-size: 1.6rem; }
.listing-card .tags { position: absolute; top: .55rem; left: .55rem; display: flex; gap: .3rem; flex-wrap: wrap; }
.listing-card .body { padding: .8rem .9rem 1rem; display: grid; gap: .45rem; }
.listing-card .title { font-weight: 650; font-size: .92rem; line-height: 1.35; }
.listing-card .price { font-weight: 800; font-size: 1rem; letter-spacing: -0.02em; }
.listing-card .who { font-size: .76rem; color: var(--text-3); border-top: 1px solid var(--border); padding-top: .5rem; margin-top: .15rem; }
.listing-card .price-alt { color: var(--text-3); }

/* --------------------------------------------------------------------------
   7. Home — hero, category strip, promos, why-row
   -------------------------------------------------------------------------- */
.mk-hero {
  position: relative; overflow: hidden;
  border-radius: 26px;
  background:
    radial-gradient(760px 420px at 88% 8%, color-mix(in srgb, var(--brand) 34%, transparent), transparent 62%),
    radial-gradient(500px 320px at 8% 96%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 60%),
    linear-gradient(135deg, var(--ink) 0%, var(--ink-3) 62%, var(--ink-2) 100%);
  color: var(--ink-text);
  padding: clamp(1.6rem, 3.4vw, 3.1rem);
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: 2rem; align-items: center;
  margin-top: 1.4rem;
}
.mk-hero .eyebrow {
  display: inline-flex; align-items: center; gap: .45rem;
  font-size: .74rem; font-weight: 750; letter-spacing: .12em; text-transform: uppercase;
  color: var(--brand-lime);
}
.mk-hero h1 {
  font-size: clamp(1.7rem, 3.6vw, 2.9rem); font-weight: 850; line-height: 1.08;
  margin: .7rem 0 .8rem; color: #fff;
}
.mk-hero h1 .accent { color: var(--brand-lime); }
.mk-hero p.sub { color: color-mix(in srgb, var(--ink-text) 78%, transparent); max-width: 46ch; font-size: .96rem; }
.mk-hero .cta { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1.35rem; }
.mk-hero .btn-ghost { background: rgb(255 255 255 / .08); border-color: rgb(255 255 255 / .22); color: #fff; }
.mk-hero .btn-ghost:hover { background: rgb(255 255 255 / .16); border-color: rgb(255 255 255 / .4); color: #fff; }
.mk-trust { display: flex; flex-wrap: wrap; gap: 1.4rem; margin-top: 1.9rem; padding-top: 1.2rem; border-top: 1px solid rgb(255 255 255 / .12); }
.mk-trust .t { display: flex; gap: .55rem; align-items: center; font-size: .78rem; }
.mk-trust .t .ico { color: var(--brand-lime); }
.mk-trust .t strong { display: block; color: #fff; font-size: .82rem; }
.mk-trust .t span { color: color-mix(in srgb, var(--ink-text) 62%, transparent); }

/* hero artwork — self-contained marketplace scene, no listing dependency */
.mk-art { position: relative; min-height: 250px; }
.mk-art .mk-scene { display: block; width: 100%; height: auto; }
.mk-art .bob { animation: mkBob 7s ease-in-out infinite; }
.mk-art .b2 { animation-duration: 6s; animation-delay: -1.4s; }
.mk-art .b3 { animation-duration: 6.6s; animation-delay: -2.8s; }
.mk-art .b4 { animation-duration: 7.6s; animation-delay: -.7s; }
.mk-art .b5 { animation-duration: 5.4s; animation-delay: -2.1s; }
@keyframes mkBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@media (prefers-reduced-motion: reduce) { .mk-art .bob { animation: none; } }
.mk-art .badge {
  position: absolute; right: 8%; top: 10%; z-index: 4;
  background: var(--brand); color: var(--brand-ink);
  border-radius: 14px; padding: .55rem .8rem; font-size: .74rem; font-weight: 750; text-align: center;
  box-shadow: 0 16px 32px -14px rgb(0 0 0 / .6);
}
.mk-art .badge b { display: block; font-size: 1.05rem; }
@media (max-width: 900px) { .mk-hero { grid-template-columns: 1fr; } .mk-art { display: none; } }

/* Category strip */
.cat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: .6rem; }
.cat-tile {
  display: grid; justify-items: center; gap: .5rem;
  padding: 1.05rem .6rem; border-radius: var(--radius); text-align: center;
  border: 1px solid var(--border); background: var(--surface);
  font-size: .8rem; font-weight: 650; color: var(--text);
  transition: border-color var(--speed), transform var(--speed) var(--ease), box-shadow var(--speed);
}
.cat-tile:hover { border-color: var(--brand); transform: translateY(-3px); box-shadow: var(--shadow); }
.cat-tile .ico {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-strong);
}
.cat-tile .cat-meta { display: grid; gap: .1rem; justify-items: center; }
.cat-tile .cat-name { font-size: .8rem; font-weight: 650; color: var(--text); }
.cat-tile .cat-count { font-size: .66rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }

/* Live platform stats band under the hero */
.home-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.05rem 1.2rem; box-shadow: var(--shadow-sm);
}
.home-stats .hs { display: grid; gap: .2rem; padding-left: .9rem; border-left: 3px solid var(--brand-soft); }
.home-stats .hs:first-child { border-left-color: var(--brand); }
.home-stats .v { font-size: 1.3rem; font-weight: 850; letter-spacing: -0.03em; line-height: 1.1; }
.home-stats .k { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }

/* Live dot on the hero escrow badge */
.mk-art .badge .pulse {
  width: 8px; height: 8px; border-radius: 50%; background: var(--brand-lime);
  display: inline-block; margin-right: .45rem;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand-lime) 70%, transparent);
  animation: pulse-ring 2s ease-out infinite;
}
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand-lime) 65%, transparent); }
  70% { box-shadow: 0 0 0 9px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) { .mk-art .badge .pulse { animation: none; } }

/* "How a trade runs" — connected stepper instead of a plain list.
   app.css styles .step for the /how page (counter circle via ::after) —
   scope our overrides to .stepper and kill that inherited decoration. */
.stepper .step::after { content: none; }
.stepper { list-style: none; margin: 0; padding: .2rem 1.25rem 1.1rem; display: grid; gap: .1rem; }
.stepper .step {
  display: grid; grid-template-columns: 30px 1fr; gap: .8rem; align-items: start;
  padding: .55rem 0; position: relative;
}
.stepper .step::before {
  content: ""; position: absolute; left: 14px; top: 40px; bottom: -6px;
  width: 2px; background: var(--border-strong);
}
.stepper .step:last-child::before { display: none; }
.stepper .step-n {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-strong);
  font-size: .8rem; font-weight: 800; position: relative; z-index: 1;
}
.stepper .step-t { font-size: .88rem; color: var(--text-2); padding-top: .3rem; }
.stepper .step:last-child .step-n { background: var(--brand); color: #fff; }

/* Promo banners */
.promo-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; }
.promo {
  border-radius: var(--radius-lg); padding: 1.4rem; color: #fff;
  background: linear-gradient(135deg, var(--ink), var(--ink-3));
  position: relative; overflow: hidden; min-height: 150px;
  display: flex; flex-direction: column; justify-content: center; gap: .5rem;
}
.promo.green { background: linear-gradient(135deg, var(--brand-strong), var(--brand) 70%, var(--brand-bright)); }
.promo.gold { background: linear-gradient(135deg, #8a6400, var(--gold)); color: #241a02; }
.promo .kicker { font-size: .7rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; opacity: .85; }
.promo h3 { font-size: 1.15rem; font-weight: 800; line-height: 1.2; }
.promo p { font-size: .82rem; opacity: .88; }
.promo .btn { align-self: flex-start; margin-top: .5rem; }
.promo::after {
  content: ""; position: absolute; right: -40px; bottom: -50px;
  width: 170px; height: 170px; border-radius: 50%;
  background: rgb(255 255 255 / .12);
}

/* Why row */
.why-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; }
.why { display: flex; gap: .75rem; align-items: flex-start; }
.why .ico {
  width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-strong);
}
.why strong { display: block; font-size: .9rem; }
.why span { font-size: .78rem; color: var(--text-3); }

/* Home shell with right rail */
.mk-shell { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.4rem; align-items: start; }
@media (max-width: 1080px) { .mk-shell { grid-template-columns: 1fr; } }
.mk-rail { display: grid; gap: 1rem; position: sticky; top: calc(var(--nav-h) + 1rem); }
@media (max-width: 1080px) { .mk-rail { position: static; } }

.widget { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.1rem; box-shadow: var(--shadow-sm); }
.widget h4 { font-size: .95rem; font-weight: 750; }
.wl-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.wl-head a { font-size: .76rem; font-weight: 650; color: var(--brand-strong); }

/* Greeting widget */
.hello { display: flex; gap: .75rem; align-items: center; }
.hello .hi { font-size: 1.05rem; font-weight: 800; }
.hello .sub { font-size: .78rem; color: var(--text-3); }

/* Balance / limit card */
.balance-card {
  border-radius: var(--radius-lg); padding: 1.15rem; color: #fff;
  background: linear-gradient(140deg, var(--ink), var(--ink-3) 70%, var(--brand-strong));
  display: grid; gap: .3rem;
}
.balance-card .lbl { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; opacity: .8; }
.balance-card .amt { font-size: 1.6rem; font-weight: 850; letter-spacing: -0.03em; }
.balance-card .note { font-size: .74rem; opacity: .8; }
.balance-card .row { justify-content: space-between; margin-top: .5rem; }

/* Quick action tiles */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: .55rem; }
.quick-tile {
  display: grid; justify-items: center; gap: .4rem; padding: .8rem .4rem;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  font-size: .74rem; font-weight: 650; text-align: center; color: var(--text-2);
  transition: border-color var(--speed), color var(--speed), transform var(--speed) var(--ease);
}
.quick-tile:hover { border-color: var(--brand); color: var(--brand-strong); transform: translateY(-2px); }
.quick-tile .ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-strong); }

/* Compact product row (recently viewed / latest deals) */
.p-list { display: grid; gap: .7rem; }
.p-item { display: flex; gap: .65rem; align-items: center; }
.p-item .ph { width: 46px; height: 46px; flex: none; border-radius: 11px; overflow: hidden; background: var(--surface-3); }
.p-item .ph img { width: 100%; height: 100%; object-fit: cover; }
.p-item .nm { font-size: .82rem; font-weight: 600; line-height: 1.3; }
.p-item .pr { font-size: .78rem; color: var(--brand-strong); font-weight: 700; }

/* --------------------------------------------------------------------------
   8. App shell — dark left navigation for signed-in pages
   -------------------------------------------------------------------------- */
.side-nav {
  position: fixed; top: var(--nav-h); left: 0; bottom: 0;
  width: var(--side-w); padding: 1.1rem .8rem 1.6rem;
  background: var(--ink); color: var(--ink-text);
  border-right: 1px solid var(--ink-line);
  overflow-y: auto; z-index: 40;
  display: flex; flex-direction: column; gap: 1.15rem;
}
.sn-group { display: grid; gap: .15rem; }
.sn-label {
  font-size: .66rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-dim); padding: 0 .7rem .35rem;
}
.sn-item {
  display: flex; align-items: center; gap: .7rem;
  padding: .58rem .7rem; border-radius: 10px;
  font-size: .86rem; font-weight: 600; color: color-mix(in srgb, var(--ink-text) 72%, transparent);
}
.sn-item .ico { display: grid; place-items: center; color: currentColor; }
.sn-item:hover { background: var(--ink-2); color: #fff; }
.sn-item.active { background: var(--brand); color: var(--brand-ink); font-weight: 700; }
.sn-item .count { margin-left: auto; background: rgb(255 255 255 / .16); color: #fff; font-size: .68rem; padding: .05rem .42rem; border-radius: 999px; }
.sn-item.active .count { background: rgb(0 0 0 / .18); }
.sn-promo {
  margin-top: auto; border-radius: var(--radius); padding: 1rem;
  background: linear-gradient(150deg, var(--ink-3), var(--brand-strong));
  font-size: .78rem; color: #fff;
}
.sn-promo strong { display: block; font-size: .92rem; margin-bottom: .2rem; }

body.has-side main { padding-left: var(--side-w); }
body.has-side .site-footer { padding-left: var(--side-w); }
@media (max-width: 1023px) {
  .side-nav { display: none; }
  body.has-side main { padding-left: 0; }
  body.has-side .site-footer { padding-left: 0; }
}

/* --------------------------------------------------------------------------
   9. KPI tiles
   -------------------------------------------------------------------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 1rem; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem; box-shadow: var(--shadow-sm);
  display: grid; gap: .35rem;
}
.kpi .top { display: flex; align-items: center; justify-content: space-between; }
.kpi .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-strong); }
.kpi .ico.gold { background: var(--gold-soft); color: #8a6400; }
.kpi .ico.blue { background: var(--info-bg); color: var(--info); }
.kpi .ico.violet { background: #efeaff; color: #6d4bd8; }
.kpi .k { font-size: .8rem; color: var(--text-3); font-weight: 600; }
.kpi .v { font-size: 1.7rem; font-weight: 850; letter-spacing: -0.035em; line-height: 1.15; }
.kpi .delta { font-size: .76rem; font-weight: 650; color: var(--ok); }
.kpi .delta.down { color: var(--danger); }
/* Informational footnotes aren't good news — .mute keeps green meaningful.
   (Additive: consoles that don't opt in keep the legacy green delta.) */
.kpi .delta.mute { color: var(--text-3); font-weight: 600; }
.kpi .delta.warn { color: var(--warn); }
/* Linked tiles announce themselves: lift on hover, ring on keyboard focus. */
a.kpi {
  color: inherit; text-decoration: none; cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
a.kpi:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--brand) 45%, var(--border));
  box-shadow: 0 10px 24px -14px rgb(0 0 0 / .25);
}
a.kpi:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
/* The console overview runs five tiles where the rail leaves ~1010px: the
   default 215px floor wraps 4+1 into a ragged row. A 176px floor fits all
   five on one line and still collapses gracefully on narrow screens. */
.admin-layout .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); }
/* Semantic states carried over from .stat (good/bad) and newly honoured on
   .kpi — the ERP/hub/partner consoles encode ledger health in these classes. */
.kpi.good .v { color: var(--brand-strong); }
.kpi.good .ico { background: var(--ok-bg); color: var(--ok); }
.kpi.warn .v { color: var(--warn); }
.kpi.warn .ico { background: var(--warn-bg); color: var(--warn); }
.kpi.bad .v { color: var(--danger); }
.kpi.bad .ico { background: var(--danger-bg); color: var(--danger); }

/* Legacy stat tiles (kept working for other consoles) */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.05rem 1.2rem; box-shadow: var(--shadow-sm); }
.stat .v { font-size: 1.6rem; font-weight: 850; letter-spacing: -0.03em; }
.stat .k { font-size: .74rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.stat.good .v { color: var(--brand-strong); }
.stat::after { display: none; }

/* --------------------------------------------------------------------------
   10. Admin layout — dark fixed sidebar
   -------------------------------------------------------------------------- */
.admin-layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 1.6rem; align-items: start; }
.admin-nav {
  position: sticky; top: calc(var(--nav-h) + 1rem);
  background: var(--ink); border: 1px solid var(--ink-line); border-radius: var(--radius-lg);
  padding: .9rem .7rem 1.1rem; display: grid; gap: 1rem; color: var(--ink-text);
  max-height: calc(100dvh - var(--nav-h) - 2rem); overflow-y: auto;
}
.admin-nav-group { display: grid; gap: .1rem; }
/* Layout-transparent on desktop; ≤880px the toggle bar + collapsible drawer. */
.admin-nav-menu { display: contents; }
.admin-nav-toggle { display: none; }
.admin-nav-label { font-size: .64rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-dim); padding: 0 .6rem .3rem; }
.admin-nav a {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .6rem; border-radius: 9px; font-size: .84rem; font-weight: 600;
  color: color-mix(in srgb, var(--ink-text) 74%, transparent);
}
.admin-nav a .ico { color: currentColor; display: grid; place-items: center; }
.admin-nav a:hover { background: var(--ink-2); color: #fff; }
.admin-nav a.active { background: var(--brand); color: var(--brand-ink); font-weight: 700; }
.admin-nav a .count { margin-left: auto; background: rgb(255 255 255 / .16); font-size: .66rem; padding: .05rem .42rem; border-radius: 999px; }
.admin-nav a.active .count { background: rgb(0 0 0 / .18); }
.admin-nav a .arrow { margin-left: auto; opacity: .7; }
@media (max-width: 980px) { .admin-layout { grid-template-columns: 1fr; } .admin-nav { position: static; max-height: none; } }
/* On phones the console rail becomes a toggle bar that opens a wrapping row
   of chips. app.css sets that up, but this dark-skin block loads later and its
   `display: grid` would win — so mirror the drawer here in dark colours. */
@media (max-width: 880px) {
  .admin-nav { display: flex; flex-direction: column; gap: .45rem; padding: .55rem .6rem; }
  .admin-nav-toggle { display: flex; background: var(--ink-2); border-color: var(--ink-line); color: #fff; }
  .admin-nav-toggle .ico { color: color-mix(in srgb, var(--ink-text) 60%, transparent); }
  .admin-nav-where { color: color-mix(in srgb, var(--ink-text) 65%, transparent); }
  .admin-nav-menu { display: none; flex-wrap: wrap; gap: .35rem; }
  .admin-nav.is-open .admin-nav-menu { display: flex; }
  .admin-nav-group { display: contents; }
  .admin-nav a { padding: .4rem .7rem; font-size: .82rem; border-radius: var(--radius-pill); }
}

/* --------------------------------------------------------------------------
   11. Tables & forms
   -------------------------------------------------------------------------- */
table { border-collapse: separate; border-spacing: 0; }
thead th {
  font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-3); text-align: left; padding: .6rem .75rem; background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
tbody td { padding: .7rem .75rem; border-bottom: 1px solid var(--border); font-size: .86rem; }
tbody tr:hover td { background: var(--surface-2); }

.input, input[type="text"], input[type="search"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .55rem .75rem; color: var(--text); font-size: .88rem;
}
.input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent);
}

/* --------------------------------------------------------------------------
   12. Footer & mobile bottom nav
   -------------------------------------------------------------------------- */
.site-footer { background: var(--ink); color: color-mix(in srgb, var(--ink-text) 72%, transparent); border-top: 1px solid var(--ink-line); }
.site-footer h4 { color: #fff; }
.site-footer a { color: color-mix(in srgb, var(--ink-text) 72%, transparent); }
.site-footer a:hover { color: var(--brand-lime); }
.site-footer .brand { color: #fff; }
.site-footer .brand::after { color: var(--brand-ink); }
/* The footer is always the dark "ink" surface, so its tagline must not inherit
   a light-theme --text (near-black) — that made it invisible on light themes. */
.site-footer .f-tag { color: #fff; }
.site-footer .f-desc { color: color-mix(in srgb, var(--ink-text) 72%, transparent); }
/* Desktop keeps the floating SwapR AI button pinned bottom-right; reserve room
   so it never sits on top of the fine print. */
@media (min-width: 880px) { .site-footer .fine { padding-right: 8rem; } }

.bottom-nav { background: color-mix(in srgb, var(--surface) 94%, transparent); border-top: 1px solid var(--border); }
.bottom-nav a { color: var(--text-3); }
.bottom-nav a.active { color: var(--brand-strong); }
.bottom-nav .sell .dn-sell { background: var(--brand); color: var(--brand-ink); }

/* --------------------------------------------------------------------------
   13. Small pieces
   -------------------------------------------------------------------------- */
.eyebrow { display: inline-flex; align-items: center; gap: .4rem; font-size: .76rem; font-weight: 650; color: var(--text-3); }
.market .market-code { background: var(--brand-soft); border-color: var(--brand-soft-2); color: var(--brand-strong); }
.stars { color: var(--gold); letter-spacing: .1em; }
.prog { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.prog > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand-bright), var(--brand)); }

/* Legend dots used by charts */
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.green { background: var(--brand); }
.dot.blue { background: var(--info); }
.dot.gold { background: var(--gold); }
.dot.violet { background: #7c5cff; }
.dot.red { background: var(--danger); }
.dot.grey { background: var(--border-strong); }

/* Bar chart (pure CSS) */
.bars { display: flex; align-items: flex-end; gap: .5rem; height: 150px; }
.bars .b { flex: 1; border-radius: 8px 8px 0 0; background: linear-gradient(180deg, var(--brand-bright), var(--brand)); opacity: .85; }
.bars .b.alt { background: linear-gradient(180deg, color-mix(in srgb, var(--info) 70%, transparent), var(--info)); }

/* Donut (pure CSS) */
.donut { width: 128px; height: 128px; border-radius: 50%; flex: none; position: relative; }
.donut::after { content: ""; position: absolute; inset: 22px; border-radius: 50%; background: var(--surface); }

/* Hero welcome banner (signed-in) */
.app-hero {
  border-radius: 24px; padding: clamp(1.4rem, 2.6vw, 2.1rem);
  background:
    radial-gradient(600px 320px at 92% 0%, color-mix(in srgb, var(--brand) 38%, transparent), transparent 60%),
    linear-gradient(135deg, var(--ink), var(--ink-3));
  color: var(--ink-text);
  display: flex; flex-wrap: wrap; gap: 1.2rem; align-items: center; justify-content: space-between;
}
.app-hero h1 { color: #fff; font-size: clamp(1.4rem, 2.4vw, 2rem); font-weight: 850; }
.app-hero p { color: color-mix(in srgb, var(--ink-text) 76%, transparent); font-size: .9rem; }
.app-hero .quick-grid { grid-template-columns: repeat(2, minmax(110px, 1fr)); min-width: 260px; }
.app-hero .quick-tile { background: rgb(255 255 255 / .08); border-color: rgb(255 255 255 / .16); color: #fff; }
.app-hero .quick-tile .ico { background: rgb(255 255 255 / .14); color: var(--brand-lime); }
/* Eyebrows keep their small-caps feel inside the ink hero (the generic
   .app-hero p rule would otherwise out-specify .eyebrow). */
.app-hero p.eyebrow { color: color-mix(in srgb, var(--ink-text) 68%, transparent); font-size: .76rem; }
/* Status pills sit on the ink gradient in both themes — a whisper of white
   keeps neutral chips (dark bg in dark mode) defined against it. */
.app-hero .pill { border-color: rgb(255 255 255 / .22); }

/* The header bar gains a search only on wide screens; nav sits right */
.h-search + .nav { margin-left: auto; }
.nav .hide-sm { display: inline-flex; }
@media (max-width: 760px) { .nav .hide-sm { display: none; } }

/* Utility spacing shorthands used by the rebuilt views */
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.6rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-2 { gap: 1rem; }
