/* ──────────────────────────────────────────────────────────────────────────
 * skill-generator/assets/css/builder.css
 * Estilos del builder visual. Hereda fuentes y variables de /css/style.css
 * ────────────────────────────────────────────────────────────────────────── */

/* El atributo [hidden] debe ganar a .sg-btn { display: inline-flex; } */
.sg-wrap [hidden] { display: none !important; }

.sg-wrap {
  --sg-blue: #1A73E8;
  --sg-blue-dark: #0D47A1;
  --sg-bg: #F7F9FC;
  --sg-card: #ffffff;
  --sg-border: #E4E9F0;
  --sg-text: #1A1D29;
  --sg-text-soft: #5A6478;
  --sg-radius: 16px;
  --sg-shadow-sm: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --sg-shadow-md: 0 10px 24px rgba(16, 24, 40, .08), 0 2px 6px rgba(16, 24, 40, .06);
  --sg-shadow-lg: 0 20px 40px rgba(16, 24, 40, .12), 0 6px 12px rgba(16, 24, 40, .08);

  background: var(--sg-bg);
  min-height: 70vh;
  padding-bottom: 4rem;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--sg-text);
}

/* ── Hero (nuevo skeleton Ricardo) ─────────────────────────────────────────── */
.skill-generator-hero {
  background: linear-gradient(135deg, #0D47A1 0%, #1A73E8 55%, #4FC3F7 100%);
  color: #fff;
  padding: 4rem 1.5rem 6rem;
  position: relative;
  overflow: hidden;
}
.skill-generator-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 25%, rgba(255,255,255,.18) 0%, transparent 45%),
    radial-gradient(circle at 85% 75%, rgba(255,255,255,.12) 0%, transparent 40%);
  pointer-events: none;
}
.skill-generator-hero-inner {
  max-width: 960px;
  margin: 0 auto;
  text-align: center;
  position: relative;
}
.sg-wrap .skills-hero-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}
.sg-wrap .skills-hero-icon img {
  width: 120px;
  height: 120px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}
.skill-generator-hero h1 {
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  font-weight: 800;
  line-height: 1.1;
  margin: 0 0 1rem;
}
.skill-generator-hero .hero-accent {
  background: linear-gradient(90deg, #FFF176, #FFD54F);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.skill-generator-hero .hero-sub {
  font-size: clamp(1rem, 1.5vw, 1.15rem);
  opacity: .92;
  max-width: 720px;
  margin: 0 auto 2rem;
  line-height: 1.55;
}

/* ── hero-stats ────────────────────────────────────────────────────────────── */
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.hero-stat {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 14px;
  padding: 1rem 1.75rem;
  min-width: 140px;
  backdrop-filter: blur(8px);
}
.hero-stat-num {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(90deg, #FFF176, #FFD54F);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-stat-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  opacity: .9;
  margin-top: .35rem;
}

/* ── Layout principal: sidebar + contenido ────────────────────────────────── */
.skill-generator-layout {
  max-width: 1340px;
  margin: -3rem auto 0;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.75rem;
  align-items: start;
  position: relative;
  z-index: 2;
}

/* ── Sidebar — progreso ────────────────────────────────────────────────────── */
.sg-sidebar {
  background: #fff;
  border-radius: var(--sg-radius);
  box-shadow: var(--sg-shadow-md);
  padding: 1.5rem 1.25rem;
  position: sticky;
  top: 1.5rem;
}
.sg-sidebar-title {
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--sg-text-soft);
  margin-bottom: 1rem;
}
.sg-steps {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin-bottom: 1rem;
}
.sg-step {
  all: unset;
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .75rem .85rem;
  border-radius: 12px;
  cursor: pointer;
  opacity: .5;
  transition: all .25s ease;
  box-sizing: border-box;
  font-family: inherit;
}
.sg-step:hover { background: #F7F9FC; }
.sg-step-active {
  opacity: 1;
  background: rgba(26,115,232,.08);
  box-shadow: inset 3px 0 0 var(--sg-blue);
}
.sg-step-done { opacity: 1; }
.sg-step-num {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #E4E9F0;
  color: var(--sg-text-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .95rem;
  flex-shrink: 0;
  transition: background .25s, color .25s;
}
.sg-step-active .sg-step-num {
  background: var(--sg-blue);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(26,115,232,.15);
}
.sg-step-done .sg-step-num {
  background: #16A34A;
  color: #fff;
}
.sg-step-content {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  line-height: 1.2;
}
.sg-step-label {
  font-size: .9rem;
  font-weight: 700;
  color: var(--sg-text);
}
.sg-step-hint {
  font-size: .72rem;
  color: var(--sg-text-soft);
}

/* ── Sidebar · botones nav del wizard ─────────────────────────────────────── */
.sg-sidebar-nav {
  display: flex;
  gap: .5rem;
  padding: .75rem 0;
  border-top: 1px solid var(--sg-border);
  margin-bottom: .5rem;
}
.sg-sidebar-nav .sg-btn {
  flex: 1;
  padding: .55rem .75rem;
  font-size: .78rem;
  justify-content: center;
  border-radius: 8px;
}

.sg-btn-sm {
  padding: .55rem .9rem !important;
  font-size: .78rem !important;
}

/* ── Resumen en sidebar ───────────────────────────────────────────────────── */
.sg-sidebar-summary {
  border-top: 1px solid var(--sg-border);
  padding-top: 1rem;
}
.sg-summary-title {
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--sg-text-soft);
  margin-bottom: .65rem;
}
.sg-summary-row {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  padding: .3rem 0;
  font-size: .82rem;
}
.sg-summary-label {
  color: var(--sg-text-soft);
}
.sg-summary-val {
  color: var(--sg-text);
  font-weight: 600;
  text-align: right;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Sidebar: Últimas Skills ─────────────────────────────────────────────── */
.sg-sidebar-latest {
  border-top: 1px solid var(--sg-border);
  padding-top: 1rem;
  margin-top: .5rem;
}
.sg-latest-viewall {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  margin-top: .75rem;
  padding: .6rem .9rem;
  border-radius: 8px;
  background: linear-gradient(135deg, #D97757 0%, #C4603F 100%);
  color: #fff;
  font-size: .82rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 2px 8px rgba(217, 119, 87, .25);
}
.sg-latest-viewall:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(217, 119, 87, .4);
}
.sg-sidebar-latest .sg-summary-title {
  display: flex;
  align-items: center;
  gap: .4rem;
}
.sg-sidebar-latest .sg-summary-title i {
  font-size: .7rem;
}
.sg-latest-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sg-latest-item {
  all: unset;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  box-sizing: border-box;
  padding: .45rem .6rem;
  border-radius: 8px;
  transition: background .15s;
}
.sg-latest-item:hover {
  background: rgba(26,115,232,.08);
}
.sg-latest-name {
  font-size: .8rem;
  font-weight: 600;
  color: var(--sg-text);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.sg-latest-author {
  font-size: .68rem;
  color: var(--sg-text-soft);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.sg-latest-date {
  font-size: .65rem;
  color: var(--sg-text-soft);
  line-height: 1.3;
  white-space: normal;
  max-width: 200px;
}

/* ── Modal detalle de Skill ─────────────────────────────────────────────── */
.sg-skill-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: sg-modal-fade-in .2s ease;
}
@keyframes sg-modal-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.sg-skill-modal {
  background: var(--sg-card, #fff);
  border: 1px solid var(--sg-border, #E2E8F0);
  border-radius: 18px;
  padding: 1.75rem;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 24px 64px rgba(0,0,0,.25);
  position: relative;
  animation: sg-modal-slide .25s ease;
}
@keyframes sg-modal-slide {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.sg-skill-modal-close {
  all: unset;
  cursor: pointer;
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--sg-text-soft);
  transition: all .15s;
}
.sg-skill-modal-close:hover {
  background: rgba(0,0,0,.08);
  color: var(--sg-text);
}
.sg-skill-modal-head {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  margin-bottom: 1rem;
  padding-right: 2rem;
}
.sg-skill-modal-icon {
  font-size: 1.6rem;
  color: var(--sg-blue);
  margin-top: 2px;
  flex-shrink: 0;
}
.sg-skill-modal-head h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--sg-text);
  margin: 0 0 .15rem;
  line-height: 1.3;
}
.sg-skill-modal-author {
  font-size: .8rem;
  color: var(--sg-text-soft);
  margin: 0;
}
.sg-skill-modal-desc {
  font-size: .88rem;
  color: var(--sg-text);
  line-height: 1.55;
  margin-bottom: 1.25rem;
  padding: .85rem;
  background: rgba(26,115,232,.04);
  border: 1px solid rgba(26,115,232,.12);
  border-radius: 10px;
}
.sg-skill-modal-install {
  margin-bottom: 1rem;
}
.sg-skill-modal-install-label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--sg-text-soft);
  margin-bottom: .4rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.sg-skill-modal-install-label i {
  color: #16A34A;
}

/* Dark mode modal */
body.dark-mode .sg-skill-modal {
  background: #1A1F2B;
  border-color: #2A3141;
}
body.dark-mode .sg-skill-modal-desc {
  background: rgba(26,115,232,.08);
  border-color: rgba(26,115,232,.2);
}
body.dark-mode .sg-latest-item:hover {
  background: rgba(26,115,232,.15);
}

/* ── Contenido principal — paneles ────────────────────────────────────────── */
.sg-content { min-width: 0; }
.sg-panels { position: relative; }
.sg-panel {
  display: none;
  background: #fff;
  border-radius: var(--sg-radius);
  box-shadow: var(--sg-shadow-md);
  padding: 2rem 2rem 1.5rem;
  animation: sgFade .35s ease;
}
.sg-panel-active { display: block; }
@keyframes sgFade {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sg-panel-header {
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--sg-border);
}
.sg-panel-num {
  display: inline-block;
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--sg-blue);
  background: rgba(26,115,232,.1);
  padding: .3rem .75rem;
  border-radius: 999px;
  margin-bottom: .6rem;
}
.sg-panel-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 0 .4rem;
  color: var(--sg-text);
}
.sg-panel-sub {
  font-size: 1rem;
  color: var(--sg-text-soft);
  margin: 0;
  max-width: 720px;
  line-height: 1.5;
}

/* ── Grid de tarjetas ─────────────────────────────────────────────────────── */
.sg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}
.sg-card-wrap {
  display: flex;
  flex-direction: column;
  background: var(--sg-card);
  border: 2px solid var(--sg-border);
  border-radius: var(--sg-radius);
  overflow: hidden;
  transition: all .25s ease;
  box-shadow: var(--sg-shadow-sm);
}
.sg-card-wrap:hover {
  border-color: var(--sg-blue);
  transform: translateY(-3px);
  box-shadow: var(--sg-shadow-lg);
}
.sg-card-wrap.sg-card-wrap-selected {
  border-color: var(--sg-blue);
  box-shadow: 0 0 0 4px rgba(26,115,232,.15), var(--sg-shadow-md);
}

.sg-card {
  all: unset;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  text-align: left;
  box-sizing: border-box;
}
.sg-card:focus-visible {
  outline: 3px solid rgba(26,115,232,.35);
  outline-offset: -3px;
}

.sg-card-head {
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  position: relative;
}
.sg-card-emoji {
  font-size: 2.4rem;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.25));
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sg-card-emoji i {
  font-size: 2rem;
  color: #fff;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.3));
}
.sg-card-badge {
  position: absolute;
  top: .6rem;
  right: .6rem;
  background: rgba(255,255,255,.22);
  border: 1px solid rgba(255,255,255,.4);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .2rem .55rem;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
.sg-card-check {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,.25);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.8rem;
  border: 3px solid rgba(255,255,255,.55);
  opacity: 0;
  transform: scale(.6);
  transition: all .2s ease;
}
/* Cards NO seleccionadas: grayscale cuando hay alguna seleccionada */
.sg-grid:has(.sg-card-wrap-selected) .sg-card-wrap:not(.sg-card-wrap-selected) {
  filter: grayscale(100%);
  opacity: .55;
}

.sg-card-wrap-selected .sg-card-check {
  opacity: 1;
  transform: scale(1);
  background: var(--sg-blue);
  color: #fff;
  border-color: #fff;
}

.sg-card-body {
  padding: 1.1rem 1.25rem 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.sg-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  color: var(--sg-text);
}
.sg-card-desc {
  font-size: .88rem;
  color: var(--sg-text-soft);
  margin: 0;
  line-height: 1.5;
}

/* ── Acordeón (Ver más / Ver menos) ───────────────────────────────────────── */
.sg-card-toggle {
  all: unset;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  cursor: pointer;
  padding: .55rem 1rem;
  margin: 0 1.25rem 1rem;
  border: 1px solid var(--sg-border);
  border-radius: 8px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--sg-text-soft);
  background: #F7F9FC;
  transition: all .2s ease;
  box-sizing: border-box;
}
.sg-card-toggle:hover {
  background: #fff;
  color: var(--sg-blue);
  border-color: var(--sg-blue);
}
.sg-card-toggle:focus-visible {
  outline: 2px solid rgba(26,115,232,.4);
  outline-offset: 2px;
}
.sg-card-toggle-icon {
  transition: transform .25s ease;
  font-size: .9rem;
  line-height: 1;
}
.sg-card-toggle[aria-expanded="true"] .sg-card-toggle-icon {
  transform: rotate(180deg);
}

.sg-card-details {
  padding: 0 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .85rem;
  border-top: 1px dashed var(--sg-border);
  padding-top: 1rem;
  margin-top: -.25rem;
}
.sg-card-details[hidden] { display: none; }

.sg-card-meta {}
.sg-card-meta-label {
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--sg-blue);
  margin-bottom: .25rem;
}
.sg-card-meta-val {
  font-size: .83rem;
  color: var(--sg-text-soft);
  line-height: 1.5;
}

.sg-card-example {
  background: #F7F9FC;
  border-left: 3px solid var(--sg-blue);
  border-radius: 8px;
  padding: .75rem .9rem;
}
.sg-card-example-label {
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--sg-blue);
  margin-bottom: .25rem;
}
.sg-card-example-title {
  font-size: .88rem;
  font-weight: 700;
  color: var(--sg-text);
  margin-bottom: .3rem;
  line-height: 1.35;
}
.sg-card-example-desc {
  font-size: .78rem;
  color: var(--sg-text-soft);
  line-height: 1.5;
}

/* ── Panel footer ─────────────────────────────────────────────────────────── */
.sg-panel-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.25rem;
  border-top: 1px solid var(--sg-border);
  margin-top: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.sg-panel-footer-info {
  color: var(--sg-text-soft);
  font-size: .9rem;
  flex: 1;
  text-align: center;
}
.sg-panel-footer-info strong {
  color: var(--sg-blue);
  font-weight: 700;
}

/* ── Botones ──────────────────────────────────────────────────────────────── */
.sg-btn {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .85rem 1.75rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: .95rem;
  font-family: inherit;
  transition: all .2s ease;
  box-sizing: border-box;
}
.sg-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.sg-btn-primary {
  background: var(--sg-blue);
  color: #fff;
  box-shadow: 0 4px 12px rgba(26,115,232,.3);
}
.sg-btn-primary:not(:disabled):hover {
  background: var(--sg-blue-dark);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(26,115,232,.4);
}
.sg-btn-ghost {
  background: transparent;
  color: var(--sg-blue);
  border: 2px solid var(--sg-border);
}
.sg-btn-ghost:hover {
  background: #F7F9FC;
  border-color: var(--sg-blue);
}

/* Variantes semánticas extra */
.sg-btn-success {
  background: #16A34A;
  color: #fff;
  box-shadow: 0 4px 12px rgba(22,163,74,.3);
}
.sg-btn-success:not(:disabled):hover {
  background: #15803D;
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(22,163,74,.4);
}
.sg-btn-warning {
  background: #F59E0B;
  color: #fff;
  box-shadow: 0 4px 12px rgba(245,158,11,.3);
}
.sg-btn-warning:not(:disabled):hover {
  background: #D97706;
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(245,158,11,.4);
}

/* Modificador de ancho completo */
.sg-btn-full {
  width: 100%;
  justify-content: center;
}

/* ── Placeholder "próximamente" ───────────────────────────────────────────── */
.sg-soon {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--sg-text-soft);
}
.sg-soon-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}
.sg-soon h2 {
  color: var(--sg-text);
  font-size: 1.5rem;
  margin: 0 0 .5rem;
}
.sg-soon p {
  font-size: 1rem;
  margin: 0 auto 1.5rem;
  max-width: 480px;
}
.sg-soon code {
  background: #F0F4F8;
  padding: .15rem .4rem;
  border-radius: 4px;
  font-size: .85em;
  color: var(--sg-blue);
}

/* ── Empty state ──────────────────────────────────────────────────────────── */
.sg-empty {
  background: #FEF3C7;
  border: 1px solid #FCD34D;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  color: #92400E;
}
.sg-empty code {
  background: rgba(0,0,0,.08);
  padding: .1rem .35rem;
  border-radius: 4px;
  font-size: .85em;
}

/* ── Toolbar superior del panel (Volver / info / Siguiente) ─────────────── */
.sg-panel-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .9rem 1.1rem;
  margin-bottom: 1.5rem;
  background: #F7F9FC;
  border: 1px solid var(--sg-border);
  border-radius: 12px;
  flex-wrap: wrap;
}
.sg-toolbar-info {
  flex: 1;
  text-align: center;
  font-size: .88rem;
  color: var(--sg-text-soft);
}
.sg-toolbar-info strong {
  color: var(--sg-blue);
  font-weight: 700;
}
.sg-toolbar-btns {
  display: flex;
  gap: .5rem;
  margin-left: auto;
}

/* ── Paso 3: grid principal ───────────────────────────────────────────────── */
.sg-step3-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
}
.sg-step3-main {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}
.sg-step3-aside {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ── Bloques de campos ────────────────────────────────────────────────────── */
.sg-field-block {
  background: #fff;
  border: 1px solid var(--sg-border);
  border-radius: 14px;
  padding: 1.25rem 1.35rem;
}
.sg-field-block-cta {
  background: linear-gradient(135deg, rgba(26,115,232,.06), rgba(26,115,232,.02));
  border-color: rgba(26,115,232,.2);
}
.sg-field-label {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--sg-text);
  margin-bottom: .35rem;
}
.sg-field-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--sg-blue);
  color: #fff;
  font-size: .78rem;
  font-weight: 800;
  flex-shrink: 0;
}
.sg-field-hint {
  font-size: .84rem;
  color: var(--sg-text-soft);
  margin: 0 0 .75rem 2.1rem;
  line-height: 1.5;
}

.sg-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 1rem 1.1rem;
  border: 2px solid var(--sg-border);
  border-radius: 12px;
  background: #fff;
  font-family: inherit;
  font-size: .95rem;
  line-height: 1.55;
  color: var(--sg-text);
  resize: vertical;
  min-height: 120px;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.sg-textarea:focus {
  outline: none;
  border-color: var(--sg-blue);
  box-shadow: 0 0 0 4px rgba(26,115,232,.12);
}
.sg-textarea::placeholder {
  color: #9AA5B8;
  font-style: italic;
}
.sg-field-counter {
  text-align: right;
  font-size: .75rem;
  color: var(--sg-text-soft);
  margin-top: .4rem;
}

/* ── CTA Clarify (botón preguntas IA) ─────────────────────────────────────── */
.sg-clarify-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.sg-clarify-head > div:first-child { flex: 1; min-width: 240px; }
.sg-clarify-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--sg-text);
  margin-bottom: .3rem;
  line-height: 1.35;
}
.sg-clarify-sub {
  font-size: .83rem;
  color: var(--sg-text-soft);
  line-height: 1.5;
}

/* ── Campo Autor ────────────────────────────────────────────────────────── */
.sg-autor-field {
  margin-top: .75rem;
  padding-top: .75rem;
  border-top: 1px dashed var(--sg-border);
}
.sg-autor-label {
  display: block;
  font-size: .88rem;
  font-weight: 600;
  color: var(--sg-text);
  margin-bottom: .35rem;
}
.sg-autor-opt {
  font-weight: 400;
  color: var(--sg-text-soft);
  font-size: .82rem;
}
.sg-wrap .sg-input {
  all: unset;
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: .7rem .9rem;
  border: 2px solid var(--sg-border);
  border-radius: 10px;
  font-family: inherit;
  font-size: .92rem;
  color: var(--sg-text);
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
}
.sg-wrap .sg-input:focus {
  outline: none;
  border-color: var(--sg-blue);
  box-shadow: 0 0 0 3px rgba(26,115,232,.1);
}
.sg-wrap .sg-input::placeholder {
  color: var(--sg-text-soft);
  opacity: .7;
}
.sg-autor-hint {
  margin-top: .3rem;
  font-size: .78rem;
  color: var(--sg-text-soft);
  line-height: 1.4;
}
body.dark-mode .sg-wrap .sg-input {
  background: #1A1F2B;
  border-color: var(--sg-border);
}
body.dark-mode .sg-wrap .sg-input:focus {
  border-color: var(--sg-blue);
}

/* ── Bloque de preguntas ─────────────────────────────────────────────────── */
.sg-questions-block {
  background: linear-gradient(180deg, #fff, #F7F9FC);
  border-color: rgba(26,115,232,.25);
}
.sg-questions-head {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.1rem;
  padding-bottom: .9rem;
  border-bottom: 1px dashed var(--sg-border);
}
.sg-questions-list {
  display: flex;
  flex-direction: column;
  gap: .9rem;
  margin-bottom: 1.1rem;
}
.sg-question {
  background: #fff;
  border: 1px solid var(--sg-border);
  border-radius: 10px;
  padding: .9rem 1rem;
}
.sg-question-label {
  display: block;
  font-size: .88rem;
  font-weight: 600;
  color: var(--sg-text);
  margin-bottom: .5rem;
  line-height: 1.45;
}
.sg-question-num {
  display: inline-block;
  background: rgba(26,115,232,.12);
  color: var(--sg-blue);
  font-weight: 800;
  padding: .1rem .5rem;
  border-radius: 6px;
  margin-right: .4rem;
  font-size: .75rem;
}
.sg-question-input {
  width: 100%;
  box-sizing: border-box;
  padding: .65rem .85rem;
  border: 1px solid var(--sg-border);
  border-radius: 8px;
  background: #F7F9FC;
  font-family: inherit;
  font-size: .9rem;
  color: var(--sg-text);
  resize: vertical;
  min-height: 50px;
  transition: border-color .2s, background .2s;
}
.sg-question-input:focus {
  outline: none;
  border-color: var(--sg-blue);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(26,115,232,.1);
}
.sg-questions-actions {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  padding-top: .75rem;
  border-top: 1px dashed var(--sg-border);
}
.sg-questions-actions .sg-btn {
  width: 100%;
  justify-content: center;
}
.sg-questions-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}
@media (max-width: 640px) {
  .sg-questions-actions-grid { grid-template-columns: 1fr; }
}

/* Botón info (azul) para "Generar más preguntas" */
.sg-btn-info {
  background: linear-gradient(135deg, #1A73E8, #2563EB);
  color: #fff;
  border-color: transparent;
}
.sg-btn-info:not(:disabled):hover {
  background: linear-gradient(135deg, #1558B8, #1D4ED8);
  filter: brightness(1.05);
}
.sg-btn-info:disabled {
  background: #CBD5E1;
  color: #fff;
  cursor: not-allowed;
  opacity: .75;
}

/* Header de cada pregunta con botón "Rehacer" */
.sg-question-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .5rem;
}
.sg-question-header .sg-question-label {
  margin-bottom: 0;
  flex: 1;
}
.sg-question-redo {
  flex-shrink: 0;
  background: #fff;
  border: 1px solid var(--sg-border);
  color: var(--sg-blue, #1A73E8);
  font-size: .78rem;
  font-weight: 600;
  padding: .35rem .7rem;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  transition: background .2s, color .2s, border-color .2s;
}
.sg-question-redo:hover:not(:disabled) {
  background: rgba(26,115,232,.08);
  border-color: var(--sg-blue, #1A73E8);
}
.sg-question-redo:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* Preguntas bloqueadas cuando se piden "más preguntas" */
.sg-question-locked {
  background: #F1F5F9 !important;
  opacity: .65;
}
.sg-question-locked .sg-question-input {
  background: #E2E8F0 !important;
  color: #64748B;
  cursor: not-allowed;
}
.sg-question-locked .sg-question-redo {
  opacity: .4;
}

/* Callout informativo (azul) explicando las acciones */
.sg-callout-info {
  background: linear-gradient(135deg, #E0F2FE, #EFF6FF);
  border-color: #3B82F6;
  color: #0C4A6E;
  box-shadow: 0 4px 14px rgba(59,130,246,.15);
  animation: none;
}
.sg-callout-info .sg-callout-icon {
  color: #2563EB;
}
.sg-actions-help { margin-top: .75rem; }
.sg-actions-help-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
  margin-top: .5rem;
}
@media (max-width: 820px) {
  .sg-actions-help-grid { grid-template-columns: 1fr; }
}
.sg-actions-help-item {
  background: rgba(255,255,255,.7);
  border: 1px solid rgba(59,130,246,.25);
  border-radius: 8px;
  padding: .6rem .75rem;
}
.sg-actions-help-title {
  font-weight: 700;
  font-size: .85rem;
  color: #1E3A8A;
  margin-bottom: .25rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.sg-actions-help-text {
  font-size: .82rem;
  line-height: 1.4;
  color: #0F172A;
}
.sg-actions-help-text em {
  font-style: normal;
  font-weight: 600;
  background: rgba(59,130,246,.12);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ── Callouts / avisos destacados ─────────────────────────────────────────── */
.sg-callout {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  margin: 1rem 0 .25rem;
  padding: 1rem 1.1rem;
  border-radius: 12px;
  border: 2px solid transparent;
  background: #fff;
  font-size: .92rem;
  line-height: 1.45;
}
.sg-callout-icon {
  font-size: 1.35rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
}
.sg-callout-body {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.sg-callout-body strong {
  font-size: .98rem;
  font-weight: 700;
}
.sg-callout-body em {
  font-style: normal;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(0,0,0,.08);
}
.sg-wrap .sg-callout-steps {
  list-style: none !important;
  counter-reset: sg-callout-step;
  margin: .15rem 0 !important;
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.sg-wrap .sg-callout-steps li {
  position: relative;
  padding: .1rem 0 .1rem 2rem;
  font-weight: 600;
  counter-increment: sg-callout-step;
  list-style: none !important;
  margin: 0 !important;
}
.sg-wrap .sg-callout-steps li::before {
  content: counter(sg-callout-step);
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: #F59E0B;
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(245,158,11,.35);
}

/* Cuando el bloque de preguntas YA está visible, el callout "generar preguntas"
   se oculta automáticamente (seguro CSS, no depende del JS). */
.sg-step3-main:has(#sg-questions-block:not([hidden])) #sg-clarify-callout {
  display: none !important;
}
/* Y cuando el brief refinado ya está visible, el callout "refinar" también
   desaparece (seguro CSS por si el JS se adelanta o se atrasa). */
.sg-step3-main:has(#sg-refined-block:not([hidden])) #sg-refine-callout {
  display: none !important;
}

/* Variante amarilla/ámbar: acción requerida */
.sg-callout-warn {
  background: linear-gradient(135deg, #FFF8E1, #FFFBEB);
  border-color: #F59E0B;
  color: #78350F;
  box-shadow: 0 4px 14px rgba(245,158,11,.18);
  animation: sg-callout-pulse 2.2s ease-in-out infinite;
}
@keyframes sg-callout-pulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(245,158,11,.18); }
  50%      { box-shadow: 0 6px 22px rgba(245,158,11,.35); }
}

/* ── Bloque refinado ──────────────────────────────────────────────────────── */
.sg-refined-block {
  background: linear-gradient(135deg, rgba(22,163,74,.06), rgba(22,163,74,.02));
  border-color: rgba(22,163,74,.25);
}
.sg-refined-head {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: .9rem;
}
.sg-refined-head .sg-field-num {
  background: #16A34A;
}

/* ── Sidebar del paso 3 (motor + tip) ─────────────────────────────────────── */
.sg-aside-block {
  background: #fff;
  border: 1px solid var(--sg-border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
}
.sg-aside-label {
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--sg-text-soft);
  margin-bottom: .7rem;
}
.sg-aside-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .35rem 0;
  font-size: .83rem;
  border-top: 1px solid var(--sg-border);
}
.sg-aside-item:first-of-type { border-top: none; padding-top: 0; }
.sg-aside-key { color: var(--sg-text-soft); }
.sg-aside-val {
  font-weight: 700;
  color: var(--sg-text);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sg-aside-tip {
  background: linear-gradient(135deg, #FFF8E1, #FFFDE7);
  border-color: #FFE082;
}
.sg-aside-tip p {
  margin: 0;
  font-size: .8rem;
  color: #78561B;
  line-height: 1.5;
}

/* ── Engine picker (Claude / OpenAI) ──────────────────────────────────────── */
.sg-engine-picker {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.sg-engine-opt {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .6rem;
  padding: .7rem .85rem;
  border: 2px solid var(--sg-border);
  border-radius: 10px;
  background: #F7F9FC;
  cursor: pointer;
  transition: all .2s ease;
}
.sg-engine-opt:hover { border-color: var(--sg-blue); }
.sg-engine-opt input[type="radio"] {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid var(--sg-border);
  border-radius: 50%;
  margin: 0;
  cursor: pointer;
  grid-column: 1;
  position: relative;
  flex-shrink: 0;
}
.sg-engine-opt input[type="radio"]:checked {
  border-color: var(--sg-blue);
  background: var(--sg-blue);
  box-shadow: inset 0 0 0 3px #fff;
}
.sg-engine-opt-selected {
  background: #fff;
  border-color: var(--sg-blue);
  box-shadow: 0 0 0 3px rgba(26,115,232,.1);
}
.sg-engine-emoji {
  font-size: 1.1rem;
  display: none; /* lo oculto, ya tengo radio */
}
.sg-engine-name {
  font-weight: 700;
  font-size: .88rem;
  color: var(--sg-text);
  grid-column: 2;
}
.sg-engine-model {
  font-size: .72rem;
  color: var(--sg-text-soft);
  grid-column: 3;
  font-weight: 600;
}

/* ── Spinner / estado cargando ────────────────────────────────────────────── */
.sg-btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.sg-btn-loading::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 16px; height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: sgSpin .8s linear infinite;
}
.sg-btn-ghost.sg-btn-loading::after {
  border-color: rgba(26,115,232,.2);
  border-top-color: var(--sg-blue);
}
@keyframes sgSpin { to { transform: rotate(360deg); } }

/* Mensaje de error inline */
.sg-error-msg {
  background: #FEE2E2;
  border: 1px solid #FCA5A5;
  border-radius: 10px;
  padding: .85rem 1rem;
  color: #991B1B;
  font-size: .85rem;
  margin-top: 1rem;
}

/* ── Paneles de debug (solo visibles durante generación) ─────────────────── */
.sg-wrap .sg-debug-live {
  margin-top: .5rem;
  padding: .5rem .75rem;
  background: rgba(0,0,0,.85);
  color: #A5F3FC;
  border-radius: 6px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .72rem;
  line-height: 1.4;
  max-width: 460px;
  word-break: break-word;
}
.sg-wrap .sg-debug-live strong {
  color: #FCD34D;
  margin-right: .35rem;
}
.sg-wrap .sg-debug-box {
  margin: 1rem auto 0;
  max-width: 600px;
  padding: 1rem;
  background: #0F1419;
  color: #A5F3FC;
  border: 1px solid #2A3141;
  border-radius: 8px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .76rem;
  line-height: 1.55;
  text-align: left;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 360px;
  overflow-y: auto;
}
.sg-wrap .sg-step4-error-actions {
  display: flex;
  justify-content: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

/* ── Paso 4 · Descarga del SKILL ─────────────────────────────────────────── */

/* Estado cargando */
.sg-step4-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 4rem 1.5rem;
  background: var(--sg-card);
  border: 1px dashed var(--sg-border);
  border-radius: 14px;
  text-align: center;
}
.sg-loader-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(26,115,232,.2);
  border-top-color: var(--sg-blue);
  border-radius: 50%;
  animation: sgSpin .9s linear infinite;
}
.sg-step4-loading h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--sg-text);
  margin: 0;
}
.sg-step4-loading p {
  font-size: .88rem;
  color: var(--sg-text-soft);
  margin: 0;
  max-width: 460px;
  line-height: 1.55;
}
.sg-wrap .sg-loader-progress {
  margin-top: 1.25rem;
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: .9rem;
}
.sg-wrap .sg-loader-phases {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.sg-wrap .sg-loader-phase {
  display: flex !important;
  align-items: center;
  gap: .7rem;
  padding: .6rem .85rem;
  background: rgba(26,115,232,.04);
  border: 1px solid rgba(26,115,232,.1);
  border-radius: 10px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: .85rem;
  font-weight: 500;
  color: var(--sg-text-soft);
  transition: all .25s ease;
  text-align: left;
}
.sg-wrap .sg-loader-phase-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(26,115,232,.25);
  background: transparent;
  flex-shrink: 0;
  position: relative;
  transition: all .25s ease;
}
.sg-wrap .sg-loader-phase-txt {
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}
/* Fase activa: círculo con pulso azul */
.sg-wrap .sg-loader-phase.is-active {
  background: rgba(26,115,232,.12);
  border-color: rgba(26,115,232,.4);
  color: var(--sg-text);
  font-weight: 700;
}
.sg-wrap .sg-loader-phase.is-active .sg-loader-phase-dot {
  background: var(--sg-blue);
  border-color: var(--sg-blue);
  box-shadow: 0 0 0 0 rgba(26,115,232,.5);
  animation: sgPhasePulse 1.4s ease-in-out infinite;
}
@keyframes sgPhasePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(26,115,232,.5); }
  50%      { box-shadow: 0 0 0 6px rgba(26,115,232,0); }
}
/* Fase completada: check verde */
.sg-wrap .sg-loader-phase.is-done {
  background: rgba(22,163,74,.08);
  border-color: rgba(22,163,74,.3);
  color: #166534;
}
.sg-wrap .sg-loader-phase.is-done .sg-loader-phase-dot {
  background: #16A34A;
  border-color: #16A34A;
}
.sg-wrap .sg-loader-phase.is-done .sg-loader-phase-dot::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.sg-wrap .sg-loader-timer {
  align-self: center;
  font-size: .78rem;
  color: var(--sg-text-soft);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  background: var(--sg-bg);
  padding: .35rem .8rem;
  border-radius: 6px;
  border: 1px solid var(--sg-border);
}
body.dark-mode .sg-wrap .sg-loader-phase { background: rgba(26,115,232,.06); border-color: rgba(26,115,232,.15); }
body.dark-mode .sg-wrap .sg-loader-phase.is-active { background: rgba(26,115,232,.18); border-color: rgba(26,115,232,.45); }
body.dark-mode .sg-wrap .sg-loader-phase.is-done { background: rgba(22,163,74,.1); border-color: rgba(22,163,74,.3); color: #86EFAC; }
body.dark-mode .sg-wrap .sg-loader-timer { background: #0F1419; }

/* Estado error */
.sg-step4-error {
  padding: 2rem 1.5rem;
  background: #FEF2F2;
  border: 1px solid #FCA5A5;
  border-radius: 14px;
  text-align: center;
}
.sg-step4-error-icon {
  font-size: 2.25rem;
  margin-bottom: .5rem;
}
.sg-step4-error h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #991B1B;
  margin: 0 0 .5rem;
}
.sg-step4-error p {
  font-size: .88rem;
  color: #7F1D1D;
  margin: 0 0 1.25rem;
  line-height: 1.5;
}

/* Card cabecera con info del skill generado */
.sg-skill-card {
  padding: 1.5rem;
  background: linear-gradient(135deg, rgba(26,115,232,.08), rgba(26,115,232,.02));
  border: 1px solid rgba(26,115,232,.25);
  border-radius: 14px;
  margin-bottom: 1.5rem;
}
.sg-skill-card-head {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: .75rem;
}
.sg-skill-emoji {
  font-size: 2.25rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: #fff;
  border: 1px solid var(--sg-border);
  border-radius: 14px;
  box-shadow: var(--sg-shadow-sm);
  flex-shrink: 0;
}
.sg-skill-card-titles { min-width: 0; flex: 1; }
.sg-skill-name {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--sg-text);
  margin: 0 0 .3rem;
  line-height: 1.2;
}
.sg-skill-slug {
  margin: 0;
}
.sg-skill-slug code {
  display: inline-block;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .78rem;
  color: var(--sg-blue-dark);
  background: rgba(26,115,232,.12);
  padding: .2rem .55rem;
  border-radius: 6px;
}
.sg-skill-desc {
  font-size: .9rem;
  color: var(--sg-text-soft);
  line-height: 1.55;
  margin: 0;
}
.sg-skill-saved {
  margin: .85rem 0 0;
  padding: .55rem .8rem;
  background: rgba(22,163,74,.08);
  border: 1px solid rgba(22,163,74,.25);
  border-radius: 8px;
  font-size: .82rem;
  color: #166534;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.sg-skill-saved a {
  color: #166534;
  text-decoration: underline;
  font-weight: 600;
  word-break: break-all;
}
.sg-skill-saved code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .76rem;
  background: rgba(22,163,74,.1);
  padding: .1rem .35rem;
  border-radius: 4px;
  color: inherit;
}
body.dark-mode .sg-skill-saved {
  background: rgba(22,163,74,.12);
  border-color: rgba(22,163,74,.35);
  color: #86EFAC;
}
body.dark-mode .sg-skill-saved a { color: #86EFAC; }
body.dark-mode .sg-skill-saved code { background: rgba(22,163,74,.18); }

/* Grid 2 columnas: descarga + instrucciones */
.sg-step4-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.sg-download-block,
.sg-install-block {
  padding: 1.5rem;
  background: var(--sg-card);
  border: 1px solid var(--sg-border);
  border-radius: 14px;
  box-shadow: var(--sg-shadow-sm);
}

/* Bloque descarga — destacado */
.sg-download-block {
  background: linear-gradient(135deg, rgba(26,115,232,.06), rgba(79,195,247,.03));
  border-color: rgba(26,115,232,.25);
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.sg-download-icon {
  font-size: 2.25rem;
  line-height: 1;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--sg-border);
  border-radius: 12px;
  flex-shrink: 0;
  box-shadow: var(--sg-shadow-sm);
}
.sg-download-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.sg-download-body h3 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--sg-text);
  margin: 0;
}
.sg-download-body p {
  font-size: .82rem;
  color: var(--sg-text-soft);
  margin: 0 0 .3rem;
  line-height: 1.5;
}
.sg-btn-lg {
  padding: .95rem 1.5rem !important;
  font-size: 1rem !important;
  font-weight: 800 !important;
  width: 100%;
  justify-content: center;
}
.sg-btn-sm {
  padding: .5rem .85rem !important;
  font-size: .82rem !important;
}

/* Bloque instalación rápida (comando curl) */
.sg-quick-install {
  padding: 1.5rem;
  background: linear-gradient(135deg, rgba(22,163,74,.06), rgba(22,163,74,.02));
  border: 2px solid rgba(22,163,74,.3);
  border-radius: 14px;
  box-shadow: var(--sg-shadow-sm);
}
.sg-quick-install-head {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  margin-bottom: 1rem;
}
.sg-quick-install-head > i {
  font-size: 1.5rem;
  color: #16A34A;
  margin-top: 2px;
  flex-shrink: 0;
}
.sg-quick-install-head h3 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--sg-text);
  margin: 0 0 .2rem;
}
.sg-quick-install-head p {
  font-size: .82rem;
  color: var(--sg-text-soft);
  margin: 0;
  line-height: 1.5;
}
.sg-quick-install-cmd {
  display: flex;
  align-items: stretch;
  background: #1A1F2B;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.08);
}
.sg-quick-install-cmd code {
  flex: 1;
  display: block;
  padding: .85rem 1rem;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: .82rem;
  color: #A5D6A7;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  background: transparent;
}
.sg-quick-install-copy {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  flex-shrink: 0;
  color: #9AA5B8;
  background: rgba(255,255,255,.04);
  border-left: 1px solid rgba(255,255,255,.08);
  transition: all .2s;
}
.sg-quick-install-copy:hover {
  color: #fff;
  background: rgba(255,255,255,.1);
}
.sg-quick-install-copy.sg-copied {
  color: #4ADE80;
}
.sg-quick-install-hint {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: .75rem;
  font-size: .76rem;
  color: var(--sg-text-soft);
  line-height: 1.4;
}
.sg-quick-install-hint i {
  color: #16A34A;
  font-size: .85rem;
  flex-shrink: 0;
}

/* Dark mode */
body.dark-mode .sg-quick-install {
  background: linear-gradient(135deg, rgba(22,163,74,.12), rgba(22,163,74,.04));
  border-color: rgba(22,163,74,.35);
}

/* Bloque instalación */
.sg-install-block h3 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--sg-text);
  margin: 0 0 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.sg-install-steps {
  list-style: none;
  counter-reset: install;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .9rem;
}
.sg-install-steps li {
  counter-increment: install;
  position: relative;
  padding-left: 2.25rem;
  font-size: .88rem;
  color: var(--sg-text);
  line-height: 1.55;
}
.sg-install-steps li::before {
  content: counter(install);
  position: absolute;
  left: 0;
  top: .1rem;
  width: 1.5rem;
  height: 1.5rem;
  background: var(--sg-blue);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  font-weight: 800;
}
.sg-install-steps strong { font-weight: 700; }
.sg-install-code {
  margin-top: .4rem;
}
.sg-install-code code {
  display: inline-block;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .78rem;
  background: rgba(26,115,232,.08);
  color: var(--sg-blue-dark);
  padding: .3rem .6rem;
  border-radius: 6px;
  word-break: break-all;
}
.sg-install-tip {
  margin-top: 1.1rem;
  padding: .8rem .95rem;
  background: rgba(255,248,225,.6);
  border-left: 3px solid #FFC107;
  border-radius: 6px;
  font-size: .8rem;
  color: #5D4037;
  line-height: 1.55;
}
.sg-install-tip code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .75rem;
  background: rgba(0,0,0,.08);
  padding: .1rem .35rem;
  border-radius: 4px;
  color: inherit;
}

/* Acordeón con el SKILL.md completo */
.sg-skill-md-block {
  background: var(--sg-card);
  border: 1px solid var(--sg-border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--sg-shadow-sm);
}
.sg-skill-md-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--sg-text);
  transition: background .15s ease;
}
.sg-skill-md-toggle:hover { background: rgba(26,115,232,.04); }
.sg-skill-md-toggle-icon {
  font-size: 1.1rem;
  line-height: 1;
  color: var(--sg-blue);
  transition: transform .25s ease;
  display: inline-block;
}
.sg-skill-md-toggle[aria-expanded="true"] .sg-skill-md-toggle-icon {
  transform: rotate(90deg);
}
.sg-skill-md-toggle-txt {
  flex: 1;
  min-width: 0;
}
.sg-skill-md-toggle-txt strong {
  display: block;
  font-size: .95rem;
  font-weight: 700;
  color: var(--sg-text);
}
.sg-skill-md-toggle-txt small {
  display: block;
  font-size: .78rem;
  color: var(--sg-text-soft);
  margin-top: .15rem;
}
.sg-skill-md-toggle-action {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .82rem;
  font-weight: 700;
  color: var(--sg-blue);
  white-space: nowrap;
}
.sg-skill-md-content {
  border-top: 1px solid var(--sg-border);
  background: #0F1419;
}
.sg-skill-md-pre {
  margin: 0;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  max-height: 480px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .82rem;
  line-height: 1.65;
  color: #E4E9F0;
  white-space: pre;
}
.sg-skill-md-pre code {
  font-family: inherit;
  color: inherit;
  background: none;
  padding: 0;
  font-size: inherit;
}

/* Feedback de copiado */
.sg-copy-ok {
  color: #16A34A !important;
  font-weight: 700;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .skill-generator-layout {
    grid-template-columns: 1fr;
  }
  .sg-sidebar {
    position: static;
  }
  .sg-steps {
    flex-direction: row;
    overflow-x: auto;
    gap: 0;
    justify-content: center;
  }
  .sg-step {
    flex: 0 0 25%;
    justify-content: center;
    padding: .6rem .4rem;
  }
  .sg-step-active { box-shadow: inset 0 -3px 0 var(--sg-blue); }
}
@media (max-width: 900px) {
  .sg-step3-grid { grid-template-columns: 1fr; }
  .sg-step3-aside { order: -1; flex-direction: row; flex-wrap: wrap; }
  .sg-step3-aside .sg-aside-block { flex: 1; min-width: 220px; }
  .sg-step4-grid { grid-template-columns: 1fr; }
  .sg-skill-card { grid-template-columns: 1fr; text-align: center; }
  .sg-skill-card-emoji { margin: 0 auto; }
}
@media (max-width: 768px) {
  .skill-generator-hero { padding: 3rem 1rem 5rem; }
  .skill-generator-layout { padding: 0 1rem; }
  .sg-panel { padding: 1.5rem 1.25rem 1.25rem; }
  .sg-grid { grid-template-columns: 1fr; }
  .sg-step-content { display: none; }
  .sg-panel-footer,
  .sg-panel-toolbar { flex-direction: column; align-items: stretch; }
  .sg-panel-footer-info,
  .sg-toolbar-info { order: -1; }
  .sg-btn { justify-content: center; }
  .hero-stat { min-width: 110px; padding: .75rem 1.1rem; }

  /* Hero intro: interlineado reducido y centrado */
  .sg-wrap .hero-intro {
    line-height: 1.35;
    text-align: center;
    font-size: .85rem;
  }

  /* Logo más pequeño en móvil */
  .sg-wrap .logo .logo-text {
    font-size: 1.10rem;
  }
  .hero-stat-num { font-size: 1.6rem; }
  .sg-questions-actions { flex-direction: column; }
  .sg-questions-actions .sg-btn { width: 100%; }
}

/* ── Modo oscuro ──────────────────────────────────────────────────────────── */
body.dark-mode .sg-wrap {
  --sg-bg: #0F1419;
  --sg-card: #1A1F2B;
  --sg-border: #2A3141;
  --sg-text: #E4E9F0;
  --sg-text-soft: #9AA5B8;
}
body.dark-mode .sg-sidebar,
body.dark-mode .sg-panel { background: #1A1F2B; }
body.dark-mode .sg-card-toggle { background: #0F1419; }
body.dark-mode .sg-card-example { background: #0F1419; }
body.dark-mode .sg-step:hover { background: #0F1419; }
body.dark-mode .sg-step-active { background: rgba(26,115,232,.15); }
body.dark-mode .sg-soon code { background: #2A3141; }
body.dark-mode .sg-panel-num { background: rgba(26,115,232,.2); }
body.dark-mode .sg-panel-toolbar { background: #0F1419; }
body.dark-mode .sg-field-block,
body.dark-mode .sg-aside-block,
body.dark-mode .sg-question { background: #0F1419; }
body.dark-mode .sg-textarea,
body.dark-mode .sg-question-input { background: #0F1419; color: var(--sg-text); }
body.dark-mode .sg-field-block-cta { background: linear-gradient(135deg, rgba(26,115,232,.12), rgba(26,115,232,.04)); }
body.dark-mode .sg-refined-block { background: linear-gradient(135deg, rgba(22,163,74,.12), rgba(22,163,74,.04)); }
body.dark-mode .sg-callout-warn {
  background: linear-gradient(135deg, rgba(245,158,11,.18), rgba(245,158,11,.06));
  border-color: #F59E0B;
  color: #FDE68A;
}
body.dark-mode .sg-callout-body em { background: rgba(255,255,255,.12); color: #fff; }
body.dark-mode .sg-engine-opt { background: #0F1419; }
body.dark-mode .sg-engine-opt-selected { background: #1A1F2B; }
body.dark-mode .sg-aside-tip { background: rgba(255,248,225,.08); }
body.dark-mode .sg-aside-tip p { color: #FFE082; }
body.dark-mode .sg-error-msg { background: rgba(254,226,226,.1); color: #FCA5A5; }
body.dark-mode .sg-step4-loading,
body.dark-mode .sg-download-block,
body.dark-mode .sg-install-block,
body.dark-mode .sg-skill-md-block { background: #1A1F2B; }
body.dark-mode .sg-skill-card { background: linear-gradient(135deg, rgba(26,115,232,.15), rgba(26,115,232,.04)); }
body.dark-mode .sg-skill-emoji,
body.dark-mode .sg-download-icon { background: #0F1419; }
body.dark-mode .sg-skill-slug code { background: rgba(26,115,232,.2); color: #9AC7FF; }
body.dark-mode .sg-download-block { background: linear-gradient(135deg, rgba(26,115,232,.12), rgba(79,195,247,.04)); }
body.dark-mode .sg-step4-error { background: rgba(254,226,226,.08); }
body.dark-mode .sg-step4-error-title { color: #FCA5A5; }
body.dark-mode .sg-step4-error-msg { color: #FECACA; }
body.dark-mode .sg-install-tip { background: rgba(255,248,225,.08); color: #FFE082; border-left-color: #FFC107; }
body.dark-mode .sg-install-steps code { background: rgba(26,115,232,.18); color: #9AC7FF; }
body.dark-mode .sg-skill-md-toggle:hover { background: rgba(26,115,232,.08); }
body.dark-mode .sg-skill-md-content { background: #0A0E13; }
