/* ─────────────────────────────────────────────────────────────────────
   SOFTWAWEBS · v2 · app.css
   Tokens + reset + componentes base.
   Branding: paleta B (Teal + Naranja) heredando chasis softwatools v2.
   ───────────────────────────────────────────────────────────────────── */

/* Atributo HTML hidden tiene precedencia sobre cualquier display de clase. */
[hidden] { display: none !important; }

:root {
  /* ── Color · Brand · Teal ──────────────────────────────────────── */
  --sw-brand-50:  #f0fdfa;
  --sw-brand-100: #ccfbf1;
  --sw-brand-200: #99f6e4;
  --sw-brand-300: #5eead4;
  --sw-brand-400: #2dd4bf;
  --sw-brand-500: #14b8a6;
  --sw-brand-600: #0d9488;
  --sw-brand-700: #0f766e;
  --sw-brand-800: #115e59;
  --sw-brand-900: #134e4a;

  --sw-spot-500: #f97316;
  --sw-spot-600: #ea580c;

  /* ── Color · Neutrales (cálidos sutiles) ───────────────────────── */
  --sw-ink-50:  #fafaf9;
  --sw-ink-100: #f4f4f3;
  --sw-ink-200: #e7e7e5;
  --sw-ink-300: #d3d3d0;
  --sw-ink-400: #a1a1a0;
  --sw-ink-500: #71716f;
  --sw-ink-600: #525252;
  --sw-ink-700: #3a3a39;
  --sw-ink-800: #262625;
  --sw-ink-900: #171716;
  --sw-ink-950: #0c0c0b;

  /* ── Color · Estado ────────────────────────────────────────────── */
  --sw-success-500: #10b981;
  --sw-success-50:  #ecfdf5;
  --sw-warning-500: #f59e0b;
  --sw-warning-50:  #fffbeb;
  --sw-error-500:   #ef4444;
  --sw-error-50:    #fef2f2;

  /* ── Color · Superficies ───────────────────────────────────────── */
  --sw-bg:           #ffffff;
  --sw-bg-subtle:    #fafaf9;
  --sw-bg-muted:     #f4f4f3;
  --sw-bg-strong:    #ebebe9;
  --sw-surface:      #ffffff;
  --sw-border:       #e7e7e5;
  --sw-border-strong:#d3d3d0;
  --sw-text:         #171716;
  --sw-text-muted:   #525252;
  --sw-text-subtle:  #71716f;

  /* ── Tipografía ─────────────────────────────────────────────────── */
  --sw-font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --sw-font-display: "Geist", "Inter", -apple-system, sans-serif;
  --sw-font-mono: "Geist Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

  --sw-text-xs:   12px;
  --sw-text-sm:   13px;
  --sw-text-base: 15px;
  --sw-text-md:   16px;
  --sw-text-lg:   18px;
  --sw-text-xl:   22px;
  --sw-text-2xl:  28px;
  --sw-text-3xl:  36px;
  --sw-text-4xl:  48px;
  --sw-text-5xl:  64px;

  /* ── Espaciado · escala 4px ────────────────────────────────────── */
  --sw-space-1:  4px;
  --sw-space-2:  8px;
  --sw-space-3:  12px;
  --sw-space-4:  16px;
  --sw-space-5:  20px;
  --sw-space-6:  24px;
  --sw-space-8:  32px;
  --sw-space-10: 40px;
  --sw-space-12: 48px;
  --sw-space-16: 64px;
  --sw-space-20: 80px;
  --sw-space-24: 96px;

  /* ── Radios ─────────────────────────────────────────────────────── */
  --sw-radius-xs:  4px;
  --sw-radius-sm:  6px;
  --sw-radius-md:  8px;
  --sw-radius-lg:  12px;
  --sw-radius-xl:  16px;
  --sw-radius-2xl: 22px;
  --sw-radius-full: 9999px;

  /* ── Sombras ────────────────────────────────────────────────────── */
  --sw-shadow-xs:  0 1px 2px rgba(15, 17, 22, 0.04);
  --sw-shadow-sm:  0 1px 3px rgba(15, 17, 22, 0.06), 0 1px 2px rgba(15,17,22,.04);
  --sw-shadow-md:  0 4px 12px rgba(15, 17, 22, 0.06), 0 2px 4px rgba(15,17,22,.04);
  --sw-shadow-lg:  0 12px 28px rgba(15, 17, 22, 0.08), 0 4px 10px rgba(15,17,22,.04);
  --sw-shadow-xl:  0 24px 56px rgba(15, 17, 22, 0.10), 0 8px 16px rgba(15,17,22,.05);
  --sw-shadow-glow: 0 0 0 4px rgba(20, 184, 166, 0.14);
  --sw-shadow-focus: 0 0 0 3px rgba(20, 184, 166, 0.34);

  /* ── Motion ─────────────────────────────────────────────────────── */
  --sw-ease-out:    cubic-bezier(0.2, 0.7, 0.3, 1);
  --sw-ease-spring: cubic-bezier(0.34, 1.4, 0.5, 1);
  --sw-dur-fast:    120ms;
  --sw-dur-base:    200ms;
  --sw-dur-slow:    240ms;

  /* ── Layout ─────────────────────────────────────────────────────── */
  --sw-header-h: 56px;
  --sw-sidebar-w: 360px;
  --sw-content-max: 1200px;

  /* ── Categorías devtools (color por familia) ───────────────────── */
  /* Nombres con prefijo --sw-fam-* para evitar choque con --sw-cat-color
     que es la variable de scope que cada .cat-<slug> redefine. */
  --sw-fam-color:  oklch(0.66 0.16 20);   /* coral */
  --sw-fam-asset:  oklch(0.66 0.14 130);  /* lima */
  --sw-fam-web:    oklch(0.62 0.13 250);  /* azul medio */
  --sw-fam-datos:  oklch(0.58 0.13 295);  /* violeta */
}

@media (prefers-reduced-motion: reduce) {
  :root { --sw-dur-fast: 0ms; --sw-dur-base: 0ms; --sw-dur-slow: 0ms; }
  *, *::before, *::after { animation-duration: 0ms !important; transition-duration: 0ms !important; }
}

/* ─── Reset ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sw-font-sans);
  font-size: var(--sw-text-base);
  color: var(--sw-text);
  background: var(--sw-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}
a { color: inherit; }
button { font-family: inherit; }
img, svg, video { display: block; max-width: 100%; }
:focus-visible {
  outline: 2px solid var(--sw-brand-500);
  outline-offset: 2px;
  border-radius: var(--sw-radius-xs);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.container {
  width: 100%;
  max-width: var(--sw-content-max);
  margin: 0 auto;
  padding: 0 var(--sw-space-6);
}
@media (max-width: 640px) { .container { padding: 0 var(--sw-space-5); } }

/* ─── Logo ────────────────────────────────────────────────────────── */
.sw-logo {
  font-family: var(--sw-font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.02em;
  line-height: 1;
  display: inline-flex;
  align-items: baseline;
  color: var(--sw-text);
  text-decoration: none;
}
.sw-logo .grad {
  background-image: linear-gradient(90deg, var(--sw-brand-500), var(--sw-spot-500));
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}

/* ─── Header sticky ───────────────────────────────────────────────── */
.sw-header {
  position: sticky; top: 0; z-index: 30;
  height: var(--sw-header-h);
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--sw-border);
}
.sw-header-inner {
  display: flex; align-items: center;
  height: 100%; gap: var(--sw-space-6);
  max-width: var(--sw-content-max); margin: 0 auto;
  padding: 0 var(--sw-space-6);
}
.sw-nav { display: flex; align-items: center; gap: var(--sw-space-1); }
.sw-nav a {
  padding: 6px 10px; font-size: 13px; font-weight: 500;
  color: var(--sw-text-muted); border-radius: var(--sw-radius-sm);
  text-decoration: none; transition: background var(--sw-dur-fast), color var(--sw-dur-fast);
}
.sw-nav a:hover, .sw-nav a.active { color: var(--sw-text); background: var(--sw-bg-muted); }

.sw-header-spacer { flex: 1; }
.sw-header-actions { display: flex; align-items: center; gap: var(--sw-space-2); }
.sw-header-search { width: 280px; max-width: 30vw; }

.sw-mobile-trigger {
  display: none; width: 40px; height: 40px;
  border: 1px solid var(--sw-border); background: var(--sw-surface);
  border-radius: var(--sw-radius-md); align-items: center; justify-content: center;
  cursor: pointer; color: var(--sw-text);
}

@media (max-width: 900px) {
  .sw-nav, .sw-header-search, .sw-header-actions .sw-cta-desktop { display: none; }
  .sw-mobile-trigger { display: inline-flex; }
}

/* ─── Buttons ─────────────────────────────────────────────────────── */
.sw-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border-radius: var(--sw-radius-md);
  font-size: 14px; font-weight: 500;
  letter-spacing: -0.005em; text-decoration: none;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: transform var(--sw-dur-fast) var(--sw-ease-out),
              box-shadow var(--sw-dur-fast),
              background var(--sw-dur-fast),
              border-color var(--sw-dur-fast);
}
.sw-btn:hover { transform: translateY(-1px); }
.sw-btn:active { transform: translateY(0); }
.sw-btn[disabled], .sw-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.sw-btn--primary { background: var(--sw-ink-900); color: #fff; border-color: var(--sw-ink-900); box-shadow: var(--sw-shadow-sm); }
.sw-btn--primary:hover { background: var(--sw-ink-800); }
.sw-btn--brand { background: var(--sw-brand-500); color: #fff; border-color: var(--sw-brand-600); box-shadow: var(--sw-shadow-sm); }
.sw-btn--brand:hover { background: var(--sw-brand-600); }
.sw-btn--secondary { background: var(--sw-surface); color: var(--sw-text); border-color: var(--sw-border); box-shadow: var(--sw-shadow-xs); }
.sw-btn--secondary:hover { border-color: var(--sw-border-strong); }
.sw-btn--ghost { background: transparent; color: var(--sw-text); }
.sw-btn--ghost:hover { background: var(--sw-bg-muted); }
.sw-btn--danger { background: transparent; color: var(--sw-error-500); }
.sw-btn--danger:hover { background: var(--sw-error-50); }

.sw-btn--sm { height: 32px; padding: 0 12px; font-size: 13px; gap: 6px; }
.sw-btn--lg { height: 48px; padding: 0 22px; font-size: 15px; gap: 10px; }
.sw-btn--xl { height: 56px; padding: 0 28px; font-size: 16px; gap: 10px; }
.sw-btn--block { width: 100%; justify-content: center; }

/* ─── Badges ──────────────────────────────────────────────────────── */
.sw-badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px;
  border-radius: var(--sw-radius-full);
  font-size: 11.5px; font-weight: 600; line-height: 1;
}
.sw-badge--neutral { background: var(--sw-ink-100); color: var(--sw-ink-700); }
.sw-badge--brand   { background: var(--sw-brand-50); color: var(--sw-brand-700); }
.sw-badge--success { background: var(--sw-success-50); color: #0f7e5b; }
.sw-badge--warning { background: var(--sw-warning-50); color: #a16207; }
.sw-badge--ai      { background: rgba(249,115,22,.1); color: var(--sw-spot-600); text-transform: uppercase; letter-spacing: 0.04em; font-size: 10.5px; }
.sw-badge--outline { background: transparent; color: var(--sw-text-muted); border: 1px solid var(--sw-border); }

/* ─── Search input ────────────────────────────────────────────────── */
.sw-search { position: relative; width: 100%; }
.sw-search__icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--sw-text-subtle); pointer-events: none;
}
.sw-search__input {
  width: 100%; height: 44px;
  padding: 0 14px 0 42px;
  background: var(--sw-surface); color: var(--sw-text);
  border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius-lg);
  font-size: 14px; font-family: inherit;
  box-shadow: var(--sw-shadow-xs);
  outline: none;
  transition: border-color var(--sw-dur-fast), box-shadow var(--sw-dur-fast);
}
.sw-search__input:hover { border-color: var(--sw-border-strong); }
.sw-search__input:focus { border-color: var(--sw-brand-400); box-shadow: var(--sw-shadow-focus); }
.sw-search__kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-size: 11px; color: var(--sw-text-subtle);
  background: var(--sw-bg-muted); border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius-xs); padding: 2px 6px;
  font-family: var(--sw-font-mono);
}
.sw-search__results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--sw-surface); border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius-lg); box-shadow: var(--sw-shadow-lg);
  max-height: 320px; overflow-y: auto; z-index: 50; padding: 6px;
}
.sw-search__row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 10px 12px;
  border: 0; background: transparent; cursor: pointer; text-align: left;
  border-radius: var(--sw-radius-md);
  text-decoration: none; color: inherit;
}
.sw-search__row:hover { background: var(--sw-bg-muted); }
.sw-search__row .ico {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--sw-bg-muted); display: grid; place-items: center;
  color: var(--sw-text-muted); flex-shrink: 0;
}
.sw-search__row .meta { flex: 1; min-width: 0; }
.sw-search__row .meta .n { display: block; font-size: 13.5px; font-weight: 500; color: var(--sw-text); }
.sw-search__row .meta .c { display: block; font-size: 11.5px; color: var(--sw-text-subtle); }

/* ─── Hero (Editorial · dir 03) ───────────────────────────────────── */
.sw-hero { padding: 72px 0 32px; position: relative; }
@media (max-width: 640px) { .sw-hero { padding: 32px 0 16px; } }

.sw-hero__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 56px;
  align-items: end;
}
@media (max-width: 900px) { .sw-hero__grid { grid-template-columns: 1fr; gap: 28px; } }

.sw-hero__eyebrow {
  font-size: 13px; color: var(--sw-spot-500);
  font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: var(--sw-space-4);
}
.sw-hero h1 {
  font-family: var(--sw-font-display);
  font-size: 96px; font-weight: 800;
  letter-spacing: -0.045em; line-height: 0.92;
  margin: 0; color: var(--sw-text);
}
.sw-hero h1 em {
  font-style: italic; font-weight: 500; color: var(--sw-spot-500);
}
.sw-hero h1 .muted { color: var(--sw-text-muted); }
@media (max-width: 1100px) { .sw-hero h1 { font-size: 72px; } }
@media (max-width: 700px)  { .sw-hero h1 { font-size: 44px; } }

.sw-hero__lede {
  font-size: 18px; color: var(--sw-text-muted); line-height: 1.55;
  margin: 0 0 24px; max-width: 380px;
}
.sw-hero__lede strong { color: var(--sw-text); font-weight: 600; }
.sw-hero__cta { display: flex; flex-wrap: wrap; gap: 10px; }

.sw-search-bar {
  margin-top: 48px;
  padding: 28px;
  background: var(--sw-ink-900);
  color: #fff;
  border-radius: var(--sw-radius-xl);
  display: grid; grid-template-columns: auto 1fr auto; gap: 32px; align-items: center;
}
.sw-search-bar .meta .e { font-size: 11px; color: rgba(255,255,255,.6); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; margin-bottom: 6px; }
.sw-search-bar .meta .t { font-size: 18px; font-weight: 600; font-family: var(--sw-font-display); }
.sw-search-bar .kbd-hint { display: flex; gap: 6px; align-items: center; font-size: 12px; color: rgba(255,255,255,.55); }
.sw-search-bar kbd {
  background: rgba(255,255,255,.08); border-radius: 4px; padding: 4px 8px;
  font-family: var(--sw-font-mono); font-size: 11px;
}
.sw-search-bar .sw-search__input {
  background: rgba(255,255,255,.06); color: #fff; border-color: rgba(255,255,255,.1);
}
.sw-search-bar .sw-search__input::placeholder { color: rgba(255,255,255,.4); }
.sw-search-bar .sw-search__icon { color: rgba(255,255,255,.55); }
@media (max-width: 900px) { .sw-search-bar { grid-template-columns: 1fr; gap: 16px; padding: 18px; }
  .sw-search-bar .kbd-hint { display: none; }
}

/* ─── Sections ────────────────────────────────────────────────────── */
.sw-section { padding: 76px 0; }
.sw-section--dense { padding: 52px 0; border-top: 1px solid var(--sw-border); }
@media (max-width: 640px) { .sw-section, .sw-section--dense { padding: 36px 0; } }

.sw-section__head { max-width: 720px; margin-bottom: 28px; }
.sw-section__eyebrow {
  font-size: 12px; color: var(--sw-spot-500);
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.sw-section__title {
  font-size: 32px; font-weight: 600;
  letter-spacing: -0.02em; line-height: 1.1; margin: 0; color: var(--sw-text);
}
.sw-section__sub {
  font-size: 17px; color: var(--sw-text-muted);
  margin-top: 12px; line-height: 1.5; max-width: 600px;
}
@media (max-width: 640px) { .sw-section__title { font-size: 26px; } .sw-section__sub { font-size: 15px; } }

.sw-grid-2 { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
.sw-grid-3 { display: grid; gap: 14px; grid-template-columns: repeat(3, 1fr); }
.sw-grid-6 { display: grid; gap: 12px; grid-template-columns: repeat(6, 1fr); }
@media (max-width: 900px) {
  .sw-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .sw-grid-6 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .sw-grid-3 { grid-template-columns: 1fr; }
  .sw-grid-6 { grid-template-columns: repeat(2, 1fr); }
}

/* ─── Cards: Tool / Category / Flow ───────────────────────────────── */
.sw-tool {
  display: flex; flex-direction: column; gap: 10px;
  padding: 18px;
  background: var(--sw-surface); border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius-lg);
  text-decoration: none; color: inherit;
  transition: border-color var(--sw-dur-fast), box-shadow var(--sw-dur-fast), transform var(--sw-dur-fast);
}
.sw-tool:hover { border-color: var(--sw-border-strong); box-shadow: var(--sw-shadow-sm); transform: translateY(-1px); }
.sw-tool__head { display: flex; align-items: center; gap: 10px; }
.sw-tool__icon {
  width: 36px; height: 36px; border-radius: var(--sw-radius-md);
  display: grid; place-items: center; flex-shrink: 0;
  background: color-mix(in oklch, var(--sw-cat-color, var(--sw-brand-500)) 14%, white);
  color: var(--sw-cat-color, var(--sw-brand-500));
}
.sw-tool__title { font-size: 14px; font-weight: 600; letter-spacing: -0.005em; color: var(--sw-text); flex: 1; min-width: 0; }
.sw-tool__cat { font-size: 11.5px; color: var(--sw-text-subtle); text-transform: uppercase; letter-spacing: 0.04em; }
.sw-tool__desc { font-size: 12.5px; color: var(--sw-text-muted); margin: 0; line-height: 1.5; min-height: 36px; }
.sw-tool__chain { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--sw-text-subtle); margin-top: auto; }

.sw-cat {
  display: flex; flex-direction: column; gap: 12px;
  padding: 20px;
  background: var(--sw-surface); border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius-lg);
  text-decoration: none; color: inherit;
  transition: all var(--sw-dur-base) var(--sw-ease-out);
}
.sw-cat:hover { transform: translateY(-2px); box-shadow: var(--sw-shadow-md); border-color: var(--sw-cat-color, var(--sw-border-strong)); }
.sw-cat__icon {
  width: 44px; height: 44px; border-radius: var(--sw-radius-md);
  display: grid; place-items: center;
  background: color-mix(in oklch, var(--sw-cat-color, var(--sw-brand-500)) 14%, white);
  color: var(--sw-cat-color, var(--sw-brand-500));
}
.sw-cat__name { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; color: var(--sw-text); }
.sw-cat__count { font-size: 12.5px; color: var(--sw-text-muted); margin-top: 2px; }

.sw-flow {
  display: flex; flex-direction: column; gap: 12px;
  padding: 18px;
  background: var(--sw-surface); border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius-lg);
  transition: all var(--sw-dur-base) var(--sw-ease-out);
}
.sw-flow:hover { border-color: var(--sw-border-strong); box-shadow: var(--sw-shadow-sm); }
.sw-flow__head { display: flex; align-items: flex-start; gap: 10px; }
.sw-flow__icon {
  width: 32px; height: 32px; border-radius: var(--sw-radius-md);
  background: var(--sw-bg-muted); color: var(--sw-text);
  display: grid; place-items: center; flex-shrink: 0;
}
.sw-flow__name { font-size: 14px; font-weight: 600; color: var(--sw-text); }
.sw-flow__desc { font-size: 12.5px; color: var(--sw-text-muted); margin-top: 2px; line-height: 1.45; }
.sw-flow__usos { font-size: 11px; color: var(--sw-text-subtle); white-space: nowrap; }
.sw-flow__steps { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.sw-flow__step {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 8px; background: var(--sw-bg-muted);
  border-radius: var(--sw-radius-sm);
  font-size: 11.5px; color: var(--sw-text); font-weight: 500;
}
.sw-flow__sep { color: var(--sw-text-subtle); }
.sw-flow__btn {
  height: 34px; border: 1px solid var(--sw-border); background: var(--sw-surface);
  border-radius: var(--sw-radius-md); font-size: 12.5px; font-weight: 500; color: var(--sw-text);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none;
}
.sw-flow__btn:hover { background: var(--sw-bg-muted); border-color: var(--sw-border-strong); }

/* ─── Chain preview animado (home) ────────────────────────────────── */
.sw-chain { padding: 40px; background: var(--sw-bg-subtle); border: 1px solid var(--sw-border); border-radius: var(--sw-radius-xl); }
.sw-chain__inner { display: flex; align-items: center; justify-content: center; gap: 0; flex-wrap: wrap; }
.sw-chain__step {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 16px 14px; min-width: 130px;
  background: var(--sw-surface); border: 1.5px solid var(--sw-border);
  border-radius: var(--sw-radius-lg);
  transition: all var(--sw-dur-base) var(--sw-ease-out);
}
.sw-chain__step--current { border-color: var(--sw-brand-400); background: var(--sw-brand-50); transform: translateY(-2px); box-shadow: var(--sw-shadow-glow); }
.sw-chain__step--done { border-color: var(--sw-success-500); }
.sw-chain__step .ico {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--sw-bg-muted); color: var(--sw-text-muted);
  display: grid; place-items: center;
}
.sw-chain__step--current .ico { background: var(--sw-brand-500); color: #fff; }
.sw-chain__step--done .ico { background: var(--sw-success-500); color: #fff; }
.sw-chain__name { font-size: 12.5px; font-weight: 600; text-align: center; letter-spacing: -0.005em; }
.sw-chain__bar { width: 28px; height: 2px; background: var(--sw-border-strong); flex-shrink: 0; transition: background var(--sw-dur-base); }
.sw-chain__bar--done { background: var(--sw-success-500); }
@media (max-width: 640px) {
  .sw-chain { padding: 20px; }
  .sw-chain__inner { flex-direction: column; }
  .sw-chain__bar { width: 2px; height: 18px; }
}

.sw-chain-tabs { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.sw-chain-tab {
  padding: 8px 14px; border-radius: var(--sw-radius-full);
  border: 1px solid var(--sw-border); background: var(--sw-surface);
  color: var(--sw-text-muted); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all var(--sw-dur-fast);
}
.sw-chain-tab[aria-pressed="true"] { background: var(--sw-text); color: #fff; border-color: var(--sw-text); }

/* ─── Why ─────────────────────────────────────────────────────────── */
.sw-why-card {
  padding: 22px; border: 1px solid var(--sw-border); border-radius: var(--sw-radius-lg);
  background: var(--sw-surface);
}
.sw-why-card .ico { width: 36px; height: 36px; border-radius: 8px; background: var(--sw-bg-muted); display: grid; place-items: center; margin-bottom: 14px; }
.sw-why-card h3 { font-size: 16px; font-weight: 600; margin: 0 0 6px; }
.sw-why-card p { margin: 0; font-size: 13.5px; color: var(--sw-text-muted); line-height: 1.5; }

/* ─── CTA ─────────────────────────────────────────────────────────── */
.sw-cta {
  padding: 56px;
  background: var(--sw-spot-500);
  color: #fff; border-radius: var(--sw-radius-xl);
  text-align: center; position: relative; overflow: hidden;
}
.sw-cta__eye { font-size: 12px; color: rgba(255,255,255,.6); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; margin-bottom: 12px; }
.sw-cta h2 { font-size: 40px; font-weight: 700; letter-spacing: -0.025em; margin: 0 0 14px; font-family: var(--sw-font-display); }
.sw-cta p { font-size: 15px; color: rgba(255,255,255,.72); max-width: 480px; margin: 0 auto 24px; line-height: 1.5; }
.sw-cta__btns { display: inline-flex; gap: 10px; }
.sw-cta__btns .sw-btn--white { background: #fff; color: var(--sw-ink-900); border-color: #fff; }
.sw-cta__btns .sw-btn--white:hover { background: var(--sw-ink-100); }
.sw-cta__btns .sw-btn--ghost-on-dark { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.25); }
@media (max-width: 640px) { .sw-cta { padding: 28px; } .sw-cta h2 { font-size: 28px; } }

/* ─── Footer ──────────────────────────────────────────────────────── */
.sw-footer {
  border-top: 1px solid var(--sw-border);
  padding: 32px var(--sw-space-6);
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  flex-wrap: wrap; max-width: var(--sw-content-max); margin: 0 auto;
}
.sw-footer__links { display: flex; flex-wrap: wrap; gap: 14px 18px; font-size: 12.5px; color: var(--sw-text-subtle); }
.sw-footer__links a { color: inherit; text-decoration: none; }
.sw-footer__links a:hover { color: var(--sw-text); }
@media (max-width: 640px) {
  .sw-footer { padding: 24px var(--sw-space-4); flex-direction: column; align-items: flex-start; gap: 14px; }
  .sw-footer__links { gap: 10px 14px; }
  .sw-footer__copy { font-size: 11.5px; color: var(--sw-text-subtle); }
}

/* ─── Mobile menu (fullscreen) ────────────────────────────────────── */
.sw-mobile-menu {
  position: fixed; inset: 0; z-index: 80;
  background: var(--sw-bg);
  display: none;
  flex-direction: column;
  animation: sw-slide-up var(--sw-dur-slow) var(--sw-ease-out);
}
.sw-mobile-menu.is-open { display: flex; }
.sw-mobile-menu__hdr { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--sw-border); }
.sw-mobile-menu__nav { display: flex; flex-direction: column; padding: 16px 12px; gap: 4px; flex: 1; }
.sw-mobile-menu__nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 12px;
  font-size: 16px; font-weight: 500;
  color: var(--sw-text); text-decoration: none;
  border-radius: var(--sw-radius-md);
}
.sw-mobile-menu__nav a:hover { background: var(--sw-bg-muted); }
.sw-mobile-menu__ftr { padding: 16px 20px; border-top: 1px solid var(--sw-border); display: flex; gap: 10px; }

/* ─── Tool workspace (página de herramienta) ──────────────────────── */
.sw-workspace {
  display: grid;
  grid-template-rows: auto 1fr;
  height: calc(100vh - var(--sw-header-h));
  height: calc(100dvh - var(--sw-header-h));
  overflow: hidden;
}
.sw-workspace > .sw-warning + .sw-workspace__main,
.sw-workspace > .sw-warning ~ .sw-workspace__main { min-height: 0; }
.sw-workspace > .sw-warning { grid-row: span 1; }
.sw-workspace__main {
  display: grid;
  grid-template-columns: 1fr var(--sw-sidebar-w);
  overflow: hidden;
  min-height: 0;
}
.sw-workspace__content {
  display: flex; flex-direction: column;
  padding: 16px; gap: 12px;
  overflow: auto;
  min-height: 0;
  min-width: 0;
}
.sw-workspace__sidebar {
  border-left: 1px solid var(--sw-border);
  background: var(--sw-bg-subtle);
  display: flex; flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.sw-workspace__sidebar-hdr {
  padding: 14px 18px;
  border-bottom: 1px solid var(--sw-border);
  flex-shrink: 0;
  position: relative;
}
.sw-workspace__sidebar-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 18px;
  min-height: 0;
}
.sw-workspace__sidebar-ftr {
  padding: 14px 18px;
  border-top: 1px solid var(--sw-border);
  display: flex; flex-direction: column; gap: 8px;
  flex-shrink: 0;
  background: var(--sw-bg-subtle);
}
@media (max-width: 900px) {
  .sw-workspace__main { grid-template-columns: 1fr; }
  .sw-workspace__sidebar { display: none; }
  .sw-workspace__sidebar.is-open {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 70;
    border-left: 0;
    height: 100dvh;
  }
}

/* FAB de procesar (solo mobile, cuando hay sidebar de opciones) */
.sw-workspace__fab {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--sw-brand-500); color: #fff;
  border: 0;
  box-shadow: var(--sw-shadow-lg);
  cursor: pointer;
  z-index: 60;
  align-items: center; justify-content: center;
  transition: background var(--sw-dur-fast), transform var(--sw-dur-fast);
}
.sw-workspace__fab:hover { background: var(--sw-brand-600); transform: translateY(-1px); }
.sw-workspace__fab:active { transform: translateY(0); }
.sw-workspace__fab:disabled { opacity: 0.55; cursor: not-allowed; }
@media (max-width: 900px) {
  .sw-workspace__fab { display: inline-flex; }
}

/* ─── AI Assist (sidebar) ───────────────────────────────────────────── */
.sw-ai-assist {
  background: linear-gradient(180deg, rgba(249,115,22,0.05), rgba(249,115,22,0.02));
  border: 1px solid rgba(249,115,22,0.2);
  border-radius: var(--sw-radius-lg);
  padding: 12px 14px;
  margin-bottom: 16px;
}
.sw-ai-assist__hdr {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
  font-size: 12.5px; font-weight: 600; color: var(--sw-text);
}
.sw-ai-assist__title { display: inline-flex; align-items: center; gap: 6px; color: var(--sw-spot-600); }
.sw-ai-assist__cost {
  margin-left: auto;
  font-size: 10.5px; font-weight: 500;
  color: var(--sw-text-subtle);
  background: rgba(249,115,22,0.08);
  padding: 2px 7px; border-radius: 9999px;
}
.sw-ai-assist__brief {
  width: 100%;
  padding: 8px 10px;
  font-family: inherit; font-size: 13px; line-height: 1.4;
  background: var(--sw-surface); border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius-md);
  resize: vertical; min-height: 56px;
  outline: none;
}
.sw-ai-assist__brief:focus { border-color: var(--sw-spot-500); box-shadow: 0 0 0 3px rgba(249,115,22,0.12); }
.sw-ai-assist__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sw-ai-assist__btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: var(--sw-spot-500); color: #fff;
  border: 0; border-radius: var(--sw-radius-md);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: background var(--sw-dur-fast);
}
.sw-ai-assist__btn:hover:not(:disabled) { background: var(--sw-spot-600); }
.sw-ai-assist__btn:disabled { opacity: 0.6; cursor: not-allowed; }
.sw-ai-assist__btn--secondary {
  background: transparent; color: var(--sw-spot-600);
  border: 1px solid rgba(249,115,22,0.3);
}
.sw-ai-assist__btn--secondary:hover:not(:disabled) { background: rgba(249,115,22,0.08); }
.sw-ai-assist__sep {
  height: 1px; background: var(--sw-border);
  margin: 0 0 16px;
}

.sw-upload {
  border: 2px dashed var(--sw-border-strong); background: var(--sw-surface);
  border-radius: var(--sw-radius-xl);
  padding: 40px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  text-align: center; cursor: pointer;
  transition: border-color var(--sw-dur-fast), background var(--sw-dur-fast), transform var(--sw-dur-fast);
}
.sw-upload:hover, .sw-upload.is-drag {
  border-color: var(--sw-brand-400); background: var(--sw-brand-50);
  transform: scale(1.005);
}
.sw-upload__icon { width: 56px; height: 56px; border-radius: 14px; background: var(--sw-bg-muted); display: grid; place-items: center; color: var(--sw-text-muted); }
.sw-upload h3 { font-size: 16px; margin: 0; font-weight: 600; }
.sw-upload p  { font-size: 13px; color: var(--sw-text-muted); margin: 0; }

.sw-step {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--sw-surface);
  border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius-md);
  margin-bottom: 8px;
  transition: all var(--sw-dur-base) var(--sw-ease-out);
}
.sw-step--current { border-color: var(--sw-brand-300); background: var(--sw-brand-50); box-shadow: var(--sw-shadow-glow); }
.sw-step--done    { border-color: var(--sw-success-500); }
.sw-step__num {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--sw-bg-muted); color: var(--sw-text-muted);
  display: grid; place-items: center; flex-shrink: 0;
  font-size: 12px; font-weight: 600;
}
.sw-step--current .sw-step__num { background: var(--sw-brand-500); color: #fff; }
.sw-step--done .sw-step__num    { background: var(--sw-success-500); color: #fff; }
.sw-step__body { flex: 1; min-width: 0; }
.sw-step__name { font-size: 13.5px; font-weight: 600; color: var(--sw-text); }
.sw-step__desc { font-size: 11.5px; color: var(--sw-text-subtle); margin-top: 2px; }
.sw-step__remove {
  width: 28px; height: 28px; border-radius: 6px;
  border: 0; background: transparent; color: var(--sw-text-subtle); cursor: pointer;
}
.sw-step__remove:hover { background: var(--sw-error-50); color: var(--sw-error-500); }

.sw-step-connector { display: flex; justify-content: center; height: 14px; margin: -4px 0 4px; }
.sw-step-connector span { width: 2px; height: 100%; background: var(--sw-border-strong); }
.sw-step-connector.is-done span { background: var(--sw-success-500); }

.sw-add-step {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 12px;
  border: 1px dashed var(--sw-border-strong); background: var(--sw-surface);
  border-radius: var(--sw-radius-md);
  font-size: 13px; font-weight: 500; color: var(--sw-text-muted);
  cursor: pointer; transition: all var(--sw-dur-fast);
}
.sw-add-step:hover { color: var(--sw-text); border-color: var(--sw-text); }

/* ─── Toasts ──────────────────────────────────────────────────────── */
.sw-toasts { position: fixed; top: 16px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.sw-toast {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--sw-ink-900); color: #fff;
  padding: 12px 14px;
  border-radius: var(--sw-radius-md);
  box-shadow: var(--sw-shadow-lg);
  min-width: 280px; max-width: 360px;
  position: relative; overflow: hidden;
  animation: sw-toast-in 250ms var(--sw-ease-out);
}
.sw-toast .corner { position: absolute; top: 0; right: 0; width: 8px; height: 8px; border-radius: 0 6px 0 8px; }
.sw-toast--success .corner { background: var(--sw-success-500); }
.sw-toast--error   .corner { background: var(--sw-error-500); }
.sw-toast--info    .corner { background: var(--sw-brand-500); }

/* ─── Animations ──────────────────────────────────────────────────── */
@keyframes sw-fade-in   { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes sw-slide-up  { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes sw-toast-in  { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes sw-pulse     { 0%, 100% { box-shadow: 0 0 0 0 rgba(20,184,166,.45); } 50% { box-shadow: 0 0 0 6px rgba(20,184,166,0); } }

/* ─── Side layout (cuenta/admin) ─────────────────────────────────── */
.sw-side {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
}
.sw-side > * { min-width: 0; }
.sw-side--narrow { grid-template-columns: 200px 1fr; }
@media (max-width: 800px) {
  .sw-side, .sw-side--narrow { grid-template-columns: 1fr; gap: 20px; }
}

/* KPIs cards genéricas: auto-fit responsive */
.sw-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
}
.sw-kpi-grid > * { min-width: 0; }

/* Tablas con scroll horizontal */
.sw-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.sw-table-wrap table { min-width: 540px; }

/* Evitar overflow horizontal global */
html, body { overflow-x: hidden; max-width: 100%; }

/* Skip link visible en focus */
.sr-only:focus, .sr-only:focus-visible {
  position: fixed !important;
  top: 12px; left: 12px;
  width: auto; height: auto;
  padding: 10px 14px;
  background: var(--sw-text); color: #fff;
  border-radius: var(--sw-radius-md);
  z-index: 1000;
  clip: auto; clip-path: none;
  white-space: nowrap;
  font-size: 14px;
}

/* ─── Cmd+K global ────────────────────────────────────────────────── */
.sw-cmdk { position: fixed; inset: 0; z-index: 95; display: flex; align-items: flex-start; justify-content: center; padding: 80px 16px 16px; }
.sw-cmdk__back { position: absolute; inset: 0; background: rgba(15,17,22,.5); backdrop-filter: blur(4px); }
.sw-cmdk__card { position: relative; width: 100%; max-width: 600px; background: var(--sw-surface); border-radius: var(--sw-radius-xl); box-shadow: var(--sw-shadow-xl); overflow: hidden; animation: sw-fade-in .2s; }
.sw-cmdk__head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--sw-border); }
.sw-cmdk__head input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 16px; color: var(--sw-text); font-family: inherit; }
.sw-cmdk__head kbd { font-family: var(--sw-font-mono); font-size: 11px; color: var(--sw-text-subtle); background: var(--sw-bg-muted); border: 1px solid var(--sw-border); border-radius: 4px; padding: 3px 6px; }
.sw-cmdk__results { max-height: 60vh; overflow-y: auto; padding: 6px; }
.sw-cmdk__row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; text-decoration: none; color: inherit; border-radius: var(--sw-radius-md); }
.sw-cmdk__row:hover { background: var(--sw-bg-muted); }
.sw-cmdk__row .ico { width: 32px; height: 32px; border-radius: 8px; background: var(--sw-bg-muted); display: grid; place-items: center; }
.sw-cmdk__row .meta { flex: 1; min-width: 0; }
.sw-cmdk__row .n { display: block; font-size: 14px; font-weight: 500; color: var(--sw-text); }
.sw-cmdk__row .c { display: block; font-size: 11.5px; color: var(--sw-text-subtle); }
.sw-cmdk__empty { padding: 30px; text-align: center; color: var(--sw-text-subtle); font-size: 13px; }

/* ─── Tool workspace · header + warning ──────────────────────────── */
.sw-tool-hdr {
  height: var(--sw-header-h);
  display: flex; align-items: center; gap: var(--sw-space-3);
  padding: 0 var(--sw-space-5);
  border-bottom: 1px solid var(--sw-border);
  background: rgba(255,255,255,.85);
  backdrop-filter: saturate(180%) blur(10px);
  position: sticky; top: 0; z-index: 30;
}
.sw-tool-back {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 10px; border-radius: var(--sw-radius-md);
  font-size: 12.5px; font-weight: 500; color: var(--sw-text-muted);
  text-decoration: none;
}
.sw-tool-back:hover { background: var(--sw-bg-muted); color: var(--sw-text); }
.sw-tool-back svg { transform: rotate(180deg); }
.sw-tool-title { flex: 1; min-width: 0; overflow: hidden; }
.sw-tool-title h1 { font-size: 18px; font-weight: 600; letter-spacing: -0.015em; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sw-tool-title p  { font-size: 12.5px; color: var(--sw-text-muted); margin: 1px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sw-tool-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
@media (max-width: 640px) {
  .sw-tool-hdr { padding: 0 var(--sw-space-3); gap: var(--sw-space-2); }
  .sw-tool-back span { display: none; }
  .sw-tool-title h1 { font-size: 15px; }
  .sw-tool-title p  { display: none; }
  .sw-tool-meta .sw-badge { display: none; }
  .sw-tool-meta [data-toggle-sidebar] span { display: none; }
}

.sw-warning {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; margin: 12px 16px 0;
  background: var(--sw-warning-50); color: #8a6200;
  border: 1px solid color-mix(in oklch, var(--sw-warning-500) 50%, var(--sw-warning-50));
  border-radius: var(--sw-radius-md); font-size: 13px; line-height: 1.5;
}
.sw-warning svg { flex-shrink: 0; margin-top: 2px; color: var(--sw-warning-500); }

/* ─── Texto: layout 2/3 columnas ─────────────────────────────────── */
.sw-text-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  flex: 1; min-height: 0;
}
.sw-text-grid.three { grid-template-columns: 1fr 1fr 1fr; }
.sw-text-grid.output-only { grid-template-columns: 1fr; }
.sw-text-grid.output-only .sw-text-panel textarea { min-height: 320px; }
@media (max-width: 1080px) {
  .sw-text-grid.output-only .sw-text-panel textarea { min-height: 360px; }
}
.sw-text-panel {
  display: flex; flex-direction: column;
  background: var(--sw-surface); border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius-lg); overflow: hidden;
}
.sw-text-panel__hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; border-bottom: 1px solid var(--sw-border);
  font-size: 11.5px; font-weight: 600; color: var(--sw-text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.sw-text-panel__hdr .sw-btn { text-transform: none; letter-spacing: normal; }
.sw-text-panel__accept {
  font-size: 10.5px; font-weight: 500;
  color: var(--sw-text-subtle);
  text-transform: none; letter-spacing: 0;
  background: var(--sw-bg-muted);
  padding: 2px 8px;
  border-radius: 9999px;
  margin-left: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
}
.sw-text-panel textarea::placeholder {
  color: var(--sw-text-subtle);
  font-style: normal;
  font-family: var(--sw-font-sans);
  font-size: 13px;
  line-height: 1.5;
}
.sw-text-panel textarea {
  flex: 1; border: 0; outline: 0; padding: 14px;
  resize: none; font-family: var(--sw-font-mono); font-size: 13px;
  color: var(--sw-text); background: transparent;
  min-height: 0; /* Permite que flex: 1 controle la altura */
}
.sw-text-panel__ftr {
  padding: 8px 14px; border-top: 1px solid var(--sw-border);
  font-size: 11px; color: var(--sw-text-subtle);
  font-family: var(--sw-font-mono);
}
@media (max-width: 800px) { .sw-text-grid { grid-template-columns: 1fr; }
  .sw-text-grid.three { grid-template-columns: 1fr; } }

/* ─── Upload zone con auto mode ──────────────────────────────────── */
.sw-upload {
  border: 2px dashed var(--sw-border-strong); background: var(--sw-surface);
  border-radius: var(--sw-radius-xl);
  padding: 36px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  text-align: center; cursor: pointer;
  transition: border-color var(--sw-dur-fast), background var(--sw-dur-fast), transform var(--sw-dur-fast);
  position: relative;
}
.sw-upload:focus { outline: none; border-color: var(--sw-brand-400); }
.sw-upload:hover, .sw-upload.is-drag {
  border-color: var(--sw-brand-400); background: var(--sw-brand-50);
}
.sw-upload__icon { width: 48px; height: 48px; border-radius: 12px; background: var(--sw-bg-muted); display: grid; place-items: center; color: var(--sw-text-muted); }
.sw-upload h3 { font-size: 16px; margin: 0; font-weight: 600; }
.sw-upload p  { font-size: 12.5px; color: var(--sw-text-muted); margin: 0; }
.sw-auto {
  position: absolute; right: 16px; top: 16px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; background: var(--sw-bg-muted);
  border-radius: var(--sw-radius-full);
  font-size: 11.5px; font-weight: 500; color: var(--sw-text-muted);
  cursor: pointer;
}
.sw-auto input { margin: 0; }
.sw-auto input:checked + span { color: var(--sw-text); }
.sw-auto__hint { display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; background: var(--sw-text-subtle); color: white; font-size: 9px; cursor: help; }

/* ─── File chips ─────────────────────────────────────────────────── */
.sw-files { display: flex; flex-wrap: wrap; gap: 8px; }
.sw-file {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 8px; background: var(--sw-bg-muted);
  border-radius: var(--sw-radius-md);
  font-size: 12px; color: var(--sw-text);
}
.sw-file__name { font-weight: 500; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sw-file__size { color: var(--sw-text-subtle); font-size: 11px; }
.sw-file__rm { width: 16px; height: 16px; border: 0; background: transparent; color: var(--sw-text-subtle); cursor: pointer; padding: 0; display: inline-grid; place-items: center; border-radius: 50%; }
.sw-file__rm:hover { background: var(--sw-error-500); color: #fff; }

/* ─── Progress ───────────────────────────────────────────────────── */
.sw-progress { height: 36px; background: var(--sw-bg-muted); border-radius: var(--sw-radius-md); position: relative; overflow: hidden; }
.sw-progress__fill { position: absolute; inset: 0; width: 0; background: linear-gradient(90deg, var(--sw-brand-500), var(--sw-success-500)); transition: width .3s; }
.sw-progress__text { position: relative; z-index: 1; font-size: 12px; font-weight: 600; color: var(--sw-text); display: flex; align-items: center; justify-content: center; height: 100%; }

/* ─── Preview ────────────────────────────────────────────────────── */
.sw-preview {
  flex: 1; min-height: 200px;
  background: var(--sw-bg-subtle); border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius-lg);
  display: flex; align-items: center; justify-content: center;
  padding: 18px; overflow: auto; flex-direction: column; gap: 16px;
}
.sw-preview__empty { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--sw-text-subtle); font-size: 13px; }
.sw-preview__empty p { margin: 0; }
.sw-preview__img { max-width: 100%; max-height: 60vh; object-fit: contain; border-radius: var(--sw-radius-md); }
.sw-result-list { display: flex; flex-direction: column; gap: 4px; width: 100%; max-width: 480px; }
.sw-result-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--sw-surface);
  border: 1px solid var(--sw-border); border-radius: var(--sw-radius-md);
  font-size: 13px; color: var(--sw-text); text-decoration: none;
}
.sw-result-row:hover { border-color: var(--sw-brand-300); background: var(--sw-brand-50); }
.sw-result-row span { flex: 1; }
.sw-result-row small { color: var(--sw-text-subtle); }

/* ─── Sidebar workflow ───────────────────────────────────────────── */
.sw-sidebar-eyebrow { font-size: 10.5px; color: var(--sw-text-subtle); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.sw-sidebar-title { font-size: 14px; font-weight: 600; margin-top: 2px; }
.sw-sidebar-close { display: none; background: 0; border: 0; color: var(--sw-text-muted); cursor: pointer; padding: 4px; }

.sw-ai-copilot { margin-bottom: 14px; }
.sw-ai-copilot__btn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 10px 12px;
  background: linear-gradient(135deg, color-mix(in oklch, var(--sw-spot-500) 8%, white), color-mix(in oklch, var(--sw-brand-500) 6%, white));
  border: 1px solid color-mix(in oklch, var(--sw-spot-500) 30%, var(--sw-border));
  border-radius: var(--sw-radius-md);
  font-size: 12.5px; font-weight: 500; color: var(--sw-spot-600);
  cursor: pointer; transition: all var(--sw-dur-fast);
}
.sw-ai-copilot__btn:hover { transform: translateY(-1px); box-shadow: var(--sw-shadow-sm); }

.sw-steps { display: flex; flex-direction: column; gap: 4px; }

.sw-step-card {
  background: var(--sw-surface); border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius-md);
  transition: border-color var(--sw-dur-fast), box-shadow var(--sw-dur-fast);
  position: relative;
}
.sw-step-card.is-current { border-color: var(--sw-brand-300); box-shadow: var(--sw-shadow-glow); }
.sw-step-card + .sw-step-card { margin-top: 8px; }
.sw-step-card + .sw-step-card::before {
  content: ''; position: absolute; top: -10px; left: 24px;
  width: 2px; height: 8px; background: var(--sw-border-strong);
}
.sw-step-card__hdr {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--sw-border);
}
.sw-step-card__num {
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--sw-bg-muted); color: var(--sw-text-muted);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.sw-step-card.is-current .sw-step-card__num { background: var(--sw-brand-500); color: #fff; }
.sw-step-card__icon { color: var(--sw-text-muted); }
.sw-step-card__name { flex: 1; font-size: 13px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sw-step-card__del {
  width: 24px; height: 24px; border: 0; background: transparent;
  color: var(--sw-text-subtle); cursor: pointer; border-radius: 6px;
  display: grid; place-items: center;
}
.sw-step-card__del:hover { background: var(--sw-error-50); color: var(--sw-error-500); }
.sw-step-card__body { padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; }
.sw-step-card__noopts { font-size: 11.5px; color: var(--sw-text-subtle); font-style: italic; }

/* ─── Opciones por paso ──────────────────────────────────────────── */
.sw-opt { display: flex; flex-direction: column; gap: 4px; }
.sw-opt__lbl {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11.5px; font-weight: 500; color: var(--sw-text-muted);
}
.sw-opt__val { font-family: var(--sw-font-mono); font-size: 11px; color: var(--sw-text); }
.sw-opt input[type="text"], .sw-opt input[type="number"], .sw-opt input[type="password"], .sw-opt select {
  width: 100%; padding: 6px 8px;
  background: var(--sw-surface); border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius-sm);
  font-family: inherit; font-size: 12.5px; color: var(--sw-text);
  outline: none; transition: border-color var(--sw-dur-fast);
}
.sw-opt input[type="text"]:focus, .sw-opt input[type="number"]:focus, .sw-opt input[type="password"]:focus, .sw-opt select:focus {
  border-color: var(--sw-brand-400); box-shadow: var(--sw-shadow-focus);
}
.sw-opt input[type="range"] { width: 100%; accent-color: var(--sw-brand-500); }
.sw-opt input[type="color"] { width: 36px; height: 28px; padding: 0; border: 1px solid var(--sw-border); border-radius: var(--sw-radius-sm); cursor: pointer; background: transparent; }
.sw-opt--check { display: flex; flex-direction: row; align-items: center; gap: 8px; cursor: pointer; }
.sw-opt--check input { accent-color: var(--sw-brand-500); }
.sw-opt--check span { font-size: 12.5px; color: var(--sw-text); }

.sw-opt-adv {
  margin-top: 4px; padding: 6px 8px;
  border: 1px dashed var(--sw-border); border-radius: var(--sw-radius-sm);
}
.sw-opt-adv summary { font-size: 11.5px; font-weight: 500; color: var(--sw-text-muted); cursor: pointer; user-select: none; }
.sw-opt-adv > .sw-opt, .sw-opt-adv > .sw-opt--check { margin-top: 8px; }

/* ─── Add step menu ──────────────────────────────────────────────── */
.sw-add-step-wrap { position: relative; margin-top: 12px; }
.sw-add-step {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 12px;
  border: 1px dashed var(--sw-border-strong); background: var(--sw-surface);
  border-radius: var(--sw-radius-md);
  font-size: 13px; font-weight: 500; color: var(--sw-text-muted);
  cursor: pointer; transition: all var(--sw-dur-fast);
}
.sw-add-step:hover { color: var(--sw-text); border-color: var(--sw-text); }

.sw-step-menu {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--sw-surface); border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius-md); box-shadow: var(--sw-shadow-lg);
  padding: 6px; z-index: 20; max-height: 320px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
.sw-step-menu button {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border: 0; background: transparent;
  border-radius: var(--sw-radius-sm); cursor: pointer; text-align: left;
}
.sw-step-menu button:hover { background: var(--sw-bg-muted); }
.sw-step-menu .ico { width: 28px; height: 28px; border-radius: 6px; background: var(--sw-bg-muted); color: var(--sw-text-muted); display: grid; place-items: center; flex-shrink: 0; }
.sw-step-menu .meta { flex: 1; min-width: 0; }
.sw-step-menu .n { display: block; font-size: 12.5px; font-weight: 600; color: var(--sw-text); }
.sw-step-menu .c { display: block; font-size: 11px; color: var(--sw-text-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Drag-reorder ───────────────────────────────────────────────── */
.sw-step-card[draggable="true"] { cursor: grab; }
.sw-step-card[draggable="true"]:active { cursor: grabbing; }
.sw-step-card.is-dragging { opacity: 0.4; }
.sw-step-card.drop-above { box-shadow: -2px -2px 0 0 var(--sw-brand-500), 2px -2px 0 0 var(--sw-brand-500); }
.sw-step-card.drop-below { box-shadow: -2px 2px 0 0 var(--sw-brand-500), 2px 2px 0 0 var(--sw-brand-500); }
.sw-step-card__grip { width: 14px; height: 14px; display: grid; place-items: center; color: var(--sw-text-subtle); flex-shrink: 0; }
.sw-step-card__grip--fixed { opacity: 0; }

/* ─── Comparador antes/después ───────────────────────────────────── */
.sw-compare { width: 100%; max-width: 720px; }
.sw-compare__viewport {
  position: relative; user-select: none; touch-action: none;
  width: 100%; aspect-ratio: 16/10;
  background: var(--sw-bg-strong);
  border-radius: var(--sw-radius-lg);
  overflow: hidden;
  cursor: ew-resize;
}
.sw-compare__viewport img { display: block; width: 100%; height: 100%; object-fit: contain; }
.sw-compare__after { position: absolute; inset: 0; }
.sw-compare__before-wrap {
  position: absolute; inset: 0; width: 50%; overflow: hidden;
  border-right: 2px solid #fff; box-shadow: 1px 0 4px rgba(0,0,0,.15);
}
.sw-compare__before-wrap img { width: calc(100% / 0.5); }
.sw-compare__handle {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 36px; transform: translateX(-50%);
  cursor: ew-resize; display: grid; place-items: center;
}
.sw-compare__handle::before {
  content: ''; position: absolute; top: 0; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 2px; background: #fff; box-shadow: 0 0 6px rgba(0,0,0,.4);
}
.sw-compare__handle span {
  position: relative; width: 36px; height: 36px; border-radius: 50%;
  background: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.25);
  display: grid; place-items: center;
}
.sw-compare__handle span::before, .sw-compare__handle span::after {
  content: ''; position: absolute; top: 50%; transform: translateY(-50%);
  width: 0; height: 0; border-style: solid;
}
.sw-compare__handle span::before { left: 8px;  border-width: 5px 6px 5px 0; border-color: transparent var(--sw-text) transparent transparent; }
.sw-compare__handle span::after  { right: 8px; border-width: 5px 0 5px 6px; border-color: transparent transparent transparent var(--sw-text); }
.sw-compare__tabs { display: flex; align-items: center; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.sw-compare__tabs button {
  padding: 6px 12px; border-radius: var(--sw-radius-full);
  border: 1px solid var(--sw-border); background: var(--sw-surface);
  font-size: 12.5px; font-weight: 500; color: var(--sw-text-muted);
  cursor: pointer;
}
.sw-compare__tabs button[aria-pressed="true"] { background: var(--sw-text); color: #fff; border-color: var(--sw-text); }
.sw-compare__dl {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--sw-radius-md);
  background: var(--sw-brand-500); color: #fff;
  font-size: 12.5px; font-weight: 500; text-decoration: none;
}
.sw-compare__dl:hover { background: var(--sw-brand-600); }

/* ─── Saved flows panel ─────────────────────────────────────────── */
.sw-saved-flows { margin-top: 24px; }
.sw-saved-flows__hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sw-saved-flows__list { display: flex; flex-direction: column; gap: 4px; }
.sw-saved-flows__empty { font-size: 11.5px; color: var(--sw-text-subtle); padding: 8px; text-align: center; }
.sw-saved-flow {
  display: flex; align-items: center; gap: 4px;
  background: var(--sw-bg-subtle); border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius-sm); padding: 2px;
}
.sw-saved-flow__load {
  flex: 1; display: flex; align-items: center; gap: 6px;
  border: 0; background: transparent;
  padding: 6px 8px; font-size: 12px; color: var(--sw-text);
  cursor: pointer; border-radius: var(--sw-radius-xs); text-align: left;
}
.sw-saved-flow__load:hover { background: var(--sw-bg-muted); }
.sw-saved-flow__del {
  width: 26px; height: 26px; border: 0; background: transparent;
  color: var(--sw-text-subtle); cursor: pointer; border-radius: 4px;
  display: grid; place-items: center;
}
.sw-saved-flow__del:hover { background: var(--sw-error-50); color: var(--sw-error-500); }

.sw-saved-flows-promo {
  margin-top: 24px; padding: 14px;
  border: 1px dashed var(--sw-border-strong); border-radius: var(--sw-radius-lg);
  background: var(--sw-bg-subtle);
}
.sw-saved-flows-promo p { font-size: 12.5px; color: var(--sw-text-muted); margin: 6px 0 10px; line-height: 1.5; }

/* ─── Modales ────────────────────────────────────────────────────── */
.sw-modal { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; }
.sw-modal[hidden] { display: none; }
.sw-modal__back { position: absolute; inset: 0; background: rgba(15,17,22,.5); backdrop-filter: blur(4px); animation: sw-fade-in .2s; }
.sw-modal__card { position: relative; background: var(--sw-surface); border-radius: var(--sw-radius-xl); width: 100%; max-width: 480px; box-shadow: var(--sw-shadow-xl); overflow: hidden; animation: sw-fade-in .25s var(--sw-ease-out); }
.sw-modal__hdr { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--sw-border); }
.sw-modal__hdr h2 { font-size: 16px; font-weight: 600; margin: 0; display: inline-flex; align-items: center; gap: 8px; }
.sw-modal__close { width: 28px; height: 28px; border: 0; background: transparent; color: var(--sw-text-muted); cursor: pointer; display: grid; place-items: center; border-radius: 6px; }
.sw-modal__close:hover { background: var(--sw-bg-muted); }
.sw-modal__body { padding: 20px; }
.sw-modal__body label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 500; color: var(--sw-text-muted); }
.sw-modal__body input[type="text"], .sw-modal__body textarea {
  margin-top: 4px; padding: 10px 12px;
  background: var(--sw-surface); border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius-md); font-size: 14px; font-family: inherit;
  outline: none; resize: vertical; color: var(--sw-text);
}
.sw-modal__body input[type="text"]:focus, .sw-modal__body textarea:focus {
  border-color: var(--sw-brand-400); box-shadow: var(--sw-shadow-focus);
}
.sw-modal__body textarea { min-height: 80px; }
.sw-modal__ftr { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--sw-border); background: var(--sw-bg-subtle); }
.sw-ai-result { margin-top: 16px; padding: 14px; background: var(--sw-bg-muted); border-radius: var(--sw-radius-md); }

/* ─── Responsive sidebar móvil ───────────────────────────────────── */
@media (max-width: 900px) {
  .sw-tool-meta button { display: inline-flex; }
  .sw-workspace__sidebar { transform: translateX(100%); transition: transform var(--sw-dur-base); }
  .sw-workspace__sidebar.is-open { transform: translateX(0); position: fixed; inset: 0; z-index: 70; border-left: 0; }
  .sw-sidebar-close { display: inline-flex; }
}
@media (min-width: 901px) {
  .sw-tool-meta [data-toggle-sidebar] { display: none; }
}

/* ─── Categoría helper class ──────────────────────────────────────── */
.cat-color  { --sw-cat-color: var(--sw-fam-color); }
.cat-asset  { --sw-cat-color: var(--sw-fam-asset); }
.cat-web    { --sw-cat-color: var(--sw-fam-web); }
.cat-datos  { --sw-cat-color: var(--sw-fam-datos); }

/* ─── Footer ecosystem cross-link ─────────────────────────── */
.sw-footer__eco {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 12.5px;
  color: var(--sw-text-subtle);
  padding: 8px 0;
}
.sw-footer__eco-label { color: var(--sw-text-subtle); font-weight: 500; }
.sw-footer__eco a { color: var(--sw-text-muted); font-weight: 500; }
.sw-footer__eco a:hover { color: var(--sw-brand); }

/* ─── DEVTOOLS CUSTOM VIEWPORT AUDIT FIX ──────────────────────────────────── */
/* Reduce bottom padding en custom tool views para evitar scroll vertical innecesario
   en pantallas desktop 1920x1080. Todas las tools custom usan .{tool}-page { padding: 48px 0 96px; }
   El 96px inferior era excesivo. Se reduce a 32px para 1920x1080, y se mantiene responsivo. */

body.page-tool main {
  display: contents;
  /* Asegura que el workspace custom no tenga restricciones de overflow */
}

/* Base64 */
.b64-page { padding: 48px 0 32px; }
@media (max-width: 1080px) { .b64-page { padding: 48px 0 24px; } }

/* Color Converter */
.cc-page { padding: 48px 0 32px; }
@media (max-width: 1080px) { .cc-page { padding: 48px 0 24px; } }

/* Contraste WCAG */
.ct-page { padding: 48px 0 32px; }
@media (max-width: 1080px) { .ct-page { padding: 48px 0 24px; } }

/* Data URI */
.du-page { padding: 48px 0 32px; }
@media (max-width: 1080px) { .du-page { padding: 48px 0 24px; } }

/* Favicon */
.fav-page { padding: 48px 0 32px; }
@media (max-width: 1080px) { .fav-page { padding: 48px 0 24px; } }

/* Gradient */
.grad-page { padding: 48px 0 32px; }
@media (max-width: 1080px) { .grad-page { padding: 48px 0 24px; } }

/* Hash */
.hash-page { padding: 48px 0 32px; }
@media (max-width: 1080px) { .hash-page { padding: 48px 0 24px; } }

/* Lorem Ipsum */
.li-page { padding: 48px 0 32px; }
@media (max-width: 1080px) { .li-page { padding: 48px 0 24px; } }

/* Minify */
.min-page { padding: 48px 0 32px; }
@media (max-width: 1080px) { .min-page { padding: 48px 0 24px; } }

/* Paleta Color */
.pal-page { padding: 48px 0 32px; }
@media (max-width: 1080px) { .pal-page { padding: 48px 0 24px; } }

/* QR Code - especial porque tiene mapa Leaflet y más secciones */
.qr-page { padding: 48px 0 32px; }
@media (max-width: 1080px) { .qr-page { padding: 48px 0 24px; } }
/* El mapa de Leaflet es fijo 280px: respeta su altura sin scroll */

/* Regex - sidebar de 28 patterns */
.rx-page { padding: 48px 0 32px; }
@media (max-width: 1080px) { .rx-page { padding: 48px 0 24px; } }
/* Sidebar .rx-lib tiene max-height 380px con scroll interno: aceptable */

/* URL Encode */
.ue-page { padding: 48px 0 32px; }
@media (max-width: 1080px) { .ue-page { padding: 48px 0 24px; } }

/* Compresion de secciones secundarias (FAQ, export, etc.) en custom views */
.pal-export { margin-top: 20px; }
.pal-export__pre { max-height: 240px; }

.qr-ai { margin-bottom: 14px; padding: 12px 14px; }
.qr-geo-map { height: 240px; }

.rx-lib { max-height: 340px; }

/* Asegurar que cards y sections respeten limites de altura */
.b64-card, .cc-card, .ct-card, .du-card, .fav-card, .grad-card,
.hash-card, .li-card, .min-card, .pal-card, .qr-card, .rx-side-card,
.ue-card {
  overflow: visible; /* No forzar overflow interno */
}

/* Textareas y inputs dentro de custom tools: no forzar min-height excesiva */
.b64-card textarea, .cc-card textarea, .ct-card textarea,
.du-card textarea, .fav-card textarea, .grad-card textarea,
.hash-card textarea, .li-card textarea, .min-card textarea,
.pal-card textarea, .qr-card textarea, .rx-card textarea,
.ue-card textarea {
  min-height: auto;
  height: auto;
}

.qr-form textarea { min-height: 80px; }
.rx-text-grid textarea { min-height: 200px; }

/* En pantallas < 1080px, permitir scroll vertical si es necesario
   (tools muy complejas como QR con mapa pueden necesitar scroll) */
@media (max-width: 1080px) {
  section.qr-page,
  section.pal-page,
  section.rx-page {
    max-height: calc(100dvh - var(--sw-header-h));
    overflow-y: auto;
  }
}
