/* Vista «Resultados». Alturas de barras fijadas por JS (data-h). */
.results-range {
  margin-bottom: 14px;
}
.stats:has(+ .panel .rchart) {
  grid-template-columns: repeat(3, 1fr);
}
.rchart {
  display: flex;
  align-items: stretch;
  gap: 6px;
  height: 220px;
  padding: 8px 20px 16px;
  border-bottom: 1px solid var(--line);
}
.rchart-day {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-radius: 6px;
}
.rchart-day:hover {
  background: var(--surface-2);
}
.rchart-day small {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
}
.rchart-bars {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  border-bottom: 1px solid var(--line);
}
.rchart-bar {
  width: 40%;
  max-width: 22px;
  min-height: 1px;
  height: 0;
  border-radius: 4px 4px 0 0;
}
.rchart-bar.in,
.rchart-legend i.in {
  background: var(--brand);
}
.rchart-bar.out,
.rchart-legend i.out {
  background: var(--warm);
}
.rchart.dense {
  gap: 2px;
}
.rchart.dense .rchart-day small {
  font-size: 11px;
}
.rchart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}
.rchart-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
}
.rchart-table {
  padding: 12px 20px 16px;
}
.rchart-table summary {
  cursor: pointer;
  color: var(--muted);
}
@media (max-width: 900px) {
  .stats:has(+ .panel .rchart) {
    grid-template-columns: repeat(2, 1fr);
  }
  .rchart.dense .rchart-day small {
    visibility: hidden;
  }
}

/* imagegen.js: Cuentas de IA y «Generar imagen» */
.ig-steps { margin: .5rem 0 1rem 1.2rem; padding: 0; line-height: 1.5; }
.ig-steps li { margin: .2rem 0; }
.ig-help { padding: 0 1rem 1rem; }
.ig-help summary { cursor: pointer; font-weight: 600; }
.ig-result { margin-top: .75rem; }
.ig-preview { display: block; max-width: 100%; max-height: 50vh; margin: 0 auto .5rem; border-radius: 8px; }

.ig-test-image { display: block; max-width: 100%; max-height: 60vh; margin: 12px auto 0; border-radius: 12px; }
.ig-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ig-test { display: inline-flex; align-items: center; gap: 8px; font-size: 0.85rem; }
.ig-test.ok { color: var(--ok, #0f7a55); text-decoration: none; }
.ig-test.ok img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; }
.ig-test.failed { color: var(--danger, #b42318); }
.ig-test .spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: ig-spin 0.8s linear infinite; }
@keyframes ig-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ig-test .spinner { animation: none; } }

/* Navegador remoto (iniciar sesión en el servidor) */
.rb-overlay { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0; overflow: hidden; box-sizing: border-box; background: var(--bg, #0f1115); }
.rb-overlay[open] { display: flex; flex-direction: column; }
.rb-overlay::backdrop { background: rgba(0, 0, 0, 0.6); }
.rb-fb-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 8px 0; }
.rb-head, .rb-tools, .rb-foot, .rb-ext { flex: none; }
.rb-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; background: var(--panel, #fff); border-bottom: 1px solid var(--line, #ddd); }
.rb-foot { border-top: 1px solid var(--line, #ddd); border-bottom: 0; }
.rb-spacer { flex: 1; }
.rb-status { font-size: 0.85rem; color: var(--muted, #666); }
.rb-label { width: 180px; }
.rb-type { flex: 1; min-width: 160px; }
.rb-stage { flex: 1 1 0; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px; overflow: hidden; container-type: size; }
.rb-frame { position: relative; width: min(100%, calc((100vh - 130px) * 1.6)); line-height: 0; }
@supports (width: 1cqh) { .rb-frame { width: min(100cqw, 100cqh * 1.6); } }
.rb-screen { display: block; width: 100%; height: auto; aspect-ratio: 1280 / 800; background: #222; cursor: default; outline: 2px solid transparent; user-select: none; image-rendering: auto; }
.rb-click { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border: 2px solid var(--accent, #2563eb); border-radius: 50%; pointer-events: none; animation: rb-click 0.45s ease-out forwards; }
@keyframes rb-click { from { transform: scale(0.4); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .rb-click { animation: none; opacity: 0.6; } }
.rb-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: radial-gradient(circle at 50% 40%, #1d2433 0%, #0f131b 70%); line-height: 1.4; transition: opacity .25s ease; z-index: 2; }
.rb-loading[hidden] { display: none; }
.rb-loading.leaving { opacity: 0; }
.rb-load-card { width: min(380px, 100%); display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 28px 24px 22px; border-radius: 16px; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1); color: #e8ecf4; text-align: center; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35); }
.rb-load-ring { position: relative; width: 72px; height: 72px; display: grid; place-items: center; color: #8fb4ff; }
.rb-load-ring::before { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 3px solid rgba(143, 180, 255, 0.18); border-top-color: #8fb4ff; animation: rb-spin 1s linear infinite; }
.rb-load-ring::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 2px solid rgba(143, 180, 255, 0.25); animation: rb-pulse 1.8s ease-out infinite; }
.rb-load-title { font-size: 1.05rem; color: #fff; }
.rb-load-steps { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; gap: 8px; text-align: left; font-size: 0.9rem; color: rgba(232, 236, 244, 0.55); }
.rb-load-steps li { display: flex; align-items: center; gap: 10px; transition: color .2s; }
.rb-load-steps li.active { color: #fff; }
.rb-load-steps li.done { color: #9fe0bf; }
.rb-step-dot { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; opacity: .7; position: relative; }
.rb-load-steps li.active .rb-step-dot { border-color: #8fb4ff; border-top-color: transparent; opacity: 1; animation: rb-spin .8s linear infinite; }
.rb-load-steps li.done .rb-step-dot { background: #3fb67f; border-color: #3fb67f; opacity: 1; }
.rb-load-steps li.done .rb-step-dot::after { content: ""; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px; border: solid #0f131b; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.rb-load-bar { width: 100%; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.rb-load-bar span { display: block; height: 100%; width: 10%; border-radius: 4px; background: linear-gradient(90deg, #5b8cff, #8fb4ff, #5b8cff); background-size: 200% 100%; animation: rb-shimmer 1.2s linear infinite; transition: width .4s ease; }
.rb-load-hint { color: rgba(232, 236, 244, 0.5); }
.rb-load-error { margin: 0; color: #ffb4a8; font-size: 0.9rem; }
.rb-loading.failed .rb-load-ring { color: #ff8a7a; }
.rb-loading.failed .rb-load-ring::before, .rb-loading.failed .rb-load-ring::after, .rb-loading.failed .rb-load-steps li.active .rb-step-dot, .rb-loading.failed .rb-load-bar span { animation: none; }
.rb-loading.failed .rb-load-ring::before { border-color: rgba(255, 138, 122, 0.5); }
.rb-loading.failed .rb-load-hint { display: none; }
.rb-loading.failed .rb-load-steps li.active { color: #ffb4a8; }
.rb-loading.failed .rb-load-steps li.active .rb-step-dot { border-color: #ff8a7a; background: #ff8a7a; }
.rb-loading.failed .rb-load-bar span { background: #ff8a7a; }
@keyframes rb-spin { to { transform: rotate(360deg); } }
@keyframes rb-pulse { from { transform: scale(0.85); opacity: 1; } to { transform: scale(1.25); opacity: 0; } }
@keyframes rb-shimmer { from { background-position: 200% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .rb-load-ring::before, .rb-load-ring::after, .rb-load-steps li.active .rb-step-dot, .rb-load-bar span { animation: none; } }
.rb-ext { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 6px 12px; background: var(--panel, #fff); border-bottom: 1px solid var(--line, #ddd); font-size: 0.9rem; }
.rb-ext[hidden] { display: none; }
.rb-ext-item { display: inline-flex; align-items: center; gap: 6px; }
.rb-fps { margin-left: auto; font-variant-numeric: tabular-nums; }
.ig-said { margin: 0 1rem .5rem; }
.rb-screen:focus { outline-color: var(--accent, #2563eb); }
/* Barra del navegador remoto compacta: más alto para la pantalla. */
.rb-foot { padding: 6px 10px; }
.rb-foot .rb-type { padding: 5px 8px; min-height: 0; }
.bx-name { display: block; width: 100%; max-width: 240px; padding: 3px 6px; min-height: 0; font-weight: 600; border: 1px solid transparent; background: transparent; border-radius: 6px; }
.bx-name:hover, .bx-name:focus { border-color: var(--line, #ccc); background: var(--panel, #fff); }

/* Pestañas del navegador remoto */
.rb-tabs { flex: none; display: flex; align-items: center; gap: 4px; padding: 5px 10px 0; background: var(--panel, #fff); border-bottom: 1px solid var(--line, #ddd); overflow-x: auto; }
.rb-tabs[hidden] { display: none; }
.rb-tab { display: inline-flex; align-items: center; max-width: 240px; border: 1px solid var(--line, #ddd); border-bottom: 0; border-radius: 9px 9px 0 0; background: color-mix(in srgb, var(--line, #ddd) 45%, transparent); }
.rb-tab.active { background: var(--bg, #fff); box-shadow: 0 -2px 0 var(--accent, #2563eb) inset; }
.rb-tab-go { flex: 1; min-width: 0; padding: 6px 10px; border: 0; background: none; color: var(--ink, #222); font: inherit; font-size: 0.82rem; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; min-height: 0; box-shadow: none; }
.rb-tab.active .rb-tab-go { font-weight: 650; }
.rb-tab-go { display: inline-flex; align-items: center; gap: 6px; }
.rb-tab-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rb-tab-ic { flex: none; width: 15px; height: 15px; color: var(--muted, #666); }
.rb-tab-ext { color: #7346d6; }
.rb-tab-x { flex: none; width: 24px; height: 24px; margin-right: 4px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--muted, #666); font-size: 1rem; line-height: 1; cursor: pointer; min-height: 0; box-shadow: none; }
.rb-tab-x:hover { background: var(--danger-soft, #fde8e6); color: var(--danger, #cf3b3b); }
.rb-apply { flex: none; margin: 0 0 4px auto; }

/* Muse: interruptor de salida por Oracle */
.muse-egress { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 10px 0 12px; }
.muse-egress .switch-row { flex: 1; min-width: 280px; }
.muse-egress code { font-size: 0.85em; }
.muse-egress-ip { font-variant-numeric: tabular-nums; }

/* Barra del navegador remoto: fila 1 = qué haces + guardar/cancelar; fila 2 = herramientas + estado. */
.rb-head { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: var(--panel, #fff); border-bottom: 1px solid var(--line, #ddd); }
.rb-title { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.rb-title strong { white-space: nowrap; font-size: 0.98rem; }
.rb-title .rb-label { flex: 0 1 220px; min-width: 120px; width: auto; padding: 6px 10px; min-height: 0; font-size: 0.88rem; }
.rb-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.rb-actions > button { padding: 7px 14px; min-height: 0; font-size: 0.88rem; white-space: nowrap; }
.rb-tools { display: flex; align-items: center; gap: 10px; padding: 5px 14px; background: color-mix(in srgb, var(--line, #ddd) 30%, var(--panel, #fff)); border-bottom: 1px solid var(--line, #ddd); }
.rb-group { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border-radius: 10px; background: var(--panel, #fff); border: 1px solid var(--line, #ddd); flex: none; }
.rb-tool { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--ink, #222); font: inherit; font-size: 0.84rem; font-weight: 600; cursor: pointer; min-height: 0; box-shadow: none; }
.rb-tool.icon { width: 32px; padding: 0; justify-content: center; }
.rb-tool:hover:not(:disabled) { background: color-mix(in srgb, var(--accent, #2563eb) 10%, transparent); }
.rb-tool:disabled { opacity: 0.45; cursor: default; }
.rb-tool[aria-expanded="true"] { background: color-mix(in srgb, var(--accent, #2563eb) 14%, transparent); color: var(--accent, #2563eb); }
.rb-tools .rb-status { flex: 1; min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 0.82rem; line-height: 1.3; }
@media (max-width: 760px) {
  .rb-head { flex-wrap: wrap; gap: 8px; padding: 8px 10px; }
  .rb-title { flex-basis: 100%; }
  .rb-actions { flex: 1; justify-content: flex-end; flex-wrap: wrap; }
  .rb-tools { flex-wrap: wrap; padding: 5px 10px; }
  .rb-tool span { display: none; }
  .rb-tools .rb-status { flex-basis: 100%; }
}
/* Muse: fila de cuenta nueva en preparación y acciones ordenadas */
.muse-pending td { background: color-mix(in srgb, var(--accent, #2563eb) 4%, transparent); }
.row-actions { white-space: nowrap; }
.row-actions > * + * { margin-left: 6px; }
.flow-doctor { max-height: 60vh; overflow: auto; font-size: 0.8rem; white-space: pre-wrap; }
.muted-row td { opacity: 0.6; }
