/* SFW model library and full-page profile. The main-space modal keeps its own skin. */
html[data-space="sfw"] .models-training-label { display: none; }
html[data-space="sfw"] .studio-main:has(#page-models:not(.is-hidden)),
html[data-space="sfw"] #page-models { min-width: 0; }
html[data-space="sfw"] .sfw-model-library[hidden],
html[data-space="sfw"] .sfw-model-library [hidden],
html[data-space="sfw"] .sfw-model-profile[hidden],
html[data-space="sfw"] .sfw-model-profile [hidden] { display: none !important; }

html[data-space="sfw"] .sfw-model-library,
html[data-space="sfw"] .sfw-model-profile {
  width: 100%;
  max-width: 1400px;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding: 0 12px 32px 0;
}
html[data-space="sfw"] .sfw-model-library__heading { margin-bottom: 24px; }
html[data-space="sfw"] .sfw-model-library__heading h2 {
  margin: 8px 0;
  color: var(--text-primary);
  font-size: clamp(26px, 3vw, 36px);
  font-weight: 600;
  letter-spacing: -.025em;
}
html[data-space="sfw"] .sfw-model-library__heading p {
  max-width: 660px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.65;
}
html[data-space="sfw"] .sfw-model-library .model-create { margin-bottom: 24px; }
html[data-space="sfw"] .sfw-model-library #models-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  align-items: start;
  gap: 20px;
}
html[data-space="sfw"] .sfw-model-library #models-list > .org-empty { grid-column: 1 / -1; }
html[data-space="sfw"] .sfw-model-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: var(--bg-card, var(--bg-secondary));
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .2s ease;
}
html[data-space="sfw"] .sfw-model-card:hover { border-color: var(--accent); }
html[data-space="sfw"] .sfw-model-card__photo {
  display: flex;
  width: 100%;
  aspect-ratio: 4 / 3;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(140deg, rgba(var(--accent-rgb), .18), rgba(255,255,255,.025));
  color: var(--accent);
  font-family: var(--font-serif);
  font-size: 70px;
}
html[data-space="sfw"] .sfw-model-card__photo img { width: 100%; height: 100%; object-fit: cover; }
html[data-space="sfw"] .sfw-model-card__body { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
html[data-space="sfw"] .sfw-model-card__status {
  align-self: flex-start;
  border: 1px solid var(--border-medium);
  border-radius: 99px;
  padding: 4px 9px;
  color: var(--accent);
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
html[data-space="sfw"] .sfw-model-card.is-inactive .sfw-model-card__status { color: var(--text-muted); }
html[data-space="sfw"] .sfw-model-card__name { font-size: 20px; font-weight: 600; overflow-wrap: anywhere; }
html[data-space="sfw"] .sfw-model-card__action { display: flex; gap: 12px; justify-content: space-between; color: var(--text-muted); font-size: 12px; line-height: 1.5; }
html[data-space="sfw"] .sfw-model-profile__back {
  border: 0;
  background: none;
  padding: 10px 0;
  margin-bottom: 18px;
  color: var(--text-soft);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
html[data-space="sfw"] .sfw-model-profile__back:hover { color: var(--accent); }
html[data-space="sfw"] .sfw-model-profile__panel { width: 100%; min-width: 0; }
html[data-space="sfw"] .sfw-model-profile .modelinfo__head {
  align-items: center;
  gap: 24px;
  margin: 0 0 26px;
  padding: 24px;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: var(--bg-card, var(--bg-secondary));
}
html[data-space="sfw"] .sfw-model-profile .modelinfo__avatar { width: 104px; height: 104px; border-radius: 20px; }
html[data-space="sfw"] .sfw-model-profile .modelinfo__name { font-size: clamp(24px, 3vw, 34px); }
html[data-space="sfw"] .sfw-model-profile .modelinfo__avatar-btn { min-height: 32px; display: inline-flex; align-items: center; }
html[data-space="sfw"] .sfw-model-profile__tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 24px;
  padding: 0 0 10px;
}
html[data-space="sfw"] .sfw-model-profile__tabs button {
  flex: none;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 11px 18px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
html[data-space="sfw"] .sfw-model-profile__tabs button:hover { color: var(--text-primary); }
html[data-space="sfw"] .sfw-model-profile__tabs [aria-selected="true"] {
  color: var(--accent);
  background: rgba(var(--accent-rgb), .10);
  border-color: rgba(var(--accent-rgb), .25);
}
html[data-space="sfw"] .sfw-model-profile .trainer-section { margin: 0; padding: 0; border: 0; }
html[data-space="sfw"] .sfw-model-profile .trainer-section__label { font-size: 15px; color: var(--text-primary); }
html[data-space="sfw"] .sfw-model-profile .trainer-hint { margin: 10px 0 22px; max-width: 760px; font-size: 13px; line-height: 1.6; }
html[data-space="sfw"] .sfw-model-profile .sw-refs { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
html[data-space="sfw"] .sfw-model-profile .sw-ref { min-width: 0; padding: 12px; border-radius: 16px; gap: 14px; }
html[data-space="sfw"] .sfw-model-profile .sw-ref[data-slot="face"] { order: -1; }
/* La barra de variantes elige el juego de fotos de las cuatro casillas: va siempre encima de todas. */
html[data-space="sfw"] .sfw-model-profile .sw-refs__tabs { order: -2; }
html[data-space="sfw"] .sfw-model-profile .sw-ref__thumb { aspect-ratio: 3 / 4; }
html[data-space="sfw"] .sfw-model-profile .sw-ref__img { object-fit: contain; }
html[data-space="sfw"] .sfw-model-profile .sw-ref__body { flex: 1; gap: 8px; }
html[data-space="sfw"] .sfw-model-profile .sw-ref__label { font-size: 15px; }
html[data-space="sfw"] .sfw-model-profile .sw-ref__hint { display: block; flex: 1; font-size: 12px; }
html[data-space="sfw"] .sfw-model-profile .sw-ref__btn { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 8px 12px; font-size: 12px; }
html[data-space="sfw"] .sfw-model-profile .modelinfo-complements { padding: 0; min-width: 0; }
html[data-space="sfw"] .sfw-model-profile .modelinfo__footer { margin-top: 30px; padding-top: 20px; }
html[data-space="sfw"] .sfw-model-profile :is(button, input, [role="button"], [role="tabpanel"]):focus-visible,
html[data-space="sfw"] .sfw-model-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

@media (max-width: 1200px) {
  html[data-space="sfw"] .sfw-model-profile .sw-refs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  html[data-space="sfw"] .sfw-model-library,
  html[data-space="sfw"] .sfw-model-profile {
    flex: none;
    max-height: none;
    overflow: visible;
    scrollbar-gutter: auto;
    padding-right: 0;
  }
}
@media (max-width: 600px) {
  html[data-space="sfw"] .sfw-model-library #models-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  html[data-space="sfw"] .sfw-model-card__body { padding: 14px; gap: 9px; }
  html[data-space="sfw"] .sfw-model-card__name { font-size: 17px; }
  html[data-space="sfw"] .sfw-model-card__action { font-size: 11px; }
  html[data-space="sfw"] .sfw-model-profile .modelinfo__head { padding: 16px; gap: 14px; flex-wrap: wrap; }
  html[data-space="sfw"] .sfw-model-profile .modelinfo__avatar { width: 76px; height: 76px; }
  html[data-space="sfw"] .sfw-model-profile .modelinfo__headinfo { flex-basis: calc(100% - 110px); }
  html[data-space="sfw"] .sfw-model-profile__tabs { gap: 2px; }
  html[data-space="sfw"] .sfw-model-profile__tabs button { padding: 11px 12px; }
  html[data-space="sfw"] .sfw-model-profile .sw-refs { gap: 12px; }
  html[data-space="sfw"] .sfw-model-profile .sw-ref { padding: 9px; }
  html[data-space="sfw"] .sfw-model-profile .sw-ref__actions { flex-direction: column; align-items: stretch; }
  html[data-space="sfw"] .sfw-model-profile .modelinfo__footer { flex-wrap: wrap; }
}
@media (max-width: 380px) {
  html[data-space="sfw"] .sfw-model-library #models-list,
  html[data-space="sfw"] .sfw-model-profile .sw-refs { grid-template-columns: minmax(0, 1fr); }
}
