/* =============================================================
   browse-stg.css — Styles page Browse (STG-UI-003)
   Extrait de home.css (B1b) le 2026-05-23.
   Chargé après tokens-stg.css dans index.php.
   ============================================================= */

/* ══════════════════════════════════════════════════════════════════════
   BROWSE — shell sidebar + main
══════════════════════════════════════════════════════════════════════ */

#page-browse {
  background: var(--stg-paper);
  min-height: 100vh;
}

.bw-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 56px);
}

.bw-sidebar {
  background: var(--stg-surface);
  border-right: 1px solid var(--stg-rule);
  padding: 20px 0;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
}

.bw-main {
  padding: 24px 32px 48px;
  min-width: 0;
}

/* ── Sidebar groups ───────────────────────────────────────────────────── */

.bw-sidegroup { margin-bottom: 4px; }

.bw-sidehead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 7px 16px;
  background: transparent;
  border: 0;
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--stg-ink-3);
  cursor: default;
  text-align: left;
}

.bw-sidehead--disabled {
  opacity: 0.42;
  color: var(--stg-ink-4);
}

.bw-sidehead .chev {
  transition: transform 0.18s ease;
  flex-shrink: 0;
}

.bw-sidehead.is-collapsed .chev { transform: rotate(-90deg); }

.bw-sidelist {
  list-style: none;
  padding: 0;
  margin: 0 0 6px;
}

.bw-sidelist li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px 6px 24px;
  font-size: 13px;
  color: var(--stg-ink-3);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: background 0.1s, color 0.1s;
}

.bw-sidelist li a:hover {
  background: var(--stg-paper-deep);
  color: var(--stg-ink);
}

.bw-sidelist li a.is-active {
  color: var(--stg-ink);
  font-weight: 600;
  border-left-color: var(--stg-accent);
  background: var(--stg-accent-soft);
}

.bw-sidelist li a .count {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--stg-ink-4);
}

.bw-side-divider {
  height: 1px;
  background: var(--stg-rule-soft);
  margin: 8px 12px;
}

.bw-side-coming {
  font-size: 11px;
  color: var(--stg-ink-4);
  padding: 3px 24px 8px;
  font-family: var(--font-mono, monospace);
  font-style: italic;
}

/* ── Filtres ─────────────────────────────────────────────────────────── */

.bw-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.bw-filter-select {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--stg-rule);
  border-radius: 4px;
  background: var(--stg-surface);
  font-size: 12px;
  color: var(--stg-ink);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
}

.bw-filter-select:focus {
  outline: none;
  border-color: var(--stg-accent);
  box-shadow: 0 0 0 2px rgba(184, 134, 11, 0.18);
}

.bw-filter-lbl {
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--stg-ink-4);
  margin-right: 2px;
}

/* ── Barre outils ────────────────────────────────────────────────────── */

.bw-tools-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--stg-rule);
  margin-bottom: 8px;
}

.bw-tabs { display: flex; gap: 2px; }

.bw-tab {
  padding: 5px 14px;
  border: 1px solid var(--stg-rule);
  border-radius: 4px;
  background: transparent;
  font-size: 12px;
  color: var(--stg-ink-3);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.1s;
}

.bw-tab:hover { background: var(--stg-paper-deep); color: var(--stg-ink); }

.bw-tab.is-active {
  background: var(--stg-ink);
  color: var(--stg-paper);
  border-color: var(--stg-ink);
}

.bw-spacer { flex: 1; }

.bw-search {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--stg-rule);
  border-radius: 4px;
  background: var(--stg-surface);
  padding: 5px 10px;
  max-width: 240px;
}

.bw-search input {
  border: 0;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--stg-ink);
  width: 100%;
  font-family: inherit;
}

.bw-search input::placeholder { color: var(--stg-ink-4); }
.bw-search svg { color: var(--stg-ink-4); flex-shrink: 0; }

.bw-count {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--stg-ink-4);
  margin-left: auto;
}

/* ── Liste de patterns ───────────────────────────────────────────────── */

.bw-list { display: flex; flex-direction: column; }

.bw-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 9px 8px;
  border-bottom: 1px solid var(--stg-rule-soft);
  border-radius: 5px;
  transition: background 0.1s;
  cursor: pointer;
}

.bw-row:hover { background: rgba(42, 26, 19, 0.04); }
.bw-row:last-child { border-bottom: 0; }

.bw-row__info { min-width: 0; }

.bw-row__title { position: relative; min-width: 0; }

.bw-row__sub {
  font-size: 12px;
  color: var(--stg-ink-3);
  margin-top: 3px;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.bw-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border: 1px solid var(--stg-rule);
  border-radius: 3px;
  font-size: 11px;
  color: var(--stg-ink-3);
  font-family: var(--font-mono, monospace);
  background: var(--stg-surface);
}

.bw-pill--remake { background: var(--tm-remake); border-color: #c4b0d8; color: #4a2a6a; }
.bw-pill--genre  { background: var(--tm-genre);  border-color: #b0c0d0; color: #1e3a5a; }
.bw-pill--adv    { background: var(--stg-paper-deep);  color: var(--stg-ink-4); }

.bw-row__actions {
  display: flex;
  gap: 6px;
  align-items: center;
  opacity: 1;
  flex-shrink: 0;
}

.bw-iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--stg-rule);
  border-radius: 4px;
  background: var(--stg-surface);
  color: var(--stg-ink-3);
  cursor: pointer;
  transition: border-color 0.1s, color 0.1s;
}

.bw-iconbtn:hover { border-color: var(--stg-accent); color: var(--stg-accent); }
.bw-iconbtn.is-liked { color: var(--stg-accent); border-color: var(--stg-accent); background: var(--stg-accent-soft); }

.bw-btn-open {
  padding: 5px 12px;
  background: var(--stg-accent);
  color: #2a1a13;
  border: 0;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: filter 0.1s;
}

.bw-btn-open:hover { filter: brightness(1.08); }

/* ── Thumb patterns ──────────────────────────────────────────────────── */

.tm-thumb {
  width: 56px;
  height: 56px;
  border-radius: 5px;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--tm-default);
  border: 1px solid var(--stg-rule);
  position: relative;
}

.tm-thumb--remake  { background: var(--tm-remake); }
.tm-thumb--genre   { background: var(--tm-genre); }

/* Step-grid dans le thumb */
.sg-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 5px;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}

.sg-row {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  flex: 1;
}

.sg-cell {
  border-radius: 1px;
  background: rgba(42, 26, 19, 0.12);
}

.sg-cell--on { background: rgba(42, 26, 19, 0.5); }

/* Couleur par type de track dans la grille */
.sg-row--kick  .sg-cell--on { background: var(--sg-kick); }
.sg-row--snare .sg-cell--on { background: var(--sg-snare); }
.sg-row--hihat .sg-cell--on { background: var(--sg-hihat); }
.sg-row--clap  .sg-cell--on { background: var(--sg-clap); }
.sg-row--808   .sg-cell--on { background: var(--sg-808); }
.sg-row--perc  .sg-cell--on { background: var(--sg-perc); }
.sg-row--rim   .sg-cell--on { background: var(--sg-rim); }

/* ── Pagination browse ───────────────────────────────────────────────── */

.bw-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 0;
  border-top: 1px solid var(--stg-rule-soft);
  margin-top: 8px;
}

.bw-page-info {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--stg-ink-4);
}

.bw-page-btns { display: flex; gap: 6px; }

.bw-page-btn {
  padding: 5px 14px;
  border: 1px solid var(--stg-rule);
  border-radius: 4px;
  background: var(--stg-surface);
  font-size: 12px;
  color: var(--stg-ink);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s;
}

.bw-page-btn:hover { background: var(--stg-paper-deep); }
.bw-page-btn:disabled { opacity: 0.35; cursor: default; }

/* ── Titre inline editable ───────────────────────────────────────────── */

.bw-row__title-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--stg-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bw-row__title-edit {
  display: flex;
  align-items: center;
  gap: 4px;
}

.bw-row__title-edit.hidden { display: none; }

.pattern-card-title-input {
  flex: 1;
  border: 1px solid var(--stg-accent);
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 13px;
  font-family: inherit;
  background: var(--stg-surface);
  color: var(--stg-ink);
  outline: none;
}

.inline-cancel, .inline-save {
  padding: 2px 6px;
  border: 1px solid var(--stg-rule);
  border-radius: 3px;
  background: var(--stg-surface);
  color: var(--stg-ink-3);
  cursor: pointer;
  font-size: 12px;
}

.inline-save { border-color: var(--stg-accent); color: var(--stg-accent); }

/* ── Menu contextuel ligne ───────────────────────────────────────────── */

.bw-row__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--stg-surface);
  border: 1px solid var(--stg-rule);
  border-radius: 5px;
  box-shadow: 0 4px 14px rgba(42, 26, 19, 0.12);
  min-width: 160px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bw-row__menu.hidden { display: none; }

.bw-row__menu button {
  padding: 9px 14px;
  border: 0;
  background: transparent;
  text-align: left;
  font-size: 13px;
  font-family: inherit;
  color: var(--stg-ink);
  cursor: pointer;
}

.bw-row__menu button:hover { background: var(--stg-paper-deep); }

.bw-row__menu .menu-action-delete { color: var(--stg-danger, #b44a3a); }

/* Sub-row meta (pattern-card-meta-row styles adapted) */

.bw-row__sub .pattern-card-creator,
.bw-row__sub .pattern-card-remake-line,
.bw-row__sub .pattern-card-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--stg-ink-3);
  flex-wrap: wrap;
  margin-top: 3px;
}

/* Artist + remixer display in card sub-row */
.pattern-card-orig-artist {
  font-size: 13px;
  font-weight: 500;
  color: var(--stg-ink-2);
}
.pattern-card-remixer {
  font-size: 12px;
  color: var(--stg-ink-3);
  margin-top: 2px;
}

.bw-row__sub .pattern-card-meta-text { font-family: var(--font-mono, monospace); font-size: 11px; }
.bw-row__sub .pattern-card-meta-actions { display: flex; gap: 4px; align-items: center; margin-left: auto; }
.bw-row__sub .tm-meta-pill { display: inline-flex; padding: 1px 5px; border: 1px solid var(--stg-rule); border-radius: 3px; font-size: 11px; font-family: var(--font-mono, monospace); color: var(--stg-ink-3); }
.bw-row__sub .profile-pattern-social-btn.profile-pattern-social-btn--with-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  border: none;
  border-radius: 0;
  background: transparent;
  font-size: 12px;
  color: var(--stg-ink-3, #6b6b5f);
  cursor: pointer;
}
.bw-row__sub .profile-pattern-social-btn.profile-pattern-social-btn--with-count:hover,
.bw-row__sub .profile-pattern-social-btn.profile-pattern-social-btn--with-count.is-engaged {
  background: transparent;
  color: var(--stg-ink, #161a14);
}
.bw-row__sub .profile-pattern-social-btn.profile-pattern-social-btn--with-count.is-liked,
.bw-row__sub .profile-pattern-social-btn.profile-pattern-social-btn--with-count.profile-pattern-social-btn--liked {
  background: transparent;
  color: var(--stg-ink, #161a14);
  border: none;
}

/* Make actions container position:relative so menu positions against it */
.bw-row__actions { position: relative; }

/* ── État vide / chargement ──────────────────────────────────────────── */

.bw-loading, .bw-empty {
  padding: 40px 0;
  text-align: center;
  font-size: 14px;
  color: var(--stg-ink-4);
}

/* ── Responsive ──────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
  #page-browse .stg-shell { grid-template-columns: 1fr; }
  #page-browse .stg-sidebar { display: none; }
  #page-browse { padding: var(--sp-4, 16px) var(--sp-4, 16px) var(--sp-7, 48px); }
}

@media (max-width: 768px) {
  .bw-row__actions { opacity: 1; }
#page-browse .stg-listrow, #page-profile .profile-patterns-host .stg-listrow { grid-template-columns: 48px 1fr auto; }
#page-browse .stg-listrow .col-wave, #page-profile .profile-patterns-host .stg-listrow .col-wave { display: none; }
}

/* ══════════════════════════════════════════════════════════════════════
   BROWSE — design system stg-* (tokens globaux dans tokens-stg.css)
══════════════════════════════════════════════════════════════════════ */

#page-browse {
  background: var(--stg-paper, #ffffff);
  padding: var(--sp-5, 24px) var(--sp-6, 32px) var(--sp-9, 96px);
  max-width: 1440px;
  margin: 0 auto;
}

/* ── Typography helpers ─────────────────────────────────────────────── */
#page-browse .stg-eyebrow {
  font-family: var(--font-ui, "Inter Tight", sans-serif);
  font-size: var(--fs-caption, 0.75rem);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--stg-ink-3);
  font-weight: 500;
}
#page-browse .stg-meta {
  font-family: var(--font-ui, "Inter Tight", sans-serif);
  font-size: var(--fs-caption, 0.75rem);
  color: var(--stg-ink-3);
}

/* ── Shell layout ───────────────────────────────────────────────────── */
#page-browse .stg-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: var(--sp-5, 24px);
  align-items: start;
}

#page-browse .stg-main-wrap { min-width: 0; }

#page-browse .stg-sidebar {
  background: var(--stg-paper-deep, #f3f2ee);
  border-radius: var(--stg-r-xl, 32px);
  padding: var(--sp-5, 24px) var(--sp-4, 16px);
  align-self: start;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

#page-browse .stg-sidegroup { margin-bottom: var(--sp-4, 16px); }
#page-browse .stg-sidegroup:last-child { margin-bottom: 0; }

#page-browse .stg-sidehead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 4px var(--sp-3, 12px);
  background: transparent;
  border: none;
  font-family: var(--font-ui, "Inter Tight", sans-serif);
  font-size: var(--fs-caption, 0.75rem);
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--stg-ink-3);
  cursor: pointer;
  text-align: left;
  user-select: none;
}
#page-browse .stg-sidehead .chev { width: 14px; height: 14px; transition: transform var(--dur-1, .15s) ease; flex-shrink: 0; }
#page-browse .stg-sidehead.is-collapsed .chev { transform: rotate(-90deg); }
#page-browse .stg-sidehead--disabled { opacity: 0.45; pointer-events: none; cursor: default; }

#page-browse .stg-sidelist { list-style: none; margin: var(--sp-1, 4px) 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
#page-browse .stg-sidelist a {
  display: flex;
  align-items: center;
  gap: var(--sp-3, 12px);
  padding: 8px var(--sp-3, 12px);
  border-radius: var(--sp-4, 16px);
  font-family: var(--font-ui, "Inter Tight", sans-serif);
  font-size: var(--fs-small, 0.875rem);
  font-weight: 500;
  color: var(--stg-ink-2);
  text-decoration: none;
  transition: background var(--dur-1, .12s) ease, color var(--dur-1, .12s) ease;
}
#page-browse .stg-sidelist a:hover { background: var(--stg-paper, #ffffff); color: var(--stg-ink); }
#page-browse .stg-sidelist a.is-active {
  background: var(--stg-paper, #ffffff);
  color: var(--stg-ink);
  font-weight: 600;
}
#page-browse .stg-sidelist a.is-active::before { display: none; }
#page-browse .stg-side-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.75;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#page-browse .stg-sidelist a.is-active .stg-side-icon { opacity: 1; }
#page-browse .stg-sidelist a .count {
  margin-left: auto;
  font-family: var(--font-ui, "Inter Tight", sans-serif);
  font-size: var(--fs-caption, 0.75rem);
  color: var(--stg-ink-3);
  font-variant-numeric: tabular-nums;
  font-weight: 400;
}
#page-browse .stg-side-divider { height: 1px; background: var(--stg-border, rgba(22,26,20,0.08)); margin: var(--sp-3, 12px) var(--sp-2, 8px); }
#page-browse .bw-side-coming {
  font-family: var(--font-ui, "Inter Tight", sans-serif);
  font-size: var(--fs-caption, 0.75rem);
  font-style: normal;
  color: var(--stg-ink-4);
  padding: 4px var(--sp-3, 12px) var(--sp-2, 8px);
}

/* ── Main areas ─────────────────────────────────────────────────────── */
#page-browse .stg-main { min-width: 0; }
#page-browse .stg-main--catalog { min-width: 0; }

/* ── Section header ─────────────────────────────────────────────────── */
#page-browse .stg-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-4, 16px);
  flex-wrap: wrap;
  margin: var(--sp-7, 48px) 0 var(--sp-4, 16px);
}
#page-browse .stg-section-head:first-child { margin-top: 0; }
#page-browse .bw-featured.hidden + .stg-main .stg-section-head { margin-top: 0; }
#page-browse .bw-featured:not(.hidden) + .stg-main .stg-section-head {
  margin-top: var(--sp-7, 48px);
}
#page-browse .bw-featured .stg-section-head { margin-bottom: var(--sp-4, 16px); }
#page-browse .stg-section-head__left .stg-eyebrow { color: var(--stg-ink-3); }
#page-browse .stg-section-head h2 {
  font-family: var(--font-display, "Fraunces", Georgia, serif);
  font-size: var(--fs-h1, 2.5rem);
  font-weight: 400;
  letter-spacing: -0.025em;
  color: var(--stg-ink);
  margin: var(--sp-2, 8px) 0 0;
  line-height: 1.0;
  max-width: 22ch;
}
#page-browse .stg-section-head h2 em { font-style: italic; }

#page-browse .stg-see-all {
  font-family: var(--font-ui, "Inter Tight", sans-serif);
  font-size: var(--fs-small, 0.875rem);
  font-weight: 500;
  color: var(--stg-ink);
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-radius: var(--stg-r-pill, 9999px);
  text-decoration: none;
  transition: background var(--dur-1, .12s) ease;
  white-space: nowrap;
}
#page-browse .stg-see-all:hover { background: var(--stg-paper-2, #f3f2ee); }

#page-browse .stg-link-arrow {
  color: var(--stg-ink-2);
  text-decoration: none;
  font-weight: 500;
  font-size: 13.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
  white-space: nowrap;
  flex-shrink: 0;
}
#page-browse .stg-link-arrow:hover { color: var(--stg-ink); border-bottom-color: var(--stg-ink); cursor: pointer; }

/* ── Page title (catalog) ───────────────────────────────────────────── */
#page-browse .stg-page-title {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
#page-browse .stg-page-title h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.018em;
  color: var(--stg-ink);
  margin: 0;
}

/* ── Buttons ────────────────────────────────────────────────────────── */
#page-browse .stg-btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--stg-r-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--stg-ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background .12s, color .12s, border-color .12s;
  text-decoration: none;
  white-space: nowrap;
}
#page-browse .stg-btn--ghost { color: var(--stg-ink-2); }
#page-browse .stg-btn--ghost:hover { background: var(--stg-paper-deep); color: var(--stg-ink); }
#page-browse .stg-btn--secondary { border-color: var(--stg-rule); background: var(--stg-surface); }
#page-browse .stg-btn--secondary:hover { border-color: var(--stg-ink-3); }
#page-browse .stg-btn--primary {
  background: var(--stg-ink, #161a14);
  color: var(--stg-paper, #ffffff);
  font-weight: 500;
  border-color: var(--stg-ink, #161a14);
}
#page-browse .stg-btn--primary:hover { background: var(--stg-accent, #d9f274); color: var(--stg-ink, #161a14); border-color: var(--stg-accent, #d9f274); }
#page-browse .stg-btn--sm { height: 30px; padding: 0 12px; font-size: 13px; }

#page-browse .stg-iconbtn:not(.profile-pattern-social-btn),
#page-profile .profile-patterns-host .stg-iconbtn:not(.profile-pattern-social-btn) {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  color: var(--stg-ink-2);
  cursor: pointer;
  transition: background var(--dur-1, 0.12s) ease, color var(--dur-1, 0.12s) ease;
}
#page-browse .stg-iconbtn:not(.profile-pattern-social-btn):hover,
#page-profile .profile-patterns-host .stg-iconbtn:not(.profile-pattern-social-btn):hover {
  background: var(--stg-hover, rgba(42, 26, 19, 0.07));
  color: var(--stg-ink);
}
/* Play preview button — primary action */
#page-browse .stg-iconbtn.pattern-card-play,
#page-profile .profile-patterns-host .stg-iconbtn.pattern-card-play {
  background: var(--stg-ink);
  color: var(--stg-paper);
}
#page-browse .stg-iconbtn.pattern-card-play:hover,
#page-profile .profile-patterns-host .stg-iconbtn.pattern-card-play:hover {
  background: var(--stg-accent);
  color: var(--stg-ink);
}

/* Like / comment — icône seule, pas de cercle ni bordure */
#page-browse .stg-iconbtn.profile-pattern-social-btn,
#page-profile .profile-patterns-host .stg-iconbtn.profile-pattern-social-btn {
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  padding: 2px 4px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--stg-ink-3, #6b6b5f);
  gap: 4px;
  display: inline-flex;
  align-items: center;
}
#page-browse .stg-iconbtn.profile-pattern-social-btn:hover,
#page-browse .stg-iconbtn.profile-pattern-social-btn.is-engaged,
#page-profile .profile-patterns-host .stg-iconbtn.profile-pattern-social-btn:hover,
#page-profile .profile-patterns-host .stg-iconbtn.profile-pattern-social-btn.is-engaged {
  background: transparent;
  color: var(--stg-ink, #161a14);
}
#page-browse .stg-iconbtn.profile-pattern-social-btn.is-liked,
#page-browse .stg-iconbtn.profile-pattern-social-btn.profile-pattern-social-btn--liked,
#page-profile .profile-patterns-host .stg-iconbtn.profile-pattern-social-btn.is-liked,
#page-profile .profile-patterns-host .stg-iconbtn.profile-pattern-social-btn.profile-pattern-social-btn--liked {
  background: transparent;
  color: var(--stg-ink, #161a14);
}
#page-browse .stg-iconbtn.profile-pattern-social-btn svg,
#page-profile .profile-patterns-host .stg-iconbtn.profile-pattern-social-btn svg {
  flex-shrink: 0;
}
#page-browse .stg-iconbtn.bw-menu-btn,
#page-profile .profile-patterns-host .stg-iconbtn.bw-menu-btn {
  padding: 2px;
}
#page-browse .stg-iconbtn.profile-pattern-social-btn .pattern-card-stat-num,
#page-profile .profile-patterns-host .stg-iconbtn.profile-pattern-social-btn .pattern-card-stat-num {
  color: inherit;
  font-size: var(--fs-caption, 0.75rem);
  font-variant-numeric: tabular-nums;
}

/* ── Pills ──────────────────────────────────────────────────────────── */
#page-browse .stg-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: auto;
  padding: 3px 10px;
  border-radius: var(--stg-r-pill, 9999px);
  background: var(--stg-paper, #ffffff);
  font-family: var(--font-ui, "Inter Tight", sans-serif);
  font-size: var(--fs-caption, 0.75rem);
  color: var(--stg-ink-2, #38382f);
  font-weight: 500;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  border: none;
}
#page-browse .stg-pill--accent {
  background: var(--stg-accent, #d9f274);
  color: var(--stg-ink, #161a14);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.6875rem;
}

/* ── Thumb ──────────────────────────────────────────────────────────── */
#page-browse .stg-thumb {
  position: relative;
  background: var(--stg-paper, #ffffff);
  overflow: hidden;
  border-radius: var(--stg-r-md, 16px);
  flex-shrink: 0;
}
/* Thumb pop tones (maquette STG-UI-003) */
#page-browse .stg-thumb--tone-lime,
#page-browse .stg-thumb--tone-a { background: var(--stg-pop-lime, #d9f274); }
#page-browse .stg-thumb--tone-mint,
#page-browse .stg-thumb--tone-b { background: var(--stg-pop-mint, #b8e6c9); }
#page-browse .stg-thumb--tone-sky,
#page-browse .stg-thumb--tone-c { background: var(--stg-pop-sky, #b9dee6); }
#page-browse .stg-thumb--tone-peach,
#page-browse .stg-thumb--tone-d { background: var(--stg-pop-peach, #f6c7b8); }
#page-browse .stg-thumb--tone-lavender { background: var(--stg-pop-lavender, #cbb9e0); }
#page-browse .stg-thumb--tone-ink { background: var(--stg-ink, #161a14); }
#page-browse .stg-thumb--tone-cream { background: var(--stg-pop-cream, #f4ecd8); }
#page-browse .stg-thumb--tone-ink .sg-cell { background: rgba(244, 236, 216, 0.15); }
#page-browse .stg-thumb--tone-ink .sg-cell--on { background: var(--stg-accent, #d9f274); }

/* play affordance */
#page-browse .stg-thumb .play {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  opacity: 0;
  background: rgba(42, 36, 29, 0);
  transition: opacity .12s, background .12s;
}
#page-browse .stg-row:hover .stg-thumb .play,
#page-browse .stg-listrow:hover .stg-thumb .play, #page-profile .profile-patterns-host .stg-listrow:hover .stg-thumb .play { opacity: 1; background: rgba(42, 36, 29, 0.45); }
#page-browse .stg-thumb .play svg { width: 22px; height: 22px; color: var(--stg-surface); }

/* ── stg-row (popular grid) ─────────────────────────────────────────── */
#page-browse .stg-grid-2, #page-profile .profile-patterns-host .stg-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4, 16px);
}
@media (max-width: 1100px) {
  #page-browse .stg-grid-2,
  #page-profile .profile-patterns-host.stg-grid-2 {
    grid-template-columns: 1fr;
  }
}

#page-browse .stg-row {
  display: grid;
  grid-template-columns: 72px 1fr max-content auto;
  gap: var(--sp-4, 16px);
  padding: var(--sp-3, 12px);
  align-items: center;
  background: var(--stg-paper-deep, #f3f2ee);
  border-radius: var(--stg-r-lg, 24px);
  transition: background var(--dur-1, .12s) ease;
  cursor: pointer;
  text-decoration: none;
  color: var(--stg-ink);
  border: none;
}
#page-browse .stg-row:hover { background: var(--stg-pop-cream, #f4ecd8); }
#page-browse .stg-row .stg-thumb { width: 72px; height: 72px; border-radius: 16px; }
#page-browse .stg-row-title {
  font-family: var(--font-display, "Fraunces", Georgia, serif);
  font-weight: 400;
  font-size: var(--fs-body-lg, 1.125rem);
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--stg-ink);
  margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#page-browse .stg-row-sub {
  font-family: var(--font-ui, "Inter Tight", sans-serif);
  font-size: var(--fs-small, 0.875rem);
  color: var(--stg-ink-3);
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
#page-browse .stg-row-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transition: opacity .12s;
}
#page-browse .stg-row:hover .stg-row-actions { opacity: 1; }

/* ── stg-listrow (catalog) ──────────────────────────────────────────── */
#page-browse .stg-list, #page-profile .profile-patterns-host .stg-list { display: flex; flex-direction: column; gap: var(--sp-2, 8px); }

#page-browse .stg-listrow, #page-profile .profile-patterns-host .stg-listrow {
  display: grid;
  grid-template-columns: 64px minmax(160px, 1.5fr) minmax(140px, 2fr) auto;
  gap: var(--sp-4, 16px);
  align-items: center;
  padding: var(--sp-3, 12px);
  background: var(--stg-paper-2, #f3f2ee);
  border-radius: 20px;
  cursor: pointer;
  transition: background var(--dur-1, .12s) ease, transform var(--dur-2, .2s) ease;
  color: var(--stg-ink);
}
#page-browse .stg-listrow:hover, #page-profile .profile-patterns-host .stg-listrow:hover { background: var(--stg-pop-cream, #f4ecd8); transform: translateY(-1px); }
#page-browse .stg-listrow .stg-thumb, #page-profile .profile-patterns-host .stg-listrow .stg-thumb { width: 64px; height: 64px; border-radius: 12px; }
#page-browse .stg-listrow .col-title, #page-profile .profile-patterns-host .stg-listrow .col-title { min-width: 0; }
#page-browse .stg-listrow .col-title .name, #page-profile .profile-patterns-host .stg-listrow .col-title .name {
  font-family: var(--font-display, "Fraunces", Georgia, serif);
  font-weight: 400;
  font-size: var(--fs-body-lg, 1.125rem);
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--stg-ink);
}
#page-browse .stg-listrow .col-title .creator, #page-profile .profile-patterns-host .stg-listrow .col-title .creator {
  font-family: var(--font-ui, "Inter Tight", sans-serif);
  font-size: var(--fs-small, 0.875rem);
  color: var(--stg-ink-3);
  display: flex; align-items: center; gap: 6px;
  margin-top: 2px;
}
#page-browse .stg-listrow .col-wave, #page-profile .profile-patterns-host .stg-listrow .col-wave {
  display: flex; flex-direction: column; gap: 6px; padding: 0 4px; min-width: 0;
}

/* Waveform placeholder — 32 bars hash-seeded */
#page-browse .bw-wave {
  height: 36px;
  display: grid;
  grid-template-columns: repeat(32, 1fr);
  gap: 1.5px;
  align-items: center;
}
#page-browse .bw-wave i {
  display: block;
  width: 100%;
  background: var(--stg-ink-3, #6b4f3f);
  border-radius: 1px;
  opacity: 0.45;
}
#page-browse .stg-listrow:hover .bw-wave i, #page-profile .profile-patterns-host .stg-listrow:hover .bw-wave i { opacity: 0.7; }
#page-browse .stg-listrow .meta-line, #page-profile .profile-patterns-host .stg-listrow .meta-line {
  display: flex; gap: 12px;
  font-family: var(--font-ui, "Inter Tight", sans-serif);
  font-size: var(--fs-caption, 0.75rem);
  color: var(--stg-ink-3);
}
#page-browse .stg-listrow .meta-line .k, #page-profile .profile-patterns-host .stg-listrow .meta-line .k { color: var(--stg-ink-4); margin-right: 2px; }
#page-browse .stg-listrow .col-actions, #page-profile .profile-patterns-host .stg-listrow .col-actions {
  display: flex; gap: 2px; align-items: center; position: relative;
}

/* Inline title edit inside listrow */
#page-browse .bw-row__title-edit.hidden, #page-profile .profile-patterns-host .bw-row__title-edit.hidden { display: none; }
#page-browse .bw-row__title-edit, #page-profile .profile-patterns-host .bw-row__title-edit { display: flex; align-items: center; gap: 4px; margin-top: 3px; }

/* ── item-row — Variant B (Browse popular) ──────────────────────────── */
#page-browse .item-row, #page-profile .profile-patterns-host .item-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: var(--sp-4, 16px);
  padding: var(--sp-3, 12px);
  align-items: center;
  background: var(--stg-paper-deep, #f3f2ee);
  border-radius: var(--stg-r-lg, 24px);
  text-decoration: none; color: var(--stg-ink, #161a14);
  transition: background var(--dur-1, .12s) ease;
  cursor: pointer;
}
#page-browse .item-row:hover, #page-profile .profile-patterns-host .item-row:hover { background: var(--stg-pop-cream, #f4ecd8); }
#page-browse .item-row {
  grid-template-columns: 72px minmax(0, 1fr) max-content auto;
}
#page-browse .item-row .thumb-sm, #page-profile .profile-patterns-host .item-row .thumb-sm {
  width: 72px; height: 72px; border-radius: 16px; flex-shrink: 0;
  overflow: hidden; position: relative;
}
#page-browse .item-row .thumb-sm.tone-lime, #page-profile .profile-patterns-host .item-row .thumb-sm.tone-lime { background: var(--stg-accent, #d9f274); }
#page-browse .item-row .thumb-sm.tone-mint, #page-profile .profile-patterns-host .item-row .thumb-sm.tone-mint { background: var(--stg-pop-mint, #b8e6c9); }
#page-browse .item-row .thumb-sm.tone-sky, #page-profile .profile-patterns-host .item-row .thumb-sm.tone-sky { background: var(--stg-pop-sky, #b9dee6); }
#page-browse .item-row .thumb-sm.tone-peach, #page-profile .profile-patterns-host .item-row .thumb-sm.tone-peach { background: var(--stg-pop-peach, #f6c7b8); }
#page-browse .item-row .thumb-sm.tone-lavender, #page-profile .profile-patterns-host .item-row .thumb-sm.tone-lavender { background: var(--stg-pop-lavender, #cbb9e0); }
#page-browse .item-row .thumb-sm.tone-ink, #page-profile .profile-patterns-host .item-row .thumb-sm.tone-ink { background: var(--stg-ink, #161a14); }
#page-browse .item-row .thumb-sm .play, #page-profile .profile-patterns-host .item-row .thumb-sm .play {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(22,26,20,0); color: var(--stg-paper, #fff);
  transition: background .15s;
}
#page-browse .item-row:hover .thumb-sm .play, #page-profile .profile-patterns-host .item-row:hover .thumb-sm .play { background: rgba(22,26,20,0.35); }
#page-browse .item-row .thumb-sm .play svg, #page-profile .profile-patterns-host .item-row .thumb-sm .play svg { opacity: 0; transition: opacity .15s; width: 22px; height: 22px; }
#page-browse .item-row:hover .thumb-sm .play svg, #page-profile .profile-patterns-host .item-row:hover .thumb-sm .play svg { opacity: 1; }
#page-browse .item-row .thumb-sm.tone-ink .sg-cell, #page-profile .profile-patterns-host .item-row .thumb-sm.tone-ink .sg-cell { background: rgba(244,236,216,0.15); }
#page-browse .item-row .thumb-sm.tone-ink .sg-cell--on, #page-profile .profile-patterns-host .item-row .thumb-sm.tone-ink .sg-cell--on { background: var(--stg-accent, #d9f274); }

/* Cover image — no step grid on top (QA B7) */
#page-browse .thumb-sm.stg-thumb--has-cover,
#page-browse .thumb-row.stg-thumb--has-cover, #page-profile .profile-patterns-host .thumb-row.stg-thumb--has-cover {
  background-color: var(--stg-ink-2, #38382f);
}
#page-browse .thumb-sm.stg-thumb--has-cover .sg-grid,
#page-browse .thumb-row.stg-thumb--has-cover .sg-grid, #page-profile .profile-patterns-host .thumb-row.stg-thumb--has-cover .sg-grid {
  display: none;
}
#page-browse .item-row .info, #page-profile .profile-patterns-host .item-row .info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
#page-browse .item-row__badge {
  align-self: center;
  justify-self: end;
}
#page-browse .item-row .info .stg-badge, #page-profile .profile-patterns-host .item-row .info .stg-badge { align-self: flex-start; margin-bottom: 2px; }
#page-browse .item-row .info .title, #page-profile .profile-patterns-host .item-row .info .title {
  font-family: var(--font-display, "Fraunces", Georgia, serif);
  font-size: clamp(1.125rem, 1.2vw, 1.45rem);
  font-weight: 400;
  letter-spacing: -0.01em; line-height: 1.15;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#page-browse .item-row .info .orig-artist, #page-profile .profile-patterns-host .item-row .info .orig-artist {
  font-size: var(--fs-body, 1rem);
  font-weight: 500;
  color: var(--stg-ink, #161a14);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#page-browse .browse-card-credit {
  margin-top: 3px;
  font-family: var(--font-ui, "Inter Tight", sans-serif);
  font-size: var(--fs-small, 0.875rem);
  line-height: 1.35;
  color: var(--stg-ink-3, #6b6b5f);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#page-browse .browse-card-credit .tm-profile-deep-link,
#page-browse .browse-card-credit .pattern-card-creator-anon {
  color: var(--stg-ink, #161a14);
  font-weight: 600;
  text-decoration: none;
}
#page-browse .browse-card-credit .tm-profile-deep-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}
#page-browse .browse-card-contributors,
#page-browse .catalog-row .browse-card-contributors {
  margin-top: 3px;
  font-family: var(--font-ui, "Inter Tight", sans-serif);
  font-size: 0.75rem;
  color: var(--stg-ink-3, #6b6b5f);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#page-browse .browse-card-contributors__trigger {
  display: inline;
  max-width: 100%;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#page-browse .browse-card-contributors__trigger:hover .browse-card-contributors__more,
#page-browse .browse-card-contributors__trigger:focus-visible .browse-card-contributors__more {
  text-decoration: underline;
  text-underline-offset: 2px;
}
#page-browse .browse-card-contributors__name {
  color: var(--stg-ink-2, #38382f);
  font-weight: 500;
}
#page-browse .browse-card-contributors__more {
  color: var(--stg-ink-3, #6b6b5f);
  font-weight: 600;
}
#page-browse .browse-card-contributors__name.tm-profile-deep-link {
  color: var(--stg-ink-2, #38382f);
  font-weight: 500;
  text-decoration: none;
}
#page-browse .browse-card-contributors__name.tm-profile-deep-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Contributors list modal (Browse) */
.browse-contrib-modal {
  padding: 0;
  max-height: min(70vh, 420px);
  display: flex;
  flex-direction: column;
}
.browse-contrib-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--stg-border, rgba(0, 0, 0, 0.08));
}
.browse-contrib-modal__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--stg-ink, #161a14);
}
.browse-contrib-modal__close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.375rem;
  line-height: 1;
  color: var(--stg-ink-3, #6b6b5f);
  padding: 2px 8px;
  border-radius: 4px;
}
.browse-contrib-modal__close:hover { color: var(--stg-ink, #161a14); }
.browse-contrib-modal__pattern {
  margin: 0;
  padding: 0.625rem 1.25rem 0;
  font-size: 0.8125rem;
  color: var(--stg-ink-3, #6b6b5f);
}
.browse-contrib-modal__list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0 1.25rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.browse-contrib-modal__item {
  padding: 0.4375rem 0;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--stg-border, rgba(0, 0, 0, 0.06));
}
.browse-contrib-modal__item:last-child { border-bottom: none; }
.browse-contrib-modal__link {
  color: var(--stg-ink, #161a14);
  font-weight: 500;
  text-decoration: none;
}
.browse-contrib-modal__link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}
.browse-contrib-modal__footer {
  display: flex;
  justify-content: flex-end;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--stg-border, rgba(0, 0, 0, 0.08));
}
#page-browse .browse-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 4px;
  font-family: var(--font-ui, "Inter Tight", sans-serif);
  font-size: var(--fs-small, 0.875rem);
  font-weight: 400;
  color: var(--stg-ink-2, #38382f);
}
#page-browse .browse-card-meta__part {
  white-space: nowrap;
}
#page-browse .browse-card-meta__bpm {
  font-weight: 400;
  color: var(--stg-ink-2, #38382f);
  margin-right: 12px;
}
#page-browse .browse-card-meta__pill,
#page-browse .browse-submeta__pill,
#page-profile .profile-patterns-host .browse-submeta__pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--stg-r-pill, 9999px);
  background: var(--stg-paper, #ffffff);
  color: var(--stg-ink-2, #38382f);
  font-weight: 500;
  line-height: 1.45;
}
#page-browse .browse-card-meta__genre,
#page-browse .browse-submeta__genre,
#page-profile .profile-patterns-host .browse-submeta__genre {
  background: var(--stg-pop-mint, #b8e6c9);
  color: var(--stg-ink, #161a14);
}
#page-browse .browse-card-meta__tag,
#page-browse .browse-submeta__tag,
#page-profile .profile-patterns-host .browse-submeta__tag {
  background: var(--stg-paper, #ffffff);
  color: var(--stg-ink-3, #6b6b5f);
}
#page-browse .browse-submeta,
#page-profile .profile-patterns-host .browse-submeta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 3px;
  font-family: var(--font-ui, "Inter Tight", sans-serif);
  font-size: var(--fs-caption, 0.75rem);
  line-height: 1.35;
  color: var(--stg-ink-3, #6b6b5f);
}
#page-browse .browse-submeta .tm-profile-deep-link,
#page-profile .profile-patterns-host .browse-submeta .tm-profile-deep-link {
  color: var(--stg-ink-2, #38382f);
  font-weight: 500;
  text-decoration: none;
}
#page-browse .browse-submeta .tm-profile-deep-link:hover,
#page-profile .profile-patterns-host .browse-submeta .tm-profile-deep-link:hover {
  color: var(--stg-ink, #161a14);
  text-decoration: underline;
  text-underline-offset: 2px;
}
#page-browse .browse-submeta__part,
#page-profile .profile-patterns-host .browse-submeta__part {
  color: var(--stg-ink-3, #6b6b5f);
}
#page-browse .browse-submeta__bpm,
#page-profile .profile-patterns-host .browse-submeta__bpm {
  font-weight: 400;
  color: var(--stg-ink-2, #38382f);
}
#page-browse .catalog-row .row-info .stg-badge,
#page-profile .profile-patterns-host .catalog-row .row-info .stg-badge {
  display: inline-flex;
  margin-bottom: 4px;
}
#page-browse .item-row .item-actions, #page-profile .profile-patterns-host .item-row .item-actions,
#page-browse .catalog-row .cat-actions, #page-profile .profile-patterns-host .catalog-row .cat-actions {
  display: flex; gap: 6px; align-items: center; position: relative;
  opacity: 1;
  flex-shrink: 0;
  z-index: 1;
}
#page-browse .item-row, #page-browse .catalog-row {
  overflow: visible;
}
@media (max-width: 720px) {
#page-browse .item-row, #page-profile .profile-patterns-host .item-row { grid-template-columns: 64px 1fr auto; }
#page-browse .item-row__badge { display: none; }
}

@media (max-width: 390px) {
  #page-browse { padding: var(--sp-4, 16px) var(--sp-3, 12px) var(--sp-7, 48px); }
#page-browse .item-row, #page-profile .profile-patterns-host .item-row { padding: var(--sp-2, 8px); gap: var(--sp-3, 12px); }
#page-browse .catalog-row, #page-profile .profile-patterns-host .catalog-row {
    grid-template-columns: 48px 1fr auto;
    padding: var(--sp-2, 8px);
    gap: var(--sp-3, 12px);
  }
  #page-browse .stg-filters { padding: var(--sp-3, 12px); }
}

/* ── catalog-row — Variant C (Browse catalog) ────────────────────────── */
#page-browse .catalog-row, #page-profile .profile-patterns-host .catalog-row {
  display: grid;
  grid-template-columns: 64px 200px 1fr auto;
  gap: var(--sp-4, 16px);
  align-items: center;
  padding: var(--sp-3, 12px);
  background: var(--stg-paper-2, #fafaf7);
  border-radius: 20px;
  cursor: pointer;
  transition: background var(--dur-1, .12s) ease, transform var(--dur-2, .2s) ease;
  color: var(--stg-ink, #161a14);
}
#page-browse .catalog-row:hover, #page-profile .profile-patterns-host .catalog-row:hover { background: var(--stg-pop-cream, #f4ecd8); transform: translateY(-1px); }
#page-browse .catalog-row .thumb-row, #page-profile .profile-patterns-host .catalog-row .thumb-row {
  width: 64px; height: 64px; border-radius: 12px; flex-shrink: 0;
  overflow: hidden; position: relative;
}
#page-browse .catalog-row .thumb-row.tone-lime, #page-profile .profile-patterns-host .catalog-row .thumb-row.tone-lime { background: var(--stg-accent, #d9f274); }
#page-browse .catalog-row .thumb-row.tone-mint, #page-profile .profile-patterns-host .catalog-row .thumb-row.tone-mint { background: var(--stg-pop-mint, #b8e6c9); }
#page-browse .catalog-row .thumb-row.tone-sky, #page-profile .profile-patterns-host .catalog-row .thumb-row.tone-sky { background: var(--stg-pop-sky, #b9dee6); }
#page-browse .catalog-row .thumb-row.tone-peach, #page-profile .profile-patterns-host .catalog-row .thumb-row.tone-peach { background: var(--stg-pop-peach, #f6c7b8); }
#page-browse .catalog-row .thumb-row.tone-lavender, #page-profile .profile-patterns-host .catalog-row .thumb-row.tone-lavender { background: var(--stg-pop-lavender, #cbb9e0); }
#page-browse .catalog-row .thumb-row.tone-ink, #page-profile .profile-patterns-host .catalog-row .thumb-row.tone-ink { background: var(--stg-ink, #161a14); }
#page-browse .catalog-row .thumb-row .play, #page-profile .profile-patterns-host .catalog-row .thumb-row .play {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(22,26,20,0); color: var(--stg-paper, #fff);
  transition: background .15s;
}
#page-browse .catalog-row:hover .thumb-row .play, #page-profile .profile-patterns-host .catalog-row:hover .thumb-row .play { background: rgba(22,26,20,0.35); }
#page-browse .catalog-row .thumb-row .play svg, #page-profile .profile-patterns-host .catalog-row .thumb-row .play svg { opacity: 0; transition: opacity .15s; width: 22px; height: 22px; }
#page-browse .catalog-row:hover .thumb-row .play svg, #page-profile .profile-patterns-host .catalog-row:hover .thumb-row .play svg { opacity: 1; }
#page-browse .catalog-row .thumb-row.tone-ink .sg-cell, #page-profile .profile-patterns-host .catalog-row .thumb-row.tone-ink .sg-cell { background: rgba(244,236,216,0.15); }
#page-browse .catalog-row .thumb-row.tone-ink .sg-cell--on, #page-profile .profile-patterns-host .catalog-row .thumb-row.tone-ink .sg-cell--on { background: var(--stg-accent, #d9f274); }
#page-browse .catalog-row .row-info, #page-profile .profile-patterns-host .catalog-row .row-info { min-width: 0; }
#page-browse .catalog-row .row-info .title, #page-profile .profile-patterns-host .catalog-row .row-info .title {
  font-family: var(--font-display, "Fraunces", Georgia, serif);
  font-size: var(--fs-body-lg, 1.125rem); font-weight: 400;
  letter-spacing: -0.01em; line-height: 1.15;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#page-browse .catalog-row .row-info .orig-artist, #page-profile .profile-patterns-host .catalog-row .row-info .orig-artist {
  font-size: var(--fs-small, 0.875rem); font-weight: 500;
  color: var(--stg-ink-2, #38382f); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#page-browse .cat-step-grid-block, #page-profile .profile-patterns-host .cat-step-grid-block { min-width: 0; }
#page-browse .cat-step-grid, #page-profile .profile-patterns-host .cat-step-grid { display: flex; flex-direction: column; gap: 3px; }
#page-browse .cat-step-row, #page-profile .profile-patterns-host .cat-step-row {
  display: grid; grid-template-columns: 18px repeat(16, 1fr);
  gap: 2px; align-items: center;
}
#page-browse .cat-step-label, #page-profile .profile-patterns-host .cat-step-label {
  font-size: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--stg-ink-4, #a6a59b); line-height: 1; text-align: right; padding-right: 3px;
}
#page-browse .cat-step-cell, #page-profile .profile-patterns-host .cat-step-cell { height: 8px; border-radius: 1.5px; background: rgba(22,26,20,0.07); }
#page-browse .cat-step-cell.on, #page-profile .profile-patterns-host .cat-step-cell.on { background: var(--stg-ink, #161a14); }
#page-browse .cat-step-grid-block .cat-meta-row, #page-profile .profile-patterns-host .cat-step-grid-block .cat-meta-row {
  display: flex; align-items: center; gap: 8px; margin-top: 6px;
  font-family: var(--font-ui, "Inter Tight", sans-serif);
  font-size: var(--fs-caption, 0.75rem); color: var(--stg-ink-3, #6b6b5f);
}
#page-browse .cat-step-grid-block .cat-meta-row .stg-badge, #page-profile .profile-patterns-host .cat-step-grid-block .cat-meta-row .stg-badge { margin-left: 4px; }
@media (max-width: 1100px) {
  #page-browse .catalog-row,
  #page-profile .profile-patterns-host .catalog-row {
    grid-template-columns: 48px minmax(0, 1fr) auto;
  }
  #page-browse .catalog-row .cat-step-grid-block {
    display: none;
  }
}

@media (max-width: 640px) {
  #page-profile .profile-patterns-host .catalog-row .cat-step-grid-block {
    display: none;
  }
}

/* ── Filters bar (catalog) ──────────────────────────────────────────── */
/* ── Filters zone (ligne 1) ─────────────────────────────────────────── */
#page-browse .stg-filters {
  display: flex; flex-wrap: wrap; gap: var(--sp-2, 8px);
  background: var(--stg-paper-2, #f3f2ee);
  border-radius: 20px;
  padding: var(--sp-4, 16px);
  margin-bottom: var(--sp-3, 12px);
}
#page-browse .stg-tools-row {
  display: flex; align-items: center; gap: var(--sp-2, 8px);
  padding: 0 0 var(--sp-4, 16px);
  flex-wrap: wrap;
}
#page-browse .stg-select {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 14px;
  border: none;
  background: var(--stg-paper, #ffffff);
  border-radius: var(--stg-r-md, 8px);
  font-family: var(--font-ui, "Inter Tight", sans-serif);
  font-size: var(--fs-small, 0.875rem);
  font-weight: 500;
  color: var(--stg-ink);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background var(--dur-1, .12s) ease;
}
#page-browse .stg-select .lbl { color: var(--stg-ink-3); }
#page-browse .stg-select:hover { background: var(--stg-pop-cream, #f4ecd8); }
#page-browse .stg-select svg { color: var(--stg-ink-3); }
#page-browse .stg-select:focus {
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--stg-accent, #d9f274) 35%, transparent);
}

/* ── Tabs (pill style) ──────────────────────────────────────────────── */
#page-browse .stg-tabs {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px;
  background: var(--stg-paper, #ffffff);
  gap: 2px;
}
#page-browse .stg-tabs button {
  height: 28px; padding: 0 14px;
  border: none; background: transparent;
  font-family: var(--font-ui, "Inter Tight", sans-serif);
  font-size: var(--fs-small, 0.875rem); font-weight: 500;
  color: var(--stg-ink-2);
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--dur-1, .12s) ease, color var(--dur-1, .12s) ease;
}
#page-browse .stg-tabs button:hover { color: var(--stg-ink); background: var(--stg-hover, rgba(42,26,19,0.07)); }
#page-browse .stg-tabs button.is-active {
  background: var(--stg-ink);
  color: var(--stg-paper);
  font-weight: 500;
}

/* ── Search (pill style) ────────────────────────────────────────────── */
#page-browse .stg-search {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 14px;
  background: var(--stg-paper, #ffffff);
  border-radius: 999px;
  width: 220px;
}
#page-browse .stg-search input {
  flex: 1; border: none; outline: none; background: transparent;
  font-family: var(--font-ui, "Inter Tight", sans-serif);
  font-size: var(--fs-small, 0.875rem);
  color: var(--stg-ink);
}
#page-browse .stg-search input::placeholder { color: var(--stg-ink-4); }
#page-browse .stg-search svg { color: var(--stg-ink-3); flex-shrink: 0; }

/* ── bw-row__menu (context menu for listrow) ────────────────────────── */
#page-browse .bw-row__menu, #page-profile .profile-patterns-host .bw-row__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--stg-surface);
  border: 1px solid var(--stg-rule);
  border-radius: 5px;
  box-shadow: 0 4px 14px rgba(42, 26, 19, 0.12);
  min-width: 160px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#page-browse .bw-row__menu.hidden, #page-profile .profile-patterns-host .bw-row__menu.hidden { display: none; }
#page-browse .bw-row__menu button, #page-profile .profile-patterns-host .bw-row__menu button {
  padding: 9px 14px;
  border: 0;
  background: transparent;
  text-align: left;
  font-size: 13px;
  font-family: inherit;
  color: var(--stg-ink);
  cursor: pointer;
}
#page-browse .bw-row__menu button:hover, #page-profile .profile-patterns-host .bw-row__menu button:hover { background: var(--stg-paper-deep); }
#page-browse .bw-row__menu .menu-action-delete, #page-profile .profile-patterns-host .bw-row__menu .menu-action-delete { color: #b03a2e; }

/* ── Pagination (catalog) ───────────────────────────────────────────── */
#page-browse .stg-pagination {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 12px 0;
  margin-top: 4px;
}

/* ── View toggle hidden class ───────────────────────────────────────── */
#page-browse .bw-view--popular.hidden,
#page-browse .bw-view--catalog.hidden { display: none; }

/* ── "View full catalogue" centered CTA ─────────────────────────────── */
#page-browse .bw-view-more-wrap {
  margin-top: 36px;
  display: flex;
  justify-content: center;
}

#page-browse .stg-row-sub {
  font-size: 13px;
  color: var(--stg-ink-3);
  margin-top: 4px;
}
#page-browse #browseToolbar.bw-filters {
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px 12px;
}

#page-browse .stg-page-title--catalog {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
#page-browse .stg-page-title__meta {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--stg-ink-3);
  max-width: 42rem;
  line-height: 1.5;
}

#page-browse .stg-select--fake {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  font-size: 12px;
  height: 32px;
  padding: 0 10px;
  border: 1px dashed var(--stg-rule);
  background: var(--stg-paper-deep);
  color: var(--stg-ink-4);
  border-radius: var(--stg-r-sm, 4px);
}
#page-browse .bw-filters-decorative {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

#page-browse .stg-tools-row--catalog {
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding-top: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--stg-rule-soft);
  margin-bottom: 8px;
}
#page-browse .bw-catalog-time-tabs {
  border: 1px solid var(--stg-rule);
  border-radius: var(--stg-r-sm, 4px);
  padding: 3px;
  background: var(--stg-surface);
  gap: 0;
}
#page-browse .bw-catalog-time-tabs button {
  height: 28px;
  padding: 0 12px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--stg-ink-3);
  border-radius: 3px;
  cursor: pointer;
}
#page-browse .bw-catalog-time-tabs button.is-active {
  background: var(--stg-ink);
  color: var(--stg-paper);
  font-weight: 600;
}

#page-browse .stg-viewtoggle {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px;
  background: var(--stg-paper, #ffffff);
  gap: 2px;
}
#page-browse .stg-viewtoggle button {
  width: 32px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--stg-ink-3);
  border-radius: 999px;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  transition: background var(--dur-1, .12s) ease, color var(--dur-1, .12s) ease;
}
#page-browse .stg-viewtoggle button:hover { background: var(--stg-hover, rgba(42,26,19,0.07)); color: var(--stg-ink); }
#page-browse .stg-viewtoggle button.is-active {
  background: var(--stg-ink);
  color: var(--stg-paper);
}

#page-browse .bw-catalog-pagination {
  margin-top: 20px;
  padding-top: 8px;
  border-top: 1px solid var(--stg-rule-soft);
}
#page-browse .bw-page-indicator {
  font-size: 13px;
  color: var(--stg-ink-3);
  padding: 0 12px;
}
#page-browse .bw-catalog-view-tabs {
  margin-left: 4px;
}

/* ── select éléments stylisés comme stg-select ───────────────────────── */
#page-browse select.stg-select {
  display: inline-flex;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--stg-rule);
  background: var(--stg-surface);
  border-radius: var(--stg-r-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--stg-ink);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 10 10' fill='none' stroke='%239e8e7b' stroke-width='1.6' stroke-linecap='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 3.5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}
#page-browse select.stg-select:hover { border-color: var(--stg-ink-3); }
#page-browse select.stg-select:focus {
  outline: none;
  border-color: var(--stg-accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--stg-accent) 18%, transparent);
}

/* ── barre de sous-filtres (Tous / Remakes / Avancé) ────────────────── */
#page-browse .stg-view-filter-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 0 14px;
}
#page-browse .stg-view-filter-bar .stg-btn.is-active {
  background: var(--stg-paper-deep);
  border-color: var(--stg-rule);
  color: var(--stg-ink);
  font-weight: 600;
}

/* ══════════════════════════════════════════════════════════════════════
   STG-UI-003 — alignement premium (couleurs, badges, filtres)
══════════════════════════════════════════════════════════════════════ */

/* Fond page + zones : blanc / gris neutre (plus de café-au-lait) */
#page-browse .stg-filters {
  background: var(--stg-paper-deep, #f3f2ee);
  border-radius: var(--stg-r-xl, 32px);
}
#page-browse .stg-tabs,
#page-browse .stg-viewtoggle,
#page-browse .stg-search,
#page-browse .bw-catalog-time-tabs {
  background: var(--stg-paper, #ffffff);
}
#page-browse .stg-search,
#page-browse .stg-select:hover { background: var(--stg-pop-cream, #f4ecd8); }

/* Filtres catalogue — chips maquette (.filter) */
#page-browse .stg-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--stg-paper, #ffffff);
  border-radius: var(--stg-r-md, 16px);
  border: none;
  cursor: pointer;
  font-family: var(--font-ui, "Inter Tight", sans-serif);
  font-size: var(--fs-small, 0.875rem);
  font-weight: 500;
  color: var(--stg-ink, #161a14);
  transition: background var(--dur-1, 120ms) var(--ease);
}
#page-browse .stg-filter-chip:hover { background: var(--stg-pop-cream, #f4ecd8); }
#page-browse .stg-filter-chip__label {
  color: var(--stg-ink-3, #6b6b5f);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  font-size: inherit;
}
#page-browse .stg-filter-chip__select {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: inherit;
  font-weight: 500;
  color: var(--stg-ink, #161a14);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  padding: 0 18px 0 0;
  margin: 0;
  min-width: 5ch;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 10 10' fill='none' stroke='%236b6b5f' stroke-width='1.6' stroke-linecap='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 3.5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0 center;
}
#page-browse .stg-filter-chip__select:focus { outline: none; }

/* Neutralise anciens .bw-tab (conflit bordures carrées) */
#page-browse .stg-tabs .bw-tab,
#page-browse .bw-catalog-view-tabs button,
#page-browse .bw-catalog-time-tabs .bw-tab {
  border: none !important;
  border-radius: var(--stg-r-pill, 9999px) !important;
  background: transparent !important;
  font-family: var(--font-ui, "Inter Tight", sans-serif) !important;
  font-size: var(--fs-small, 0.875rem) !important;
  font-weight: 500 !important;
  color: var(--stg-ink-2, #38382f) !important;
  padding: 0 14px !important;
  height: 28px !important;
}
#page-browse .stg-tabs .bw-tab.is-active,
#page-browse .bw-catalog-view-tabs button.is-active,
#page-browse .bw-catalog-time-tabs button.is-active {
  background: var(--stg-ink, #161a14) !important;
  color: var(--stg-paper, #ffffff) !important;
}

/* Badge ORIGINAL — chips STG (écrase app.css doré) */
#page-browse .pattern-card-original-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-ui, "Inter Tight", sans-serif);
  font-size: var(--fs-caption, 0.75rem);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  border: none;
  border-radius: var(--stg-r-pill, 9999px);
  padding: 3px 10px;
  margin: 0 6px 0 0;
  vertical-align: middle;
}
#page-browse .pattern-card-original-badge {
  background: var(--stg-paper, #ffffff);
  color: var(--stg-ink-2, #38382f);
}
#page-browse .pattern-card-remake-line,
#page-browse .pattern-card-remake-line--browse-offset {
  font-family: var(--font-ui, "Inter Tight", sans-serif);
  font-size: var(--fs-caption, 0.75rem);
  color: var(--stg-ink-3, #6b6b5f);
  margin-top: 4px;
}
#page-browse .bw-row__sub .pattern-card-meta-text,
#page-browse .bw-row__sub .tm-meta-pill {
  font-family: var(--font-ui, "Inter Tight", sans-serif) !important;
  font-size: var(--fs-caption, 0.75rem) !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  border: none !important;
  border-radius: var(--stg-r-pill, 9999px) !important;
  padding: 2px 8px !important;
  background: var(--stg-paper, #ffffff) !important;
  color: var(--stg-ink-2, #38382f) !important;
}

/* Lignes catalogue */
#page-browse .stg-listrow, #page-profile .profile-patterns-host .stg-listrow {
  background: var(--stg-paper-deep, #f3f2ee);
  border-radius: var(--stg-r-lg, 24px);
}
#page-browse .stg-listrow:hover, #page-profile .profile-patterns-host .stg-listrow:hover { background: var(--stg-pop-cream, #f4ecd8); }
#page-browse .stg-listrow .col-title .creator .stg-pill, #page-profile .profile-patterns-host .stg-listrow .col-title .creator .stg-pill {
  background: var(--stg-paper, #ffffff);
  font-size: var(--fs-caption, 0.75rem);
}

/* Titre catalogue */
#page-browse .stg-page-title h1 {
  font-family: var(--font-display, "Fraunces", Georgia, serif);
  font-size: var(--fs-h1, clamp(2rem, 4vw, 3.5rem));
  font-weight: 400;
  letter-spacing: -0.025em;
}

/* Waveform + play overlay — encre neutre */
#page-browse .bw-wave i { background: var(--stg-ink-3, #6b6b5f); }
#page-browse .stg-row:hover .stg-thumb .play,
#page-browse .stg-listrow:hover .stg-thumb .play, #page-profile .profile-patterns-host .stg-listrow:hover .stg-thumb .play {
  background: rgba(22, 26, 20, 0.45);
}
#page-browse .stg-thumb .play svg { color: var(--stg-paper, #ffffff); }

/* Pill « steps » colonne dédiée (grille item-row) */
#page-browse .stg-pill--steps {
  align-self: center;
  flex-shrink: 0;
}

#page-browse .stg-see-all:hover { background: var(--stg-paper-deep, #f3f2ee); }

/* Écrase app.css (boutons like/comment encadrés sur cartes) */
#page-browse .pattern-card .profile-pattern-social-btn--with-count,
#page-browse .pattern-card-like-ic.is-liked,
#page-browse .pattern-card .pattern-card-like-ic.is-liked {
  width: auto;
  min-width: 0;
  height: auto;
  min-height: 0;
  padding: 2px 4px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--stg-ink-3, #6b6b5f);
}
#page-browse .pattern-card .profile-pattern-social-btn--with-count:hover,
#page-browse .pattern-card .profile-pattern-social-btn--with-count.is-engaged {
  background: transparent;
  color: var(--stg-ink, #161a14);
}
#page-browse .pattern-card .profile-pattern-social-btn--with-count.is-liked,
#page-browse .pattern-card .profile-pattern-social-btn--with-count.profile-pattern-social-btn--liked,
#page-browse .pattern-card-like-ic.is-liked {
  background: transparent;
  color: var(--stg-ink, #161a14);
  border: none;
}
