/* TrackBounty Marketplace V4 preview — admin-only.
 * V4-scoped: every selector under .mktv4-* prefix.
 * Brand-locked: indigo + Inter (CLAUDE.md). V3.1 visual contract DNA preserved.
 * No JS dependencies; pure GET-form server-rendered surface.
 * Hardware-accelerated (transform/opacity only). Sticky/overlay z-indexes only.
 */

:root {
  --mktv4-bg: #05050a;
  --mktv4-bg-soft: #080812;
  --mktv4-card: #10111b;
  --mktv4-card-2: #141622;
  --mktv4-card-3: #181a27;
  --mktv4-line: rgba(255, 255, 255, 0.075);
  --mktv4-line-strong: rgba(255, 255, 255, 0.13);
  --mktv4-text: #f5f3ff;
  --mktv4-muted: #9d9bb1;
  --mktv4-dim: #6d6c80;
  --mktv4-purple: #7c5cff;
  --mktv4-purple-2: #9b6dff;
  --mktv4-blue: #6274ff;
  --mktv4-cyan: #41d7ff;
  --mktv4-green: #2ee59d;
  --mktv4-orange: #ff7a1a;
  --mktv4-gold: #ffbe35;
  --mktv4-pink: #ff4fa7;
  --mktv4-radius-sm: 10px;
  --mktv4-radius: 16px;
  --mktv4-radius-lg: 22px;
  --mktv4-shadow: 0 20px 70px rgba(0, 0, 0, 0.38);
  --mktv4-font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body.mktv4-body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--mktv4-font);
  color: var(--mktv4-text);
  background:
    radial-gradient(circle at 18% -8%, rgba(124, 92, 255, 0.23), transparent 34rem),
    radial-gradient(circle at 78% 0%, rgba(255, 122, 26, 0.09), transparent 28rem),
    linear-gradient(180deg, #070711 0%, #05050a 45%, #030307 100%);
  overflow-x: hidden;
}

body.mktv4-body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 70px 70px;
  -webkit-mask-image: linear-gradient(to bottom, black, transparent 78%);
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

.mktv4-body a { color: inherit; text-decoration: none; }
.mktv4-body button, .mktv4-body input, .mktv4-body select { font: inherit; }
.mktv4-body button { cursor: pointer; }
.mktv4-h1, .mktv4-h2, h3, p { margin: 0; }

.mktv4-page {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 0 22px 88px;
  position: relative;
  z-index: 1;
}

/* ---------- nav ---------- */
.mktv4-nav {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(5, 5, 10, 0.74);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
}

.mktv4-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 780;
  letter-spacing: -0.035em;
  white-space: nowrap;
}

.mktv4-brand-mark {
  width: 27px;
  height: 27px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #6673ff 0%, #8b5cf6 52%, #ff7a1a 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.17), 0 12px 32px rgba(124, 92, 255, 0.26);
}

.mktv4-brand-mark::after {
  content: "";
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.14);
}

.mktv4-nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- buttons ---------- */
.mktv4-btn {
  min-height: 36px;
  border-radius: 11px;
  padding: 0 14px;
  border: 1px solid var(--mktv4-line);
  background: rgba(255, 255, 255, 0.045);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 760;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.mktv4-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--mktv4-line-strong);
}

.mktv4-btn:active { transform: translateY(0) scale(0.98); }

.mktv4-btn--primary {
  border: 0;
  background: linear-gradient(135deg, var(--mktv4-blue), var(--mktv4-purple));
  box-shadow: 0 12px 36px rgba(98, 116, 255, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.mktv4-btn--ghost { color: var(--mktv4-muted); }
.mktv4-btn--wide { width: 100%; }

/* ---------- hero ---------- */
.mktv4-hero {
  margin-top: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(330px, 0.88fr);
  gap: 16px;
  align-items: stretch;
}

.mktv4-hero-main,
.mktv4-hero-side,
.mktv4-mini-card,
.mktv4-editor-card,
.mktv4-filter-dock {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.047), rgba(255, 255, 255, 0.023));
  border: 1px solid var(--mktv4-line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.mktv4-hero-main {
  min-height: 292px;
  border-radius: var(--mktv4-radius-lg);
  padding: 28px;
  position: relative;
  overflow: hidden;
}

.mktv4-hero-main::after {
  content: "";
  position: absolute;
  right: -120px;
  top: -150px;
  width: 330px;
  height: 330px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.36), transparent 67%);
  filter: blur(2px);
  pointer-events: none;
}

.mktv4-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 10px;
  color: #cbc5ff;
  background: rgba(124, 92, 255, 0.12);
  border: 1px solid rgba(124, 92, 255, 0.22);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 820;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 18px;
  position: relative;
  z-index: 1;
}

.mktv4-hero-eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mktv4-green);
  box-shadow: 0 0 0 6px rgba(46, 229, 157, 0.09);
}

.mktv4-h1 {
  max-width: 650px;
  font-size: clamp(38px, 4.2vw, 58px);
  line-height: 0.95;
  letter-spacing: -0.065em;
  font-weight: 850;
  position: relative;
  z-index: 1;
}

.mktv4-hero-copy {
  max-width: 610px;
  margin-top: 14px;
  color: var(--mktv4-muted);
  line-height: 1.55;
  font-size: 14px;
  position: relative;
  z-index: 1;
}

.mktv4-hero-actions {
  margin-top: 22px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.mktv4-quick-proof {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.mktv4-proof-chip,
.mktv4-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--mktv4-line);
  background: rgba(255, 255, 255, 0.04);
  color: #c8c5d6;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 11px;
  white-space: nowrap;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.mktv4-proof-chip strong { color: #fff; font-weight: 820; }

/* ---------- hero side: sound matching CTA-only ---------- */
.mktv4-hero-side {
  border-radius: var(--mktv4-radius-lg);
  padding: 16px;
  overflow: hidden;
}

.mktv4-match-card {
  height: 100%;
  border-radius: 18px;
  background: radial-gradient(circle at 50% -10%, rgba(98, 116, 255, 0.18), transparent 42%), rgba(5, 5, 10, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mktv4-match-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.mktv4-h2 {
  font-size: 16px;
  letter-spacing: -0.035em;
}

.mktv4-match-head p {
  margin-top: 4px;
  color: var(--mktv4-muted);
  font-size: 12px;
  line-height: 1.45;
}

.mktv4-cta-pill {
  flex: 0 0 auto;
  width: 62px;
  height: 58px;
  border-radius: 17px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 880;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--mktv4-blue), var(--mktv4-purple));
  position: relative;
}

.mktv4-cta-pill span {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mktv4-sound-box {
  border: 1px solid var(--mktv4-line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.035);
  padding: 13px;
}

.mktv4-eyebrow-sm {
  color: var(--mktv4-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
  font-weight: 820;
  margin-bottom: 6px;
}

.mktv4-sound-box strong {
  display: block;
  font-size: 14px;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.mktv4-sound-copy {
  color: var(--mktv4-muted);
  font-size: 12px;
  line-height: 1.45;
}

/* ---------- stats row ---------- */
.mktv4-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.mktv4-stat-card {
  border: 1px solid var(--mktv4-line);
  background: rgba(255, 255, 255, 0.028);
  border-radius: 15px;
  padding: 15px 16px;
}

.mktv4-stat-card strong {
  display: block;
  font-size: 25px;
  letter-spacing: -0.055em;
  line-height: 1;
}

.mktv4-stat-card span {
  display: block;
  margin-top: 6px;
  color: var(--mktv4-dim);
  text-transform: uppercase;
  letter-spacing: 0.095em;
  font-size: 10px;
  font-weight: 820;
}

/* ---------- section heads ---------- */
.mktv4-section-head {
  margin-top: 28px;
  margin-bottom: 12px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.mktv4-section-head h2 { font-size: 17px; letter-spacing: -0.035em; }
.mktv4-section-head p { margin-top: 4px; color: var(--mktv4-muted); font-size: 12px; }

.mktv4-section-link {
  color: #9d91ff;
  font-size: 12px;
  font-weight: 780;
  white-space: nowrap;
}

/* ---------- verified strip ---------- */
/* V4.1 Fix 6: 125px -> 145px desktop for less harsh username truncation. */
.mktv4-verified-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 145px;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.mktv4-verified-strip::-webkit-scrollbar { display: none; }

.mktv4-mini-card {
  display: block;
  min-height: 133px;
  border-radius: 15px;
  padding: 12px;
  position: relative;
  overflow: hidden;
  text-align: center;
  /* V4 polish: include box-shadow in transition for hover elevation parity
   * with the full editor card. */
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.mktv4-mini-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% -10%, rgba(124, 92, 255, 0.16), transparent 52%);
  pointer-events: none;
}

/* V4 polish: subtle elevation shadow on hover (1px less translate than the
 * full editor card to reflect smaller scale). */
.mktv4-mini-card:hover {
  transform: translateY(-2px);
  border-color: rgba(124, 92, 255, 0.26);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
}

.mktv4-mini-card:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

/* V4 trust polish: <img alt=""> avatar inside wrapper-frame.
 * Frame holds the gradient fallback as background; img sits on top with
 * object-fit: cover. When img fails to load and alt="", modern browsers
 * (Chrome 120+, Firefox 120+, Safari 17+) suppress the broken-image icon
 * and the wrapper's gradient shows through. No JS, no onerror, no
 * background-image inline-style trickery. */

.mktv4-mini-avatar-frame {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  margin: 0 auto 9px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  background: linear-gradient(135deg, #f3f0ff, #7061ff 58%, #ff7a1a);
  position: relative;
  overflow: hidden;
}

.mktv4-mini-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border: 0;
}

.mktv4-mini-name,
.mktv4-mini-niche,
.mktv4-mini-followers {
  position: relative;
  z-index: 1;
  overflow: hidden;
}

/* V4.1 Fix 6: 2-line name with full-word wrap; reserve 28px so 1- and 2-line
 * cards share baseline. */
.mktv4-mini-name {
  font-size: 12px;
  font-weight: 780;
  letter-spacing: -0.02em;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.15;
  min-height: 28px;
  text-align: center;
}
.mktv4-mini-niche, .mktv4-mini-followers {
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}
.mktv4-mini-niche { color: var(--mktv4-dim); font-size: 10px; margin-top: 3px; }
.mktv4-mini-followers { color: #dfdceb; font-size: 11px; font-weight: 720; margin-top: 8px; }

/* ---------- tier pill ---------- */
.mktv4-tier {
  min-width: 25px;
  height: 21px;
  border-radius: 7px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #211200;
  background: linear-gradient(135deg, #ffdd57, #ff7a1a);
  box-shadow: 0 7px 20px rgba(255, 122, 26, 0.25);
  font-size: 10px;
  font-weight: 930;
  letter-spacing: -0.02em;
  flex: 0 0 auto;
}

/* V4 polish: per-tier prominence.
 * S+ = inset gold ring + existing orange shadow (gold = elite; no outward glow).
 * S, A unchanged (already legible across the grid).
 * B/C/D split into 3 desaturated stops so tier text reads at-a-glance from
 * across a 24-card grid. No new color tokens; uses existing CSS variables. */
.mktv4-tier--splus {
  background: linear-gradient(135deg, #ffdd57, #ff7a1a);
  box-shadow: inset 0 0 0 1.5px rgba(255, 221, 87, 0.42), 0 7px 20px rgba(255, 122, 26, 0.28);
}
.mktv4-tier--s { background: linear-gradient(135deg, #b1bbff, #7c5cff); color: #fff; box-shadow: 0 7px 20px rgba(124, 92, 255, 0.25); }
.mktv4-tier--a { background: linear-gradient(135deg, #d3d6e2, #818499); color: #fff; box-shadow: 0 7px 20px rgba(0, 0, 0, 0.25); }
.mktv4-tier--b { background: rgba(255, 255, 255, 0.085); color: #c8c5d6; box-shadow: none; }
.mktv4-tier--c { background: rgba(255, 255, 255, 0.058); color: var(--mktv4-muted); box-shadow: none; }
/* D-tier: per-tier desat is expressed via background opacity only; text holds
 * `--mktv4-muted` (~6.4:1 on card bg) for WCAG AA compliance. Using
 * `--mktv4-dim` here would land at ~3.7:1, below AA for small text per
 * Codex C0 5.5 review. */
.mktv4-tier--d { background: rgba(255, 255, 255, 0.038); color: var(--mktv4-muted); box-shadow: none; }

.mktv4-mini-card .mktv4-tier {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
}

/* ---------- filter dock ---------- */
.mktv4-filter-dock {
  margin-top: 18px;
  border-radius: var(--mktv4-radius-lg);
  padding: 14px;
  position: sticky;
  top: 82px;
  z-index: 20;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  background: rgba(12, 13, 21, 0.74);
}

.mktv4-filter-form { margin: 0; }

.mktv4-filter-top {
  display: grid;
  grid-template-columns: minmax(180px, 280px) auto;
  gap: 10px;
  align-items: center;
}

.mktv4-filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mktv4-input,
.mktv4-select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--mktv4-line);
  background: rgba(0, 0, 0, 0.24);
  color: #fff;
  outline: none;
  border-radius: 12px;
  padding: 0 12px;
  font-size: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.mktv4-input::placeholder { color: #706f82; }

.mktv4-select {
  width: auto;
  min-width: 124px;
  color: #d8d5e6;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--mktv4-muted) 50%),
    linear-gradient(135deg, var(--mktv4-muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 17px, calc(100% - 10px) 17px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

.mktv4-chip-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.mktv4-niche-chips, .mktv4-genre-chips { margin-top: 10px; }

.mktv4-chip {
  padding: 6px 10px;
  font-size: 11px;
}

.mktv4-chip:hover { background: rgba(255, 255, 255, 0.07); border-color: var(--mktv4-line-strong); }

.mktv4-chip--active { color: #fff; background: rgba(124, 92, 255, 0.15); border-color: rgba(124, 92, 255, 0.28); }
.mktv4-chip--green { color: #aaffd8; background: rgba(46, 229, 157, 0.09); border-color: rgba(46, 229, 157, 0.21); }
.mktv4-chip--purple { color: #d8d2ff; background: rgba(124, 92, 255, 0.12); border-color: rgba(124, 92, 255, 0.24); }
.mktv4-chip--label { color: var(--mktv4-dim); background: transparent; border-color: transparent; padding-left: 0; }
/* V4 polish: soften the "General" niche chip — synthetic fallback when DB
 * primary_niche is null (set at web/routes/internal_preview.py:185). Verified
 * 0 real DB rows with primary_niche='General', so the soft treatment never
 * misclassifies real data. Honest scouting card: still shows the field, but
 * visually de-emphasized to reflect lower confidence. */
.mktv4-chip--soft { color: var(--mktv4-dim); background: rgba(255, 255, 255, 0.022); border-color: rgba(255, 255, 255, 0.05); }
.mktv4-chip-count { color: var(--mktv4-dim); font-weight: 720; }

/* ---------- results ---------- */
.mktv4-results-head {
  margin-top: 22px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.mktv4-results-head h2 { font-size: 17px; letter-spacing: -0.035em; }
.mktv4-results-head span, .mktv4-results-count { color: var(--mktv4-muted); font-size: 12px; }

.mktv4-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  /* V4 polish: gap 14 → 16px desktop. Tablet inherits via cascade; mobile @media
   * 560 already overrides to 12px (untouched). Increases visual rhythm without
   * dropping below 4-up density. */
  gap: 16px;
}

.mktv4-editor-card {
  min-height: 256px;
  border-radius: 18px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.mktv4-editor-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(circle at 0% 0%, rgba(124, 92, 255, 0.16), transparent 42%);
  transition: opacity 0.16s ease;
  pointer-events: none;
}

/* V4 polish: less aggressive lift (3 → 2px) + subtle elevation shadow + indigo
 * focus-visible outline for keyboard nav. prefers-reduced-motion neutralizer
 * lives at the file's @media block alongside reduced-motion for buttons + spinner. */
.mktv4-editor-card:hover {
  transform: translateY(-2px);
  border-color: rgba(124, 92, 255, 0.26);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.058), rgba(255, 255, 255, 0.027));
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.32);
}

.mktv4-editor-card:hover::before { opacity: 1; }

.mktv4-editor-card:focus-within {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.mktv4-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.mktv4-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
  color: inherit;
}

/* V4 trust polish: <img alt=""> over .mktv4-avatar-frame wrapper. */
.mktv4-avatar-frame {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.035);
  background: linear-gradient(135deg, #f3f0ff, #7061ff 58%, #ff7a1a);
  position: relative;
  overflow: hidden;
}

.mktv4-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border: 0;
}

.mktv4-name-wrap { min-width: 0; }

/* V4 polish: identity-block hierarchy.
 * - display name: weight 800 (was unset), tighter tracking
 * - @username: weight 500, slightly muted
 * - Verified: inline CSS-drawn check via ::after on .mktv4-name-wrap--verified
 *   (taste-skill ANTI-EMOJI-safe: no glyph, no SVG dependency, just a primitive
 *   shape via border-right + border-bottom rotated 45deg). The standalone
 *   "Verified" chip in the chip stack is dropped to free a slot and tighten
 *   visual hierarchy. Screen readers still announce verification via the
 *   .mktv4-sr-only span the template emits when is_verified=true. */
.mktv4-name-wrap strong {
  display: block;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.025em;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mktv4-name-wrap span {
  display: block;
  margin-top: 2px;
  color: var(--mktv4-muted);
  font-size: 11px;
  font-weight: 500;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mktv4-name-wrap--verified strong::after {
  content: "";
  display: inline-block;
  width: 5px;
  height: 10px;
  margin-left: 8px;
  border-right: 2px solid var(--mktv4-green);
  border-bottom: 2px solid var(--mktv4-green);
  transform: translateY(-2px) rotate(45deg);
  vertical-align: middle;
}

/* Screen-reader-only utility — used so dropping the visible "Verified" chip
 * does not lose the announcement. Standard a11y boilerplate. */
.mktv4-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;
}

.mktv4-tag-stack {
  position: relative;
  z-index: 1;
  margin-top: 15px;
  min-height: 56px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  /* V4 polish: gap 6 → 5px so chips read as a tag-line, not a checklist. */
  gap: 5px;
}

.mktv4-editor-card .mktv4-chip {
  /* V4 polish: padding 5/8 → 4/8 for tighter chips. */
  padding: 4px 8px;
  font-size: 10.5px;
  background: rgba(255, 255, 255, 0.043);
}

.mktv4-metrics {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--mktv4-line);
}

.mktv4-metric strong {
  display: block;
  font-size: 18px;
  letter-spacing: -0.05em;
  line-height: 1;
}

/* V4 polish: followers metric reads as the strongest stat in the card. */
.mktv4-metric:first-child strong {
  font-size: 19px;
  font-weight: 820;
}

.mktv4-metric span {
  display: block;
  margin-top: 4px;
  /* V4 polish: --mktv4-dim → --mktv4-muted for label legibility. */
  color: var(--mktv4-muted);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 820;
}

/* V4 polish: italicize the engagement label when n/a, soft de-emphasis
 * without hiding the slot. Mirrors the metric-hierarchy goal: real data
 * reads strong, missing data reads soft. */
.mktv4-metric--na span { font-style: italic; }

.mktv4-card-footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* V4 polish: gap 8 → 10px for footer breathing room. */
  gap: 10px;
  margin-top: 13px;
}

/* V4 polish: drop italic on price (looked unintentional), bump weight 560 →
 * 720 for stronger "decision line" read. */
.mktv4-price { color: #a5a2b6; font-size: 11px; line-height: 1.3; }
.mktv4-price strong { display: block; color: #fff; font-size: 12px; font-weight: 720; }

.mktv4-mini-btn {
  min-height: 31px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--mktv4-line);
  background: rgba(255, 255, 255, 0.045);
  color: #fff;
  font-size: 11px;
  font-weight: 760;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.mktv4-mini-btn:hover { transform: translateY(-1px); background: rgba(255, 255, 255, 0.07); border-color: var(--mktv4-line-strong); }

/* ---------- empty / error states ---------- */
.mktv4-empty {
  border: 1px dashed var(--mktv4-line);
  background: rgba(255, 255, 255, 0.018);
  border-radius: 15px;
  padding: 22px;
  color: var(--mktv4-muted);
  font-size: 13px;
}

.mktv4-empty--strip { white-space: nowrap; }
.mktv4-empty--results { grid-column: 1 / -1; text-align: center; }
.mktv4-empty--error { border-color: rgba(255, 79, 167, 0.4); color: #ffc4dc; }

.mktv4-empty h3 { font-size: 16px; margin-bottom: 6px; color: var(--mktv4-text); }

/* ---------- pagination ---------- */
.mktv4-pagination {
  margin-top: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mktv4-page-marker {
  color: var(--mktv4-dim);
  font-size: 12px;
  font-weight: 720;
}

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .mktv4-page { width: min(100%, 960px); }
  .mktv4-hero { grid-template-columns: 1fr; }
  .mktv4-cards-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mktv4-filter-top { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .mktv4-page { padding: 0 16px 82px; }
  .mktv4-nav { height: 64px; }
  .mktv4-nav-actions .mktv4-btn--ghost { display: none; }
  .mktv4-hero { margin-top: 18px; }
  .mktv4-hero-main { min-height: auto; padding: 22px; }
  .mktv4-h1 { font-size: 38px; }
  .mktv4-hero-copy { font-size: 13.5px; }
  .mktv4-stats-row { gap: 9px; }
  .mktv4-stat-card { padding: 13px; }
  .mktv4-stat-card strong { font-size: 21px; }
  .mktv4-section-head { align-items: flex-start; }
  .mktv4-filter-dock { position: relative; top: auto; }
  .mktv4-cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* V4.1 Fix 2 mobile: keep niche chip cap at 8 on tablet/mobile to avoid wrap clutter. */
  .mktv4-niche-chips a:nth-child(n+9) { display: none; }
}

@media (max-width: 560px) {
  .mktv4-page { padding: 0 12px 90px; }
  .mktv4-brand { font-size: 14px; }
  .mktv4-brand-mark { width: 25px; height: 25px; }
  .mktv4-nav-actions .mktv4-btn--primary { padding: 0 10px; min-height: 32px; font-size: 11px; }
  .mktv4-hero-main, .mktv4-hero-side, .mktv4-filter-dock { border-radius: 17px; }
  .mktv4-h1 { font-size: 32px; letter-spacing: -0.055em; }
  .mktv4-hero-actions .mktv4-btn { flex: 1; }
  .mktv4-quick-proof { gap: 6px; }
  .mktv4-proof-chip { font-size: 10.5px; padding: 6px 8px; }
  .mktv4-match-card { padding: 14px; }
  .mktv4-stats-row { grid-template-columns: 1fr 1fr 1fr; }
  .mktv4-stat-card span { font-size: 8.5px; }
  .mktv4-verified-strip { grid-auto-columns: 112px; }
  .mktv4-filter-top { grid-template-columns: 1fr; }
  .mktv4-filter-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .mktv4-filter-actions .mktv4-select { min-width: 0; }
  .mktv4-filter-actions .mktv4-btn { width: 100%; }
  .mktv4-results-head { align-items: flex-start; }
  .mktv4-cards-grid { grid-template-columns: 1fr; gap: 12px; }
  .mktv4-editor-card { min-height: 240px; }
}

/* ---------- accessibility: reduced motion ----------
 * V4 polish: honor prefers-reduced-motion across the surface.
 * Cards + mini-cards + buttons: drop transitions and neutralize hover/active
 * transforms so reduced-motion users do not see instantaneous jumps when the
 * transition is suppressed. Spinner: stop the rotation animation; the
 * surrounding "Scanning…" / "Matching…" text already provides the loading
 * semantic, so a frozen indigo arc remains unambiguous. */
@media (prefers-reduced-motion: reduce) {
  .mktv4-editor-card,
  .mktv4-mini-card,
  .mktv4-mini-btn,
  .mktv4-btn { transition: none; }
  .mktv4-editor-card:hover,
  .mktv4-mini-card:hover,
  .mktv4-mini-btn:hover,
  .mktv4-btn:hover,
  .mktv4-btn:active { transform: none; }
  .mktv4-spinner { animation: none; }
}

/* ---------------------------------------------------------------------------
 * V4.3 Sound matching — admin-only progressive enhancement
 * ---------------------------------------------------------------------------
 * Replaces the V4-base static "Sound matching" hero aside with a working
 * scan + match panel. State machine driven by data-state on
 * #mktv4-match-panel: idle | checking | hit-matching | miss-confirm |
 * cold-scanning | matching | results | error.
 * --------------------------------------------------------------------------- */

.mktv4-match-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.mktv4-match-input {
  width: 100%;
  font-size: 14px;
}

.mktv4-match-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mktv4-match-actions .mktv4-btn { flex: 1; min-width: 0; }

.mktv4-match-noscript {
  margin: 8px 0 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
}

.mktv4-match-noscript a { color: #6366f1; text-decoration: underline; }

.mktv4-match-confirm {
  margin-top: 14px;
  padding: 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(99, 102, 241, 0.05));
  border: 1px solid rgba(99, 102, 241, 0.4);
}

.mktv4-match-confirm[hidden] { display: none; }

.mktv4-match-confirm-title {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.mktv4-match-confirm-copy {
  margin: 0 0 10px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.45;
}

.mktv4-match-loading {
  margin-top: 14px;
  padding: 16px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.mktv4-match-loading[hidden] { display: none; }

.mktv4-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(99, 102, 241, 0.25);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: mktv4-spin 700ms linear infinite;
  flex: 0 0 auto;
}

@keyframes mktv4-spin {
  to { transform: rotate(360deg); }
}

.mktv4-match-loading-msg {
  margin: 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
}

.mktv4-match-error {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.4);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mktv4-match-error[hidden] { display: none; }

.mktv4-match-error-msg {
  margin: 0;
  font-size: 13px;
  color: #fca5a5;
  line-height: 1.45;
}

.mktv4-match-results-region {
  margin-top: 28px;
}

.mktv4-match-results-region[hidden] { display: none; }

.mktv4-match-results-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.mktv4-match-results-head .mktv4-h2 { margin: 0 0 4px; }

.mktv4-match-results-sound {
  margin: 0;
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.7);
}

.mktv4-match-results-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.mktv4-chip--match {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(99, 102, 241, 0.18));
  color: #fff;
  border: 1px solid rgba(99, 102, 241, 0.55);
  font-weight: 700;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

#mktv4-browse-sections[hidden] { display: none; }

@media (max-width: 560px) {
  .mktv4-match-form { gap: 8px; margin-top: 12px; }
  .mktv4-match-actions { flex-direction: column; }
  .mktv4-match-confirm,
  .mktv4-match-loading,
  .mktv4-match-error { padding: 12px; }
  .mktv4-match-confirm-title { font-size: 13px; }
  .mktv4-match-results-head {
    flex-direction: column;
    align-items: stretch;
  }
  .mktv4-match-results-actions { justify-content: space-between; }
}
