/* ============================================================
   Bot de preguntas MercadoLibre (/ml_bot) — "Centro de respuestas"
   Mesa de servicio mobile-first: barra de comando oscura, señalética
   ámbar, tarjetas-conversación y acciones con targets táctiles ≥44px.
   Tipografía display: Barlow Condensed (rótulos y contadores).
   ============================================================ */

.mlb {
  --mlb-ink: #0b1220;
  --mlb-ink-2: #131e33;
  --mlb-amber: #f59e0b;
  --mlb-amber-deep: #b45309;
  --mlb-yellow: #ffe600;
  --mlb-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --mlb-st-pending: #94a3b8;
  --mlb-st-suggested: #2563eb;
  --mlb-st-sent: #16a34a;
  --mlb-st-failed: #dc2626;
  --mlb-st-skipped: #94a3b8;
  --mlb-st-answered: #0d9488;
  --mlb-st-closed: #94a3b8;
  max-width: 920px;
  margin-inline: auto;
  padding-bottom: 3rem;
}

/* ── Botonería del módulo (táctil: mínimo 44px de alto) ─────── */

.mlb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: 10px;
  font: 600 0.875rem/1.2 inherit;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.mlb-btn:active { transform: translateY(1px) scale(0.99); }

.mlb-btn--primary {
  background: linear-gradient(135deg, var(--mlb-yellow) 0%, #fbbf24 55%, var(--mlb-amber) 100%);
  color: #422006;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.35);
}
.mlb-btn--primary:hover { box-shadow: 0 4px 16px rgba(245, 158, 11, 0.45); }

.mlb-btn--hero {
  background: linear-gradient(135deg, var(--mlb-yellow) 0%, #fbbf24 55%, var(--mlb-amber) 100%);
  color: #422006;
  font-weight: 700;
  box-shadow: 0 2px 12px rgba(255, 230, 0, 0.25);
}

.mlb-btn--ghost {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
  color: #e2e8f0;
}
.mlb-btn--ghost:hover { background: rgba(255, 255, 255, 0.12); }

.mlb-btn--soft {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text);
}
.mlb-btn--soft:hover { border-color: #94a3b8; }

.mlb-btn--danger { color: var(--color-danger); }
.mlb-btn--danger:hover { border-color: var(--color-danger); background: #fef2f2; }

.mlb-btn:focus-visible,
.mlb-stat:focus-visible,
.mlb-textarea:focus-visible {
  outline: 2px solid var(--mlb-amber);
  outline-offset: 2px;
}

/* button_to envuelve en <form>: que no rompa los layouts flex/grid */
.mlb-hero-actions form,
.mlb-ghost-actions form,
.mlb-panel-item form,
.mlb-buyer-banner form { display: contents; }

/* ── Barra de comando (hero) ────────────────────────────────── */

.mlb-hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 1rem;
  padding: 0.9rem 1rem 0.8rem;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(130% 170% at 100% 0%, rgba(255, 230, 0, 0.12), transparent 46%),
    linear-gradient(160deg, #14213a 0%, var(--mlb-ink) 55%, var(--mlb-ink-2) 100%);
  color: #cbd5e1;
}

.mlb-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 9px);
  pointer-events: none;
}

.mlb-hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--mlb-yellow), var(--mlb-amber) 45%, transparent 90%);
}

.mlb-hero > * { position: relative; }

.mlb-hero-grid { display: flex; flex-direction: column; gap: 0.9rem; }

.mlb-hero-kicker {
  margin: 0 0 0.15rem;
  font-family: var(--mlb-display);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mlb-yellow);
}

.mlb-hero-title {
  margin: 0;
  font-family: var(--mlb-display);
  font-size: clamp(1.4rem, 5vw, 1.85rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.05;
  color: #f8fafc;
}

.mlb-hero-sub { margin: 0.35rem 0 0; font-size: 0.85rem; color: #94a3b8; }
.mlb-hero-sub strong { color: #e2e8f0; }

.mlb-hero-actions { display: flex; flex-direction: column; gap: 0.5rem; }

.mlb-signals {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  margin: 0.65rem 0 0;
  padding: 0.55rem 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  list-style: none;
}

/* Las señales son links a donde se arregla cada cosa (/settings, /bot_config,
   la tienda); heredan el color de su estado. */
.mlb-signal-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: inherit;
  text-decoration: none;
}
.mlb-signal:hover { border-color: rgba(255, 255, 255, 0.35); }
.mlb-signal-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.mlb-signal {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  font-size: 0.72rem;
  color: #94a3b8;
  white-space: nowrap;
}

.mlb-signal::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #64748b;
  flex: none;
}

.mlb-signal--on { color: #d1fae5; }
.mlb-signal--on::before {
  background: #4ade80;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.45);
  animation: mlb-pulse 2.4s ease-out infinite;
}

.mlb-signal--warn { color: #fde68a; border-color: rgba(251, 191, 36, 0.35); }
.mlb-signal--warn::before { background: #fbbf24; }

.mlb-signal--auto { color: #bfdbfe; }
.mlb-signal--auto::before { background: #60a5fa; }

@keyframes mlb-pulse {
  70% { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

.mlb-hero-warn {
  margin: 0.75rem 0 0;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  background: rgba(251, 191, 36, 0.12);
  border: 1px dashed rgba(251, 191, 36, 0.4);
  font-size: 0.8rem;
  color: #fde68a;
}
.mlb-hero-warn a { color: var(--mlb-yellow); }

/* ── Tablero de estados (sticky, scroll horizontal) ─────────── */

.mlb-stats {
  position: sticky;
  top: var(--topbar-height);
  z-index: 40;
  display: flex;
  gap: 0.4rem;
  margin: 0 0 0.9rem;
  padding: 0.5rem 0.15rem 0.6rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: linear-gradient(var(--color-bg) 80%, rgba(241, 245, 249, 0));
}
.mlb-stats::-webkit-scrollbar { display: none; }

.mlb-stat {
  scroll-snap-align: start;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 92px;
  padding: 0.5rem 0.75rem 0.45rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, transform 0.08s ease;
}
.mlb-stat:active { transform: scale(0.97); }

.mlb-stat-num {
  font-family: var(--mlb-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

.mlb-stat-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.mlb-stat-label::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mlb-amber);
  flex: none;
}

.mlb-stat--pending   .mlb-stat-label::before { background: var(--mlb-st-pending); }
.mlb-stat--suggested .mlb-stat-label::before { background: var(--mlb-st-suggested); }
.mlb-stat--sent      .mlb-stat-label::before { background: var(--mlb-st-sent); }
.mlb-stat--skipped   .mlb-stat-label::before { background: var(--mlb-st-skipped); }
.mlb-stat--failed    .mlb-stat-label::before { background: var(--mlb-st-failed); }
.mlb-stat--answered  .mlb-stat-label::before { background: var(--mlb-st-answered); }
.mlb-stat--closed    .mlb-stat-label::before { background: var(--mlb-st-closed); }

.mlb-stat--active {
  background: var(--mlb-ink);
  border-color: var(--mlb-ink);
}
.mlb-stat--active .mlb-stat-num { color: #fff; }
.mlb-stat--active .mlb-stat-label { color: var(--mlb-yellow); }

/* ── Banner del hilo por comprador ──────────────────────────── */

.mlb-buyer-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
  padding: 0.75rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--mlb-amber);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.mlb-buyer-banner-info {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
  flex: 1;
}
.mlb-buyer-banner-info strong { font-size: 0.95rem; }
.mlb-buyer-banner-info span { font-size: 0.75rem; color: var(--color-text-muted); }

/* ── Avatar del comprador ───────────────────────────────────── */

.mlb-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--mlb-yellow), var(--mlb-amber));
  color: #422006;
  font-family: var(--mlb-display);
  font-size: 1rem;
  font-weight: 700;
  flex: none;
}
.mlb-avatar--lg { width: 42px; height: 42px; font-size: 1.2rem; }
.mlb-avatar--anon { background: #e2e8f0; color: var(--color-text-muted); }

/* ── Lista y tarjetas ───────────────────────────────────────── */

.mlb-list { display: flex; flex-direction: column; gap: 0.8rem; }

.mlb-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.85rem 0.95rem 0.95rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--mlb-st-pending);
  border-radius: 14px;
  box-shadow: var(--shadow);
  animation: mlb-rise 0.4s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.mlb-list .mlb-card:nth-child(2) { animation-delay: 0.05s; }
.mlb-list .mlb-card:nth-child(3) { animation-delay: 0.1s; }
.mlb-list .mlb-card:nth-child(4) { animation-delay: 0.15s; }
.mlb-list .mlb-card:nth-child(5) { animation-delay: 0.2s; }
.mlb-list .mlb-card:nth-child(n+6) { animation-delay: 0.25s; }

@keyframes mlb-rise {
  from { opacity: 0; transform: translateY(10px); }
}

.mlb-card--pending   { border-left-color: var(--mlb-st-pending); }
.mlb-card--suggested { border-left-color: var(--mlb-st-suggested); }
.mlb-card--sent      { border-left-color: var(--mlb-st-sent); }
.mlb-card--failed    { border-left-color: var(--mlb-st-failed); }
.mlb-card--answered  { border-left-color: var(--mlb-st-answered); }
.mlb-card--skipped,
.mlb-card--closed    { border-left-color: var(--mlb-st-closed); opacity: 0.82; }

/* ── Cabecera: publicación + estado ─────────────────────────── */

.mlb-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
}

.mlb-listing { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }

.mlb-listing-kicker {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}

.mlb-listing-title {
  font-size: 0.95rem;
  font-weight: 650;
  line-height: 1.3;
  color: var(--color-text);
  text-decoration: none;
  overflow-wrap: anywhere;
}
a.mlb-listing-title:hover { color: var(--color-primary); }
.mlb-listing-title--unlinked { color: var(--color-text-muted); font-style: italic; font-weight: 500; }

.mlb-listing-meta { font-size: 0.72rem; color: var(--color-text-muted); overflow-wrap: anywhere; }

.mlb-ext { color: var(--color-primary); text-decoration: none; white-space: nowrap; }
.mlb-ext:hover { text-decoration: underline; }

.mlb-card-state {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  flex: none;
}

.mlb-state-row { display: inline-flex; align-items: center; gap: 0.45rem; }

/* Checkbox de lote: solo visible dentro del wrapper ml-select de la bandeja
   (en la vista de hilo o un replace suelto quedaría inerte → se oculta). */
.mlb-check {
  display: none;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--mlb-amber);
  cursor: pointer;
}
[data-controller~="ml-select"] .mlb-check { display: inline-block; }

/* Tarjeta ocupada: cualquier form en vuelo (Turbo marca aria-busy) atenúa
   la tarjeta mientras DeepSeek / ML responden. */
.mlb-card:has(form[aria-busy="true"]) { opacity: 0.6; pointer-events: none; }

/* Aviso accesible del contador (visualmente oculto) */
.mlb-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.mlb-time { font-size: 0.7rem; color: var(--color-text-muted); white-space: nowrap; }

.mlb-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  font-family: var(--mlb-display);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.mlb-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.mlb-pill--pending   { background: #f1f5f9; color: #475569; }
.mlb-pill--suggested { background: #dbeafe; color: var(--mlb-st-suggested); }
.mlb-pill--sent      { background: #dcfce7; color: var(--mlb-st-sent); }
.mlb-pill--skipped   { background: #f1f5f9; color: #64748b; }
.mlb-pill--failed    { background: #fee2e2; color: var(--mlb-st-failed); }
.mlb-pill--answered  { background: #ccfbf1; color: var(--mlb-st-answered); }
.mlb-pill--closed    { background: #f1f5f9; color: #64748b; }

/* ── Mensaje del comprador ──────────────────────────────────── */

.mlb-msg { display: flex; gap: 0.6rem; align-items: flex-start; }
.mlb-msg-main { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; flex: 1; }

.mlb-msg-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
  font-size: 0.76rem;
  color: var(--color-text-muted);
}
.mlb-msg-head strong { color: var(--color-text); font-size: 0.8rem; }

.mlb-thread-link { font-size: 0.74rem; color: var(--color-primary); text-decoration: none; white-space: nowrap; }
.mlb-thread-link:hover { text-decoration: underline; }

.mlb-bubble {
  position: relative;
  margin: 0;
  padding: 0.6rem 0.8rem;
  background: #f1f5f9;
  border-radius: 4px 14px 14px 14px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--color-text);
  overflow-wrap: anywhere;
}

/* ── Plegables (hilo, descripción, compatibilidades) ────────── */

.mlb-fold { font-size: 0.8rem; color: var(--color-text-muted); }

.mlb-fold summary {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 32px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  font-weight: 600;
}
.mlb-fold summary::-webkit-details-marker { display: none; }
.mlb-fold summary::before {
  content: "▸";
  font-size: 0.7rem;
  transition: transform 0.15s ease;
}
.mlb-fold[open] summary::before { transform: rotate(90deg); }

.mlb-fold-list { margin: 0.35rem 0 0; padding-left: 1.2rem; }

.mlb-history {
  list-style: none;
  margin: 0.45rem 0 0;
  padding: 0 0 0 0.85rem;
  border-left: 2px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.mlb-history-item { display: flex; flex-direction: column; gap: 0.2rem; }
.mlb-history-q { margin: 0; font-size: 0.85rem; color: var(--color-text); }
.mlb-history-q .mlb-time { margin: 0 0.3rem; }
.mlb-history-a {
  margin: 0;
  padding: 0.35rem 0.6rem;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.mlb-listing-description {
  margin-top: 0.4rem;
  padding: 0.5rem 0.75rem;
  background: var(--color-bg);
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  max-height: 180px;
  overflow-y: auto;
}

/* ── Veredicto del sistema (diagnóstico) ────────────────────── */

.mlb-verdict {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
}

.mlb-verdict-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #94a3b8;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
  flex: none;
}

.mlb-verdict-body { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; flex: 1; }

.mlb-verdict-title {
  font-family: var(--mlb-display);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text);
}

.mlb-verdict-vehicle { font-size: 0.8rem; color: var(--color-text-muted); }

.mlb-verdict--ok { background: #f0fdf4; border-color: #bbf7d0; }
.mlb-verdict--ok .mlb-verdict-icon { background: var(--mlb-st-sent); }
.mlb-verdict--ok .mlb-verdict-title { color: #15803d; }

.mlb-verdict--no { background: #fef2f2; border-color: #fecaca; }
.mlb-verdict--no .mlb-verdict-icon { background: var(--mlb-st-failed); }
.mlb-verdict--no .mlb-verdict-title { color: #b91c1c; }

.mlb-verdict--unknown { background: #fffbeb; border-color: #fde68a; }
.mlb-verdict--unknown .mlb-verdict-icon { background: var(--mlb-amber); }
.mlb-verdict--unknown .mlb-verdict-title { color: var(--mlb-amber-deep); }

/* Gauge de confianza: <progress> nativo (sin width inline) */
.mlb-gauge {
  display: block;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 5px;
  margin-top: 0.2rem;
  border: none;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  overflow: hidden;
}
.mlb-gauge::-webkit-progress-bar { background: rgba(15, 23, 42, 0.08); border-radius: 999px; }
.mlb-gauge::-webkit-progress-value {
  background: linear-gradient(90deg, var(--mlb-amber), var(--mlb-st-sent));
  border-radius: 999px;
}
.mlb-gauge::-moz-progress-bar {
  background: linear-gradient(90deg, var(--mlb-amber), var(--mlb-st-sent));
  border-radius: 999px;
}

.mlb-gauge-num {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  color: var(--color-text-muted);
}

/* ── Paneles del catálogo (coincidencias / alternativas) ────── */

.mlb-panel {
  padding: 0.65rem 0.75rem;
  background: var(--color-bg);
  border: 1px dashed var(--color-border);
  border-radius: 12px;
}

.mlb-panel-label {
  display: block;
  margin-bottom: 0.45rem;
  font-family: var(--mlb-display);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.mlb-panel-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.55rem; }

.mlb-panel-item {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--color-border);
}
.mlb-panel-item:last-child { padding-bottom: 0; border-bottom: none; }

.mlb-panel-info { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.mlb-panel-info > a { font-weight: 600; font-size: 0.85rem; text-decoration: none; color: var(--color-text); }
.mlb-panel-info > a:hover { color: var(--color-primary); }

.mlb-error {
  margin: 0;
  padding: 0.5rem 0.75rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  color: var(--color-danger);
  font-size: 0.8rem;
  word-break: break-word;
}

/* ── Desenlaces: publicada / a mano / simulación ────────────── */

.mlb-outcome {
  padding: 0.6rem 0.8rem;
  border-radius: 12px;
  border-left: 3px solid var(--mlb-st-sent);
  background: #f0fdf4;
  font-size: 0.9rem;
}
.mlb-outcome p { margin: 0.25rem 0 0; overflow-wrap: anywhere; }

.mlb-outcome-label {
  display: block;
  font-family: var(--mlb-display);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #15803d;
}

.mlb-outcome--human { background: #f0fdfa; border-left-color: var(--mlb-st-answered); }
.mlb-outcome--human .mlb-outcome-label { color: var(--mlb-st-answered); }

.mlb-outcome--bot { background: #eff6ff; border-left-color: var(--mlb-st-suggested); }
.mlb-outcome--bot .mlb-outcome-label { color: var(--mlb-st-suggested); }

.mlb-compare { display: grid; gap: 0.5rem; }

.mlb-closed-note { margin: 0; font-size: 0.8rem; color: var(--color-text-muted); }

/* ── Editor de respuesta ────────────────────────────────────── */

.mlb-editor-form { display: flex; flex-direction: column; gap: 0.55rem; }

.mlb-editor {
  padding: 0.55rem 0.7rem 0.65rem;
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.mlb-editor:focus-within {
  border-color: var(--mlb-amber);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.mlb-editor-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.mlb-editor-label {
  font-family: var(--mlb-display);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.mlb-editor-count {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 0.66rem;
  color: var(--color-text-muted);
}
.mlb-editor-count--over { color: var(--color-danger); font-weight: 700; }

.mlb-textarea {
  display: block;
  width: 100%;
  min-height: 64px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 1rem; /* ≥16px: evita el zoom automático de iOS */
  line-height: 1.5;
  color: var(--color-text);
  resize: none;
  overflow: hidden;
}
.mlb-textarea:focus { outline: none; }
.mlb-textarea::placeholder { color: #94a3b8; font-size: 0.85rem; }

.mlb-actions { display: grid; grid-template-columns: 1fr 1.5fr; gap: 0.5rem; }

.mlb-ghost-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--color-border);
}
.mlb-ghost-actions .mlb-btn { flex: 1; min-width: 130px; }

/* ── Búsqueda + filtro por tienda ───────────────────────────── */

.mlb-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.9rem;
}

.mlb-search {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex: 1 1 220px;
  min-height: 42px;
  padding: 0 0.7rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  color: var(--color-text-muted);
}
.mlb-search:focus-within { border-color: var(--mlb-amber); }
.mlb-search .icon { flex: none; }

.mlb-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 1rem; /* ≥16px: evita el zoom automático de iOS */
  color: var(--color-text);
}
.mlb-search-input:focus { outline: none; }

.mlb-store-select {
  min-height: 42px;
  padding: 0 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  font: inherit;
  font-size: 0.875rem;
  color: var(--color-text);
}

/* ── Barra flotante de acciones por lote ────────────────────── */

.mlb-bulkbar {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  max-width: calc(100vw - 1.5rem);
  padding: 0.55rem 0.9rem;
  background: var(--mlb-ink);
  color: var(--gray-200);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(2, 6, 23, 0.4);
}
.mlb-bulkbar[hidden] { display: none; }

.mlb-bulkbar-count { font-size: 0.8rem; white-space: nowrap; }
.mlb-bulkbar-count strong {
  font-family: var(--mlb-display);
  font-size: 1.05rem;
  color: var(--mlb-yellow);
}

.mlb-bulkbar-status {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  color: var(--mlb-yellow);
  white-space: nowrap;
}
.mlb-bulkbar-status:empty { display: none; }

/* ── Pantallas medianas y grandes ───────────────────────────── */

@media (min-width: 768px) {
  .mlb-stats { top: 0; }
}

@media (min-width: 720px) {
  .mlb-hero { padding: 1.5rem 1.5rem 1.25rem; }

  .mlb-hero-grid {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
  }

  .mlb-hero-actions { flex-direction: row; flex-wrap: wrap; justify-content: flex-end; }
  .mlb-hero-actions .mlb-btn { min-height: 40px; }

  .mlb-card { padding: 1.1rem 1.25rem 1.15rem; }

  .mlb-compare { grid-template-columns: 1fr 1fr; align-items: start; }

  .mlb-actions { display: flex; justify-content: flex-end; }
  .mlb-actions .mlb-btn { min-width: 150px; }

  .mlb-ghost-actions { justify-content: flex-start; }
  .mlb-ghost-actions .mlb-btn { flex: none; }

  .mlb-panel-item { flex-direction: row; align-items: center; justify-content: space-between; }
}

/* ── Accesibilidad: sin animaciones si el usuario lo pide ───── */

@media (prefers-reduced-motion: reduce) {
  .mlb-card { animation: none; }
  .mlb-signal--on::before { animation: none; }
  .mlb-btn { transition: none; }
}

/* ============================================
   Configuración de respuestas automáticas (/bot_config)
   Mobile-first: una columna; grid de 2 en pantallas anchas.
   ============================================ */

.botcfg-form { display: flex; flex-direction: column; gap: 1rem; }

.botcfg-card { margin-bottom: 1rem; }
.botcfg-form .botcfg-card { margin-bottom: 0; }

.botcfg-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.botcfg-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  padding: 0.75rem 0;
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
}

.botcfg-preview summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--color-text);
}

.botcfg-prompt {
  margin: 0.75rem 0 0.5rem;
  padding: 0.85rem 1rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 420px;
  overflow-y: auto;
}

/* Acento del módulo: rótulos Barlow + filete amarillo (lenguaje mlb) */
.botcfg-kicker {
  margin: 0 0 0.15rem;
  font-family: var(--mlb-display, "Barlow Condensed", sans-serif);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mlb-amber-deep, var(--gray-600));
}

.botcfg-card h2 {
  padding-left: 0.6rem;
  border-left: 3px solid var(--mlb-yellow, var(--c-warning));
  font-family: var(--mlb-display, "Barlow Condensed", sans-serif);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.botcfg-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.botcfg-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Errores inline por campo (update inválido re-renderiza con @config.errors) */
.botcfg-field--invalid input,
.botcfg-field--invalid textarea {
  border-color: var(--c-danger, var(--color-danger));
}

.botcfg-field-error {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0.3rem 0 0;
  font-size: 0.8rem;
  color: var(--c-danger, var(--color-danger));
}

/* Umbral atenuado mientras la auto-publicación está apagada (bot_config_controller.js) */
.botcfg-threshold { transition: opacity 0.15s ease; }
.botcfg-threshold--muted,
.botcfg-field--muted { opacity: 0.55; }
.botcfg-threshold-hint { display: block; margin-top: 0.15rem; font-weight: 600; }

@media (min-width: 700px) {
  .botcfg-grid { grid-template-columns: 1fr 1fr; }
}
