/* ==========================================================================
   RSS Generator Studio — design system DDS, dirección "manifiesto".
   Mismo lenguaje visual que Criterio: Bricolage Grotesque display,
   Space Grotesk cuerpo, Space Mono para TODA etiqueta/meta/botón, crema
   #E9E5D7 + acento #FF3D11, esquinas cuadradas (radio 0), filos hairline
   de 1px, sin sombras ni degradados. El acento es el único ornamento.
   ========================================================================== */

:root {
  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-body: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'Space Mono', ui-monospace, monospace;
  --fw-display: 700;

  --surface: #E9E5D7;
  --ink: #0E0E0C;
  --muted: #56524A;
  --line: #0E0E0C;
  --accent: #FF3D11;
  --accent-on: #0E0E0C;
  --tint: rgba(255, 61, 17, .08);

  --fs-sm: 15px;
  --fs-meta: 13px;
  --lh-body: 1.58;
  --ls-tight: -.01em;
  --ls-display: -.02em;
  --lh-tight: .94;
  --lh-snug: 1.05;
  --ls-meta: .04em;
}

/* Pane "deep": la inversión oscura, la misma que Criterio usa en sus toasts. */
[data-theme="dark"] {
  --surface: #0E0E0C;
  --ink: #E9E5D7;
  --muted: #918E84;
  --line: #E9E5D7;
  --accent: #FF3D11;
  --accent-on: #0E0E0C;
  --tint: rgba(255, 255, 255, .05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-sm);
  line-height: var(--lh-body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

button, input, select, textarea { font-family: var(--font-body); }

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

::selection { background: var(--accent); color: var(--accent-on); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  letter-spacing: var(--ls-display);
  line-height: var(--lh-snug);
}

/* ==========================================================================
   Cabecera
   ========================================================================== */
.app-header {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 16px 26px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 30;
}

.logo-group { display: flex; align-items: center; gap: 12px; cursor: pointer; }

.logo-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--accent);
  flex-shrink: 0;
}

.logo-text { display: flex; flex-direction: column; }

.brand-title {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: 22px;
  letter-spacing: var(--ls-tight);
  line-height: 1;
}

.brand-title .highlight { color: var(--accent); }

.brand-sub {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 5px;
}

.header-status { margin-left: auto; }

.server-pill,
.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 7px 12px;
  white-space: nowrap;
}

.server-pill .dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  flex-shrink: 0;
}

/* El latido del punto de acento: el único movimiento de la interfaz. */
.server-pill.pulse .dot { animation: latido 2.4s ease-in-out infinite; }

@keyframes latido {
  0%, 100% { opacity: 1; }
  50% { opacity: .25; }
}

.user-pill.green { color: var(--ink); }

.user-pill button {
  background: transparent;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  line-height: 1;
}

.header-actions { display: flex; align-items: center; gap: 10px; }

.btn-theme-toggle {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.btn-theme-toggle:hover { background: var(--tint); }

.badge-live {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 1px 6px;
}

/* ==========================================================================
   Armazón: barra lateral + contenido
   ========================================================================== */
.app-layout { display: flex; align-items: flex-start; }

.app-sidebar {
  width: 230px;
  flex-shrink: 0;
  border-right: 1px solid var(--line);
  padding: 26px 22px 30px;
  display: flex;
  flex-direction: column;
  gap: 30px;
  position: sticky;
  top: 67px;
  align-self: stretch;
  min-height: calc(100vh - 67px);
}

.nav-section-title {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.nav-menu { display: flex; flex-direction: column; }

.nav-item {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .08em;
  text-decoration: none;
  color: var(--muted);
  padding: 11px 4px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.nav-menu .nav-item:last-child { border-bottom: 1px solid var(--line); }

.nav-item:hover { color: var(--ink); }

.nav-item.active {
  color: var(--ink);
  background: var(--tint);
}

.nav-icon { flex-shrink: 0; font-size: 12px; }

.app-content {
  flex: 1;
  min-width: 0;
  max-width: 1010px;
  padding: 30px 40px 90px;
}

.content-section { display: none; }
.content-section.active { display: block; }

/* ==========================================================================
   Cabeceras de sección
   ========================================================================== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.section-header h2 {
  font-size: clamp(28px, 3.2vw, 40px);
  line-height: var(--lh-tight);
  margin: 0;
  text-wrap: balance;
}

.section-desc {
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  letter-spacing: var(--ls-meta);
  color: var(--muted);
  margin-top: 8px;
  max-width: 62ch;
}

.card-subtitle {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 16px;
  max-width: 70ch;
}

/* Buscador */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  padding: 0 12px;
}

.search-icon { color: var(--muted); font-size: 12px; }

.search-box input {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--ink);
  background: transparent;
  border: 0;
  padding: 11px 0;
  width: 210px;
}

.search-box input::placeholder { color: var(--muted); }
.search-box input:focus { outline: none; }
.search-box:focus-within { border-color: var(--accent); }

/* ==========================================================================
   Botones
   ========================================================================== */
.btn {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  background: var(--accent);
  color: var(--accent-on);
  border: 1px solid var(--accent);
  padding: 10px 18px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.btn:hover { opacity: .88; }

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}

.btn-secondary:hover { background: var(--tint); opacity: 1; }

.btn-success {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}

.btn-sm { padding: 8px 13px; font-size: 11px; }
.btn-xs { padding: 6px 10px; font-size: 10px; letter-spacing: .08em; }
.btn-lg { padding: 13px 24px; }
.btn-block { width: 100%; }

.btn:disabled { opacity: .5; cursor: default; }

.btn .icon { font-size: 12px; line-height: 1; }

.btn-danger-icon {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 7px 10px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}

.btn-danger-icon:hover { border-color: var(--accent); color: var(--accent); }

/* ==========================================================================
   Panel "a un vistazo" (métricas)
   ========================================================================== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 26px;
}

.metric-card {
  padding: 16px 18px 14px;
  border-right: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.metric-card:last-child { border-right: 0; }

/* El icono queda como apunte discreto, no como pastilla de color. */
.metric-icon {
  font-size: 12px;
  line-height: 1;
  flex-shrink: 0;
  filter: grayscale(1);
  opacity: .5;
}

.metric-info {
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  min-width: 0;
}

.metric-value {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: 24px;
  line-height: 1;
}

.metric-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
}

/* En el manifiesto no hay paleta secundaria: el acento marca lo primero. */
.metric-card:first-child .metric-value { color: var(--accent); }

/* ==========================================================================
   Rejilla de feeds
   ========================================================================== */
.feeds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.feed-card {
  border: 1px solid var(--line);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
}

.feed-card:hover { background: var(--tint); }

.feed-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.feed-icon-box {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  font-size: 14px;
  flex-shrink: 0;
}

.feed-category-tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 1px 6px;
}

.feed-title {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: 19px;
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-tight);
  margin: 0 0 6px;
}

.feed-title a:hover { color: var(--accent); }

.feed-desc {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  max-width: 62ch;
}

.feed-meta-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.feed-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.btn-feed-link { padding: 7px 11px; font-size: 10px; letter-spacing: .08em; }

/* ==========================================================================
   Estudio generador (wizard)
   ========================================================================== */
.wizard-card {
  border: 1px solid var(--line);
  padding: 26px 28px;
}

.wizard-step-title {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}

.step-num {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .1em;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--accent);
  color: var(--accent);
  flex-shrink: 0;
}

.wizard-step-title h3 {
  font-size: 19px;
  letter-spacing: var(--ls-tight);
  margin: 0 0 4px;
}

.wizard-step-title p {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: var(--ls-meta);
  color: var(--muted);
  margin: 0;
}

.source-types-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 12px;
}

.source-card {
  border: 1px solid var(--line);
  padding: 16px 18px;
  cursor: pointer;
}

.source-card:hover { background: var(--tint); }

.source-card.active {
  background: var(--tint);
  box-shadow: inset 3px 0 0 var(--accent);
}

.source-icon { font-size: 18px; line-height: 1; margin-bottom: 10px; }

.source-card h4 {
  font-size: 15px;
  letter-spacing: var(--ls-tight);
  margin: 0 0 5px;
}

.source-card p {
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  margin: 0;
}

.wizard-form-group { margin-top: 16px; }

.url-input-group { display: flex; gap: 10px; flex-wrap: wrap; }

.url-input-group input {
  flex: 1;
  min-width: 240px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  padding: 11px 14px;
}

.url-input-group input::placeholder { color: var(--muted); }

.wizard-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

/* Configuración avanzada plegable */
.advanced-selectors-details {
  border: 1px solid var(--line);
  margin-top: 16px;
}

.advanced-summary {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

.advanced-summary::-webkit-details-marker { display: none; }
.advanced-summary:hover { background: var(--tint); }

.advanced-selectors-details[open] .advanced-summary { border-bottom: 1px solid var(--line); }

.selectors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
  padding: 18px;
}

/* Campos de formulario */
.form-field { display: flex; flex-direction: column; gap: 6px; }

.form-field label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.form-field input,
.form-field select,
.form-field textarea {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  padding: 9px 11px;
  width: 100%;
}

.form-field input::placeholder,
.form-field textarea::placeholder { color: var(--muted); }

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ==========================================================================
   Vista previa de extracción
   ========================================================================== */
.preview-header {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 24px 0 10px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.preview-box {
  border: 1px solid var(--line);
  max-height: 420px;
  overflow-y: auto;
}

.extracted-item {
  display: flex;
  gap: 14px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
}

.extracted-item:last-child { border-bottom: 0; }
.extracted-item:hover { background: var(--tint); }

.extracted-img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.extracted-info { flex: 1; min-width: 0; }

.extracted-info h4 {
  font-size: 15px;
  line-height: 1.35;
  letter-spacing: var(--ls-tight);
  margin: 0 0 4px;
}

.extracted-info p {
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  margin: 0;
}

.extracted-info a { color: var(--accent); text-decoration: none; }
.extracted-info a:hover { text-decoration: underline; }

/* ==========================================================================
   Estado vacío
   ========================================================================== */
.empty-state {
  border: 1px dashed var(--line);
  padding: 34px 22px;
  text-align: center;
  color: var(--muted);
}

.empty-icon {
  font-size: 26px;
  display: block;
  margin-bottom: 12px;
  filter: grayscale(1);
  opacity: .6;
}

.empty-state h3 {
  font-size: 18px;
  color: var(--ink);
  letter-spacing: var(--ls-tight);
  margin: 0 0 6px;
}

.empty-state p { font-size: 14px; margin: 0; }

/* ==========================================================================
   Bloques de código
   ========================================================================== */
.code-block-wrapper { position: relative; }

.code-block,
.code-box,
.modal-code-box {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--tint);
  border: 1px solid var(--line);
  padding: 16px 18px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.modal-code-box { max-height: 52vh; overflow-y: auto; }

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 5px 10px;
  cursor: pointer;
}

.copy-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ==========================================================================
   Modales
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 14, 12, .55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 60;
}

.modal-overlay.active { display: flex; }

.modal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  width: 100%;
  max-width: 720px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.modal-header h3 {
  font-size: 19px;
  letter-spacing: var(--ls-tight);
  margin: 0;
}

.modal-close {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.modal-close:hover { color: var(--accent); }

.modal-body { padding: 22px; overflow-y: auto; }

.modal-footer {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
}

/* Pestañas de acceso */
.auth-tabs {
  display: flex;
  border: 1px solid var(--line);
  margin-bottom: 20px;
}

.auth-tabs .btn {
  flex: 1;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}

.auth-tabs .btn:last-child { border-right: 0; }

.auth-tabs .btn.active {
  background: var(--ink);
  color: var(--surface);
}

/* ==========================================================================
   Widgets embebibles
   ========================================================================== */
.widgets-builder-layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  gap: 18px;
  align-items: start;
}

.widget-controls-card,
.widget-preview-card {
  border: 1px solid var(--line);
  padding: 22px 24px;
}

.widget-controls-card h3,
.widget-preview-card h3 {
  font-size: 17px;
  letter-spacing: var(--ls-tight);
  margin: 0 0 14px;
}

.widget-controls { display: flex; flex-direction: column; gap: 16px; }

.layout-options { display: flex; gap: 8px; flex-wrap: wrap; }

.btn-layout {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 8px 14px;
  cursor: pointer;
}

.btn-layout:hover { background: var(--tint); }

.btn-layout.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-on);
}

.iframe-wrapper {
  border: 1px solid var(--line);
  overflow: hidden;
  background: var(--surface);
}

.iframe-wrapper iframe { display: block; width: 100%; border: 0; }

/* ==========================================================================
   VPS
   ========================================================================== */
.vps-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  align-items: start;
}

.vps-card {
  border: 1px solid var(--line);
  padding: 22px 24px;
}

.vps-card h3 {
  font-size: 18px;
  letter-spacing: var(--ls-tight);
  margin: 0 0 6px;
}

.vps-features-list { list-style: none; margin: 14px 0 0; padding: 0; }

.feature-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.feature-item:last-child { border-bottom: 0; }

.check-icon { color: var(--accent); flex-shrink: 0; font-size: 12px; }

.vps-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* ==========================================================================
   Avisos (toasts) — pane deep, como en Criterio
   ========================================================================== */
.toast-container {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  z-index: 70;
  max-width: min(92vw, 560px);
  pointer-events: none;
}

.toast {
  background: #0E0E0C;
  color: #E9E5D7;
  border: 1px solid #E9E5D7;
  padding: 13px 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .05em;
  pointer-events: auto;
  animation: entrar .22s ease;
}

@keyframes entrar {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.toast-success,
.toast-warning { border-color: var(--accent); }

.toast-error { border-color: var(--accent); color: #FF3D11; }

@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
  .server-pill.pulse .dot { animation: none; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Tablet: la barra lateral pasa a barra superior. */
@media (max-width: 900px) {
  /* Entre 640 y 900 el logo, el estado y los tres botones ya no caben en una
     línea: el estado baja a la suya y los botones se reparten el ancho. */
  .app-header { flex-wrap: wrap; gap: 12px 16px; padding: 12px 16px; }
  .header-status { margin-left: 0; order: 3; width: 100%; }
  .server-pill { width: 100%; justify-content: center; }
  .header-actions { margin-left: auto; flex-wrap: wrap; }

  .app-layout { display: block; }

  .app-sidebar {
    width: auto;
    min-height: 0;
    flex-direction: row;
    align-items: center;
    gap: 18px;
    padding: 10px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    position: sticky;
    top: 67px;
    z-index: 25;
    background: var(--surface);
  }

  .nav-section { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
  .nav-section-title { margin-bottom: 0; white-space: nowrap; }
  .nav-menu { flex-direction: row; }

  .nav-item {
    border-top: 0;
    padding: 9px 10px;
    white-space: nowrap;
  }

  .nav-menu .nav-item:last-child { border-bottom: 0; }

  .app-content { padding: 22px 16px 80px; }

  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .metric-card:nth-child(2) { border-right: 0; }
  .metric-card:nth-child(-n+2) { border-bottom: 1px solid var(--line); }

  .widgets-builder-layout { grid-template-columns: 1fr; }
}

/* Móvil */
@media (max-width: 640px) {
  .app-header { padding: 12px 14px; }

  .header-actions { width: 100%; }
  .header-actions .btn { flex: 1; }

  .app-sidebar { top: 0; }

  .app-content { padding: 18px 14px 70px; }

  .section-header { flex-direction: column; align-items: stretch; gap: 14px; }
  .search-box input { width: 100%; }

  .metrics-grid { grid-template-columns: 1fr; }
  .metric-card { border-right: 0; border-bottom: 1px solid var(--line); }
  .metric-card:last-child { border-bottom: 0; }

  .feeds-grid { grid-template-columns: 1fr; }

  .wizard-card { padding: 18px 16px; }
  .source-types-grid { grid-template-columns: 1fr; }
  .url-input-group input { min-width: 0; width: 100%; }
  .url-input-group .btn { width: 100%; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .selectors-grid { grid-template-columns: 1fr; padding: 14px; }

  .feed-actions .btn-feed-link { flex: 1; }

  .vps-card,
  .widget-controls-card,
  .widget-preview-card { padding: 16px 14px; }

  .modal-card { max-height: 92vh; }
  .modal-body { padding: 16px; }

  .toast-container { left: 14px; right: 14px; bottom: 16px; transform: none; max-width: none; }
  .toast { width: 100%; }

  /* 16px en todo campo editable: por debajo, iOS Safari hace zoom al enfocar. */
  .search-box input,
  .url-input-group input,
  .form-field input,
  .form-field select,
  .form-field textarea { font-size: 16px; }
}
