/* FILE VERSION: 0.6.9-live-alert-history */

/* La pantalla en vivo prioriza la consola y la barra de alertas. */
.monitors-workspace--tabs > .page-heading--compact,
.monitor-tab-panel__header,
.system-runtime-summary--ticker,
.runtime-compact-meta,
.runtime-strategy-tabs--compact,
.runtime-strategy-tabs {
  display: none !important;
}

body:has(.monitors-workspace--tabs) .content {
  padding-top: 0.65rem;
  padding-bottom: 8.9rem;
}

.monitors-workspace--tabs .monitor-tabs {
  margin-bottom: 0.42rem;
  gap: 0.28rem;
}

.monitors-workspace--tabs .monitor-tab {
  min-width: 9.25rem;
  padding: 0.45rem 0.66rem;
  border-radius: 0.55rem 0.55rem 0 0;
}

.monitors-workspace--tabs .monitor-tab strong {
  font-size: 0.73rem;
}

.monitors-workspace--tabs .monitor-tab small {
  font-size: 0.54rem;
}

.monitors-workspace--tabs .monitor-tab-panel {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.monitors-workspace--tabs .runtime-console-panel--primary {
  margin-top: 0;
}

.monitors-workspace--tabs .runtime-console--workspace,
.runtime-console--live-compact {
  height: calc(100vh - 13.2rem) !important;
  min-height: 27rem;
  max-height: none;
  padding: 0.75rem 0.9rem 1.2rem;
}

.runtime-console-panel__title {
  gap: 0.42rem;
}

.runtime-console-panel__strategy-name {
  display: inline-flex;
  max-width: 18rem;
  overflow: hidden;
  color: var(--muted-strong);
  font-size: 0.68rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-strategy-select {
  min-width: 12rem;
  max-width: 22rem;
  height: 1.9rem;
  padding: 0 1.8rem 0 0.58rem;
  color: var(--text);
  border: 1px solid rgba(66, 211, 146, 0.28);
  border-radius: 0.48rem;
  outline: 0;
  background: #071522;
  font-size: 0.67rem;
  font-weight: 800;
}

.runtime-strategy-select:focus {
  border-color: rgba(66, 211, 146, 0.72);
  box-shadow: 0 0 0 3px rgba(66, 211, 146, 0.09);
}

/* Barra fija: el evento es la información principal de la pantalla. */
.runtime-alert-bar {
  --alert-color: #42d392;
  --alert-rgb: 66, 211, 146;
  position: fixed;
  z-index: 160;
  right: 0;
  bottom: 0;
  left: 17.5rem;
  display: grid;
  min-height: 7.6rem;
  padding: 0.82rem 1.25rem;
  grid-template-columns: minmax(9.5rem, 11.5rem) minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 1rem;
  overflow: hidden;
  border-top: 3px solid var(--alert-color);
  background:
    linear-gradient(90deg, rgba(var(--alert-rgb), 0.14), rgba(5, 16, 28, 0.985) 24%, rgba(5, 16, 28, 0.985));
  box-shadow:
    0 -22px 56px rgba(0, 0, 0, 0.52),
    0 -4px 26px rgba(var(--alert-rgb), 0.18);
  backdrop-filter: blur(20px);
}

.app-shell--sidebar-collapsed .runtime-alert-bar {
  left: 5.25rem;
}

.runtime-alert-bar--prepare {
  --alert-color: #ffd56c;
  --alert-rgb: 255, 196, 69;
}

.runtime-alert-bar--enter {
  --alert-color: #caa4ff;
  --alert-rgb: 177, 113, 255;
}

.runtime-alert-bar--profit_lock {
  --alert-color: #73f3c4;
  --alert-rgb: 55, 225, 170;
}

.runtime-alert-bar--exit {
  --alert-color: #ff8b95;
  --alert-rgb: 255, 89, 101;
}

.runtime-alert-bar--error {
  --alert-color: #ffad75;
  --alert-rgb: 255, 133, 69;
}

.runtime-alert-bar--attention {
  animation:
    runtime-alert-arrive 480ms cubic-bezier(0.2, 0.9, 0.25, 1) both,
    runtime-alert-glow 900ms ease-in-out 3 480ms;
}

.runtime-alert-bar--attention::after {
  position: absolute;
  inset: 0 auto 0 -35%;
  width: 28%;
  content: "";
  pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  transform: skewX(-18deg);
  animation: runtime-alert-sweep 950ms ease-out 180ms 1 both;
}

.runtime-alert-bar__signal {
  position: relative;
  z-index: 1;
  display: grid;
  min-width: 0;
  grid-template-columns: 3.35rem minmax(0, 1fr);
  align-items: center;
  gap: 0.72rem;
}

.runtime-alert-bar__signal > strong {
  overflow: hidden;
  color: var(--alert-color);
  font-size: 1.18rem;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 0 16px rgba(var(--alert-rgb), 0.32);
}

.runtime-alert-bar__icon {
  display: grid;
  width: 3.35rem;
  height: 3.35rem;
  place-items: center;
  border: 1px solid rgba(var(--alert-rgb), 0.42);
  border-radius: 0.95rem;
  color: var(--alert-color) !important;
  background: rgba(var(--alert-rgb), 0.15) !important;
  box-shadow: inset 0 0 20px rgba(var(--alert-rgb), 0.1), 0 0 22px rgba(var(--alert-rgb), 0.16);
  animation: runtime-alert-icon-pulse 620ms ease-in-out 4 300ms;
}

.runtime-alert-bar__icon svg {
  width: 1.72rem;
  height: 1.72rem;
  stroke-width: 2.5;
}

.runtime-alert-bar__content {
  position: relative;
  z-index: 1;
  display: grid;
  min-width: 0;
  gap: 0.38rem;
}

.runtime-alert-bar__heading {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 0.8rem;
}

.runtime-alert-bar__heading strong {
  flex: 0 1 auto;
  overflow: hidden;
  color: #ffffff;
  font-size: 1.12rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-alert-bar__heading span {
  min-width: 0;
  overflow: hidden;
  color: #a9bdd1;
  font-size: 0.76rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-alert-bar__content p {
  display: -webkit-box;
  min-width: 0;
  max-height: 3.25rem;
  margin: 0;
  overflow: hidden;
  color: #edf5fb;
  font-size: 1rem;
  font-weight: 750;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.runtime-alert-bar__pending {
  position: relative;
  z-index: 1;
  padding: 0.46rem 0.68rem;
  color: var(--alert-color);
  border: 1px solid rgba(var(--alert-rgb), 0.34);
  border-radius: 999px;
  background: rgba(var(--alert-rgb), 0.1);
  font-size: 0.7rem;
  font-weight: 850;
  white-space: nowrap;
}

.runtime-alert-bar__actions {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.runtime-alert-bar__actions button {
  min-height: 2.55rem;
  padding: 0 0.86rem;
  color: #f3f8fc;
  border: 1px solid rgba(var(--alert-rgb), 0.34);
  border-radius: 0.62rem;
  background: rgba(var(--alert-rgb), 0.1);
  font-size: 0.72rem;
  font-weight: 850;
  cursor: pointer;
}

.runtime-alert-bar__actions button:hover {
  border-color: rgba(var(--alert-rgb), 0.72);
  background: rgba(var(--alert-rgb), 0.18);
}

.runtime-alert-bar__actions .runtime-alert-bar__close {
  display: grid;
  width: 2.55rem;
  padding: 0;
  place-items: center;
}

.runtime-alert-bar--idle {
  min-height: 5.1rem;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
  grid-template-columns: auto minmax(0, 1fr);
  border-top-width: 1px;
  border-top-color: rgba(66, 211, 146, 0.28);
  background: rgba(5, 16, 28, 0.985);
  box-shadow: 0 -15px 36px rgba(0, 0, 0, 0.36);
}

.runtime-alert-bar__idle-dot {
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 7px rgba(66, 211, 146, 0.08), 0 0 18px rgba(66, 211, 146, 0.55);
  animation: runtime-idle-dot 1.8s ease-in-out infinite;
}

.runtime-alert-bar__idle-copy {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 0.9rem;
}

.runtime-alert-bar__idle-copy strong {
  color: #f5f9fc;
  font-size: 0.92rem;
  font-weight: 900;
  letter-spacing: 0.035em;
}

.runtime-alert-bar__idle-copy span {
  overflow: hidden;
  color: #9db1c5;
  font-size: 0.78rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes runtime-alert-arrive {
  0% { opacity: 0; transform: translateY(100%); }
  72% { opacity: 1; transform: translateY(-5px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes runtime-alert-glow {
  0%, 100% {
    box-shadow: 0 -22px 56px rgba(0, 0, 0, 0.52), 0 -4px 26px rgba(var(--alert-rgb), 0.18);
  }
  50% {
    box-shadow: 0 -24px 64px rgba(0, 0, 0, 0.56), 0 -7px 42px rgba(var(--alert-rgb), 0.48);
  }
}

@keyframes runtime-alert-icon-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

@keyframes runtime-alert-sweep {
  0% { left: -35%; opacity: 0; }
  18% { opacity: 1; }
  100% { left: 120%; opacity: 0; }
}

@keyframes runtime-idle-dot {
  0%, 100% { opacity: 0.72; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.12); }
}

@media (max-width: 1100px) {
  .runtime-alert-bar {
    grid-template-columns: minmax(8.5rem, 10rem) minmax(0, 1fr) auto;
  }

  .runtime-alert-bar__pending {
    display: none;
  }
}

@media (max-width: 980px) {
  .runtime-alert-bar,
  .app-shell--sidebar-collapsed .runtime-alert-bar {
    left: 0;
  }
}

@media (max-width: 760px) {
  body:has(.monitors-workspace--tabs) .content {
    padding-top: 0.45rem;
    padding-bottom: 10.2rem;
  }

  .monitors-workspace--tabs .runtime-console--workspace,
  .runtime-console--live-compact {
    height: calc(100vh - 19rem) !important;
    min-height: 20rem;
  }

  .runtime-alert-bar {
    min-height: 9rem;
    padding: 0.72rem 0.78rem;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.62rem;
  }

  .runtime-alert-bar__signal {
    grid-template-columns: 2.8rem;
  }

  .runtime-alert-bar__signal > strong {
    display: none;
  }

  .runtime-alert-bar__icon {
    width: 2.8rem;
    height: 2.8rem;
  }

  .runtime-alert-bar__heading {
    display: grid;
    gap: 0.12rem;
  }

  .runtime-alert-bar__heading strong {
    font-size: 0.92rem;
  }

  .runtime-alert-bar__content p {
    font-size: 0.86rem;
  }

  .runtime-alert-bar__actions > button:first-child,
  .runtime-alert-bar__pending {
    display: none;
  }

  .runtime-alert-bar--idle {
    min-height: 6rem;
  }

  .runtime-alert-bar__idle-copy {
    display: grid;
    gap: 0.12rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .runtime-alert-bar--attention,
  .runtime-alert-bar--attention::after,
  .runtime-alert-bar__icon,
  .runtime-alert-bar__idle-dot {
    animation: none !important;
  }
}

/* Compatibilidad con el bundle compilado actual: convierte el antiguo modal en barra destacada. */
.runtime-alert-backdrop {
  position: fixed !important;
  z-index: 160 !important;
  inset: auto 0 0 17.5rem !important;
  display: block !important;
  padding: 0 !important;
  background: transparent !important;
  backdrop-filter: none !important;
  pointer-events: none !important;
}

.app-shell--sidebar-collapsed .runtime-alert-backdrop {
  left: 5.25rem !important;
}

.runtime-alert-card {
  --alert-color: #42d392;
  --alert-rgb: 66, 211, 146;
  position: relative;
  display: grid !important;
  width: 100% !important;
  min-height: 7.6rem !important;
  max-height: none !important;
  padding: 0.72rem 1.05rem !important;
  grid-template-columns: minmax(18rem, 0.9fr) minmax(0, 1.45fr) auto;
  align-items: center;
  gap: 0.9rem;
  overflow: hidden !important;
  border: 0 !important;
  border-top: 3px solid var(--alert-color) !important;
  border-radius: 0 !important;
  background: linear-gradient(90deg, rgba(var(--alert-rgb), 0.15), rgba(5, 16, 28, 0.99) 25%, rgba(5, 16, 28, 0.99)) !important;
  box-shadow: 0 -22px 56px rgba(0, 0, 0, 0.54), 0 -6px 36px rgba(var(--alert-rgb), 0.25) !important;
  pointer-events: auto !important;
}

.runtime-alert-card--prepare { --alert-color: #ffd56c; --alert-rgb: 255, 196, 69; }
.runtime-alert-card--enter { --alert-color: #caa4ff; --alert-rgb: 177, 113, 255; }
.runtime-alert-card--profit_lock { --alert-color: #73f3c4; --alert-rgb: 55, 225, 170; }
.runtime-alert-card--exit { --alert-color: #ff8b95; --alert-rgb: 255, 89, 101; }
.runtime-alert-card--error { --alert-color: #ffad75; --alert-rgb: 255, 133, 69; }

.runtime-alert-card--attention {
  animation: runtime-alert-arrive 480ms cubic-bezier(0.2, 0.9, 0.25, 1) both, runtime-alert-glow 900ms ease-in-out 3 480ms;
}

.runtime-alert-card--attention::after {
  position: absolute;
  inset: 0 auto 0 -35%;
  width: 28%;
  content: "";
  pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  transform: skewX(-18deg);
  animation: runtime-alert-sweep 950ms ease-out 180ms 1 both;
}

.runtime-alert-card__header {
  position: relative;
  z-index: 1;
  display: grid !important;
  min-width: 0;
  padding: 0 !important;
  grid-template-columns: 3.35rem minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 0.78rem !important;
  border-bottom: 0 !important;
}

.runtime-alert-card__header .eyebrow {
  display: none !important;
}

.runtime-alert-card__header h2 {
  margin: 0 0 0.22rem !important;
  overflow: hidden;
  color: var(--alert-color) !important;
  font-size: 1.22rem !important;
  font-weight: 950 !important;
  letter-spacing: 0.025em;
  text-overflow: ellipsis;
  text-shadow: 0 0 16px rgba(var(--alert-rgb), 0.3);
  text-transform: uppercase;
  white-space: nowrap;
}

.runtime-alert-card__header small {
  display: block;
  overflow: hidden;
  color: #b2c4d6 !important;
  font-size: 0.78rem !important;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-alert-card__icon {
  display: grid !important;
  width: 3.35rem !important;
  height: 3.35rem !important;
  place-items: center;
  border: 1px solid rgba(var(--alert-rgb), 0.44) !important;
  border-radius: 0.95rem !important;
  color: var(--alert-color) !important;
  background: rgba(var(--alert-rgb), 0.15) !important;
  box-shadow: inset 0 0 20px rgba(var(--alert-rgb), 0.1), 0 0 22px rgba(var(--alert-rgb), 0.16);
  animation: runtime-alert-icon-pulse 620ms ease-in-out 4 300ms;
}

.runtime-alert-card__icon svg {
  width: 1.72rem !important;
  height: 1.72rem !important;
  stroke-width: 2.5;
}

.runtime-alert-card__header .icon-button {
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  border-color: rgba(var(--alert-rgb), 0.32);
  border-radius: 0.62rem;
  background: rgba(var(--alert-rgb), 0.08);
}

.runtime-alert-card__message {
  position: relative;
  z-index: 1;
  display: -webkit-box !important;
  min-width: 0;
  max-height: 3.5rem !important;
  margin: 0 !important;
  padding: 0.2rem 0.4rem !important;
  overflow: hidden !important;
  color: #f2f7fb !important;
  background: transparent !important;
  font-family: inherit !important;
  font-size: 1rem !important;
  font-weight: 780 !important;
  line-height: 1.45 !important;
  white-space: pre-line !important;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.runtime-alert-card__actions {
  position: relative;
  z-index: 1;
  display: flex !important;
  padding: 0 !important;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem !important;
  white-space: nowrap;
}

.runtime-alert-card__actions .primary-button,
.runtime-alert-card__actions .secondary-button {
  min-height: 2.55rem !important;
  padding: 0 0.86rem !important;
  color: #f3f8fc !important;
  border: 1px solid rgba(var(--alert-rgb), 0.34) !important;
  border-radius: 0.62rem !important;
  background: rgba(var(--alert-rgb), 0.1) !important;
  font-size: 0.72rem !important;
  font-weight: 850 !important;
}

.runtime-alert-card__actions .primary-button:hover,
.runtime-alert-card__actions .secondary-button:hover {
  border-color: rgba(var(--alert-rgb), 0.72) !important;
  background: rgba(var(--alert-rgb), 0.18) !important;
}

.runtime-alert-card__pending {
  margin-right: 0.15rem !important;
  padding: 0.42rem 0.62rem;
  color: var(--alert-color) !important;
  border: 1px solid rgba(var(--alert-rgb), 0.3);
  border-radius: 999px;
  background: rgba(var(--alert-rgb), 0.09);
  font-size: 0.68rem !important;
  font-weight: 800;
}

.runtime-alert-idle-bar {
  position: fixed;
  z-index: 155;
  right: 0;
  bottom: 0;
  left: 17.5rem;
  display: flex;
  min-height: 5.1rem;
  padding: 0.72rem 1.25rem;
  align-items: center;
  gap: 0.9rem;
  border-top: 1px solid rgba(66, 211, 146, 0.3);
  background: rgba(5, 16, 28, 0.99);
  box-shadow: 0 -17px 40px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(18px);
}

.app-shell--sidebar-collapsed .runtime-alert-idle-bar {
  left: 5.25rem;
}

.runtime-alert-idle-bar__dot {
  width: 0.72rem;
  height: 0.72rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 7px rgba(66, 211, 146, 0.08), 0 0 18px rgba(66, 211, 146, 0.55);
  animation: runtime-idle-dot 1.8s ease-in-out infinite;
}

.runtime-alert-idle-bar > div {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 0.9rem;
}

.runtime-alert-idle-bar strong {
  color: #f5f9fc;
  font-size: 0.92rem;
  font-weight: 900;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.runtime-alert-idle-bar span:last-child {
  overflow: hidden;
  color: #9db1c5;
  font-size: 0.78rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .runtime-alert-card {
    grid-template-columns: minmax(16rem, 0.9fr) minmax(0, 1fr) auto !important;
  }

  .runtime-alert-card__pending {
    display: none;
  }
}

@media (max-width: 980px) {
  .runtime-alert-backdrop,
  .app-shell--sidebar-collapsed .runtime-alert-backdrop,
  .runtime-alert-idle-bar,
  .app-shell--sidebar-collapsed .runtime-alert-idle-bar {
    left: 0 !important;
  }
}

@media (max-width: 760px) {
  .runtime-alert-card {
    min-height: 9rem !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
  }

  .runtime-alert-card__message {
    grid-column: 1 / -1;
  }

  .runtime-alert-card__actions {
    grid-column: 2;
    grid-row: 1;
  }

  .runtime-alert-card__actions .secondary-button,
  .runtime-alert-card__pending {
    display: none !important;
  }

  .runtime-alert-idle-bar {
    min-height: 6rem;
  }

  .runtime-alert-idle-bar > div {
    display: grid;
    gap: 0.12rem;
  }
}

/* v0.6.9 — panel de alertas redimensionable con el mouse. */
:root {
  --runtime-alert-height: 12rem;
}

body:has(.monitors-workspace--tabs) .content {
  padding-bottom: calc(var(--runtime-alert-height) + 1rem) !important;
}

.monitors-workspace--tabs .runtime-console--workspace,
.runtime-console--live-compact {
  height: calc(100vh - var(--runtime-alert-height) - 5.1rem) !important;
  min-height: 15rem !important;
}

.runtime-alert-backdrop {
  height: var(--runtime-alert-height) !important;
  max-height: 50vh !important;
}

.runtime-alert-card {
  height: 100% !important;
  min-height: 100% !important;
  padding-top: 1.25rem !important;
  grid-template-columns: minmax(19rem, 0.82fr) minmax(0, 1.65fr) auto !important;
}

.runtime-alert-idle-bar {
  height: var(--runtime-alert-height) !important;
  min-height: 7rem !important;
  max-height: 50vh !important;
  padding-top: 1.35rem !important;
}

.runtime-alert-resize-handle {
  position: absolute;
  z-index: 20;
  top: 0;
  right: 0;
  left: 0;
  height: 1.05rem;
  cursor: ns-resize;
  touch-action: none;
  user-select: none;
}

.runtime-alert-resize-handle::before {
  position: absolute;
  top: 0.24rem;
  left: 50%;
  width: 5.5rem;
  height: 0.28rem;
  content: "";
  border-radius: 999px;
  background: rgba(220, 235, 247, 0.46);
  box-shadow: 0 0 0 1px rgba(3, 12, 22, 0.82), 0 0 14px rgba(var(--alert-rgb, 66, 211, 146), 0.22);
  transform: translateX(-50%);
  transition: width 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.runtime-alert-resize-handle::after {
  position: absolute;
  top: 0.56rem;
  left: 50%;
  content: "Arrastra para cambiar altura · doble clic para restablecer";
  color: rgba(196, 213, 228, 0.7);
  font-size: 0.58rem;
  font-weight: 750;
  letter-spacing: 0.035em;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%);
  transition: opacity 160ms ease;
  white-space: nowrap;
}

.runtime-alert-resize-handle:hover::before,
body.runtime-alert-resizing .runtime-alert-resize-handle::before {
  width: 8rem;
  background: var(--alert-color, #42d392);
  box-shadow: 0 0 0 1px rgba(3, 12, 22, 0.82), 0 0 20px rgba(var(--alert-rgb, 66, 211, 146), 0.46);
}

.runtime-alert-resize-handle:hover::after,
body.runtime-alert-resizing .runtime-alert-resize-handle::after {
  opacity: 1;
}

body.runtime-alert-resizing,
body.runtime-alert-resizing * {
  cursor: ns-resize !important;
  user-select: none !important;
}

.runtime-alert-card__header h2 {
  font-size: 1.55rem !important;
}

.runtime-alert-card__header small {
  font-size: 0.9rem !important;
}

.runtime-alert-card__message {
  display: block !important;
  max-height: calc(var(--runtime-alert-height) - 2.8rem) !important;
  padding: 0.55rem 0.7rem !important;
  overflow: auto !important;
  font-size: 1.28rem !important;
  font-weight: 820 !important;
  line-height: 1.45 !important;
  -webkit-line-clamp: unset !important;
}

.runtime-alert-card__actions .primary-button,
.runtime-alert-card__actions .secondary-button {
  min-height: 3rem !important;
  padding: 0 1.05rem !important;
  font-size: 0.82rem !important;
}

.runtime-alert-idle-bar strong {
  font-size: 1.18rem !important;
}

.runtime-alert-idle-bar span:last-child {
  font-size: 0.96rem !important;
}

@media (max-width: 760px) {
  :root {
    --runtime-alert-height: 11rem;
  }

  .runtime-alert-resize-handle::after {
    display: none;
  }

  .runtime-alert-card__header h2 {
    font-size: 1.12rem !important;
  }

  .runtime-alert-card__message {
    font-size: 1rem !important;
  }
}

/* v0.6.9 — historial permanente a la derecha y flujo de alerta no bloqueante. */
:root {
  --runtime-history-width: clamp(20rem, 27vw, 28rem);
}

.runtime-viewer--compact {
  position: relative;
  min-width: 0;
}

.runtime-viewer--compact > .runtime-console-panel--primary {
  width: auto;
  margin-right: calc(var(--runtime-history-width) + 0.75rem);
}

.runtime-alert-history-panel,
.runtime-alert-history {
  position: absolute;
  z-index: 18;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  width: var(--runtime-history-width);
  min-width: 18rem;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(116, 153, 183, 0.22);
  border-radius: 0.8rem;
  background: linear-gradient(180deg, rgba(10, 27, 43, 0.98), rgba(5, 16, 28, 0.99));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025), 0 18px 42px rgba(0, 0, 0, 0.2);
}

.runtime-alert-history-panel__header,
.runtime-alert-history__header {
  display: flex;
  min-height: 3.45rem;
  padding: 0.62rem 0.72rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  border-bottom: 1px solid rgba(116, 153, 183, 0.18);
  background: rgba(8, 23, 37, 0.96);
}

.runtime-alert-history-panel__title,
.runtime-alert-history__header > div {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.55rem;
}

.runtime-alert-history-panel__title-icon,
.runtime-alert-history__header svg {
  flex: 0 0 auto;
  color: var(--green);
}

.runtime-alert-history-panel__title-copy,
.runtime-alert-history__header span {
  display: grid;
  min-width: 0;
  gap: 0.05rem;
}

.runtime-alert-history-panel__title-copy strong,
.runtime-alert-history__header strong {
  overflow: hidden;
  color: #f4f8fc;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.025em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.runtime-alert-history-panel__title-copy small,
.runtime-alert-history__header small {
  color: #8fa7bc;
  font-size: 0.62rem;
  font-weight: 700;
}

.runtime-alert-history-panel__clear,
.runtime-alert-history__header button {
  display: grid;
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  place-items: center;
  color: #a8bbcc;
  border: 1px solid rgba(116, 153, 183, 0.22);
  border-radius: 0.48rem;
  background: rgba(116, 153, 183, 0.06);
  cursor: pointer;
}

.runtime-alert-history-panel__clear:hover,
.runtime-alert-history__header button:hover {
  color: #ffffff;
  border-color: rgba(255, 139, 149, 0.55);
  background: rgba(255, 89, 101, 0.1);
}

.runtime-alert-history-panel__list,
.runtime-alert-history__list {
  display: flex;
  min-height: 0;
  padding: 0.55rem;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.48rem;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
}

.runtime-alert-history-panel__item,
.runtime-alert-history__item {
  --history-color: #42d392;
  --history-rgb: 66, 211, 146;
  position: relative;
  display: grid;
  width: 100%;
  padding: 0.62rem 0.68rem 0.66rem 0.78rem;
  gap: 0.27rem;
  overflow: hidden;
  color: inherit;
  text-align: left;
  border: 1px solid rgba(var(--history-rgb), 0.18);
  border-radius: 0.62rem;
  background: linear-gradient(100deg, rgba(var(--history-rgb), 0.09), rgba(8, 22, 35, 0.82) 42%);
  cursor: pointer;
}

.runtime-alert-history-panel__item::before,
.runtime-alert-history__item::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0.22rem;
  content: "";
  background: var(--history-color);
  box-shadow: 0 0 12px rgba(var(--history-rgb), 0.45);
}

.runtime-alert-history-panel__item--prepare,
.runtime-alert-history__item--prepare { --history-color: #ffd56c; --history-rgb: 255, 196, 69; }
.runtime-alert-history-panel__item--enter,
.runtime-alert-history__item--enter { --history-color: #caa4ff; --history-rgb: 177, 113, 255; }
.runtime-alert-history-panel__item--profit_lock,
.runtime-alert-history__item--profit_lock { --history-color: #73f3c4; --history-rgb: 55, 225, 170; }
.runtime-alert-history-panel__item--exit,
.runtime-alert-history__item--exit { --history-color: #ff8b95; --history-rgb: 255, 89, 101; }
.runtime-alert-history-panel__item--error,
.runtime-alert-history__item--error { --history-color: #ffad75; --history-rgb: 255, 133, 69; }

.runtime-alert-history-panel__item:hover,
.runtime-alert-history__item:hover {
  border-color: rgba(var(--history-rgb), 0.5);
  background: linear-gradient(100deg, rgba(var(--history-rgb), 0.16), rgba(10, 27, 43, 0.96) 46%);
}

.runtime-alert-history-panel__item--latest,
.runtime-alert-history__item--latest {
  border-color: rgba(var(--history-rgb), 0.62);
  box-shadow: 0 0 0 1px rgba(var(--history-rgb), 0.08), 0 0 22px rgba(var(--history-rgb), 0.12);
  animation: runtime-history-new 950ms ease-out 1;
}

.runtime-alert-history-panel__topline,
.runtime-alert-history__item-topline {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.runtime-alert-history-panel__topline strong,
.runtime-alert-history__item-topline strong {
  overflow: hidden;
  color: var(--history-color);
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.045em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.runtime-alert-history-panel__topline small,
.runtime-alert-history__item-topline small {
  flex: 0 0 auto;
  color: #8fa7bc;
  font-size: 0.59rem;
  font-weight: 750;
}

.runtime-alert-history-panel__strategy,
.runtime-alert-history__strategy {
  overflow: hidden;
  color: #d8e5ef;
  font-size: 0.68rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-alert-history-panel__message,
.runtime-alert-history__message {
  display: -webkit-box;
  overflow: hidden;
  color: #aebfd0;
  font-size: 0.66rem;
  font-weight: 650;
  line-height: 1.38;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.runtime-alert-history-panel__empty,
.runtime-alert-history__empty {
  display: grid;
  min-height: 11rem;
  padding: 1rem;
  place-content: center;
  justify-items: center;
  gap: 0.45rem;
  color: #7f97ab;
  text-align: center;
}

.runtime-alert-history-panel__empty strong,
.runtime-alert-history__empty strong {
  color: #dce7f0;
  font-size: 0.78rem;
}

.runtime-alert-history-panel__empty span,
.runtime-alert-history__empty span {
  max-width: 14rem;
  font-size: 0.66rem;
  line-height: 1.45;
}

.runtime-alert-history-panel__resize {
  position: absolute;
  z-index: 6;
  top: 0;
  bottom: 0;
  left: -0.42rem;
  width: 0.84rem;
  cursor: ew-resize;
  touch-action: none;
}

.runtime-alert-history-panel__resize::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.22rem;
  height: 4.4rem;
  content: "";
  border-radius: 999px;
  background: rgba(136, 164, 188, 0.36);
  transform: translate(-50%, -50%);
  transition: background 150ms ease, box-shadow 150ms ease;
}

.runtime-alert-history-panel__resize:hover::after,
body.runtime-history-resizing .runtime-alert-history-panel__resize::after {
  background: var(--green);
  box-shadow: 0 0 18px rgba(66, 211, 146, 0.48);
}

body.runtime-history-resizing,
body.runtime-history-resizing * {
  cursor: ew-resize !important;
  user-select: none !important;
}

.runtime-alert-card__pending {
  display: none !important;
}

.runtime-alert-card__actions .primary-button {
  min-width: 7.4rem;
}

@keyframes runtime-history-new {
  0% { opacity: 0; transform: translateX(18px); }
  65% { opacity: 1; transform: translateX(-3px); }
  100% { opacity: 1; transform: translateX(0); }
}

@media (max-width: 1280px) {
  :root {
    --runtime-history-width: clamp(18rem, 25vw, 22rem);
  }
}

@media (max-width: 920px) {
  .runtime-viewer--compact > .runtime-console-panel--primary {
    margin-right: 0;
  }

  .runtime-alert-history-panel,
  .runtime-alert-history {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    width: 100%;
    height: 16rem;
    margin-top: 0.65rem;
  }

  .runtime-alert-history-panel__resize {
    display: none;
  }
}

/* Compatibilidad con la futura compilación limpia del componente React. */
.runtime-operational-grid {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) var(--runtime-history-width);
  align-items: stretch;
  gap: 0.75rem;
}

.runtime-operational-grid > .runtime-console-panel--primary {
  min-width: 0;
  margin-right: 0 !important;
}

.runtime-operational-grid > .runtime-alert-history {
  position: relative;
  top: auto;
  right: auto;
  bottom: auto;
  width: 100%;
  min-height: 0;
}

@media (max-width: 920px) {
  .runtime-operational-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* FILE PATCH: 0.7.6 — cabecera fija y alertas legibles solo del día actual. */
:root {
  --runtime-history-width: 27.5rem;
}

/* La página no se desplaza completa: solo se desplazan la consola y el historial. */
body:has(.monitors-workspace--tabs) {
  height: 100vh;
  overflow: hidden;
}

body:has(.monitors-workspace--tabs) .app-shell {
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

body:has(.monitors-workspace--tabs) .app-main {
  display: flex;
  height: 100vh;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

body:has(.monitors-workspace--tabs) .topbar {
  flex: 0 0 4.5rem;
}

body:has(.monitors-workspace--tabs) .content {
  display: flex;
  width: 100%;
  max-width: none;
  min-height: 0;
  padding: 0.6rem 0.85rem calc(var(--runtime-alert-height, 192px) + 0.7rem);
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
}

.monitors-workspace--tabs {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

/* Los tickers siempre permanecen visibles para cambiar de uno a otro. */
.monitors-workspace--tabs .monitor-tabs {
  position: relative;
  z-index: 70;
  min-height: 3.25rem;
  margin: 0 0 0.5rem;
  padding-top: 0.05rem;
  flex: 0 0 auto;
  overflow-x: auto;
  overflow-y: hidden;
  background: #07111f;
  box-shadow: 0 10px 24px rgba(2, 8, 15, 0.35);
  scrollbar-width: thin;
}

.monitors-workspace--tabs .monitor-tab-panel {
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.runtime-viewer--compact,
.runtime-operational-grid {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.runtime-operational-grid {
  grid-template-columns: minmax(0, 1fr) var(--runtime-history-width);
  gap: 0.65rem;
}

.runtime-console-panel--primary {
  display: flex;
  height: 100%;
  min-height: 0;
  margin: 0 !important;
  flex-direction: column;
  overflow: hidden;
}

/* El selector de estrategia y sus controles no desaparecen al recorrer la consola. */
.runtime-console-panel--primary > header {
  position: relative;
  z-index: 65;
  min-height: 3.15rem;
  flex: 0 0 auto;
  background: #0f2032;
  box-shadow: 0 8px 18px rgba(2, 8, 15, 0.38);
}

.monitors-workspace--tabs .runtime-console--workspace,
.runtime-console--live-compact {
  width: 100%;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  flex: 1 1 auto;
  overflow: auto !important;
  overscroll-behavior: contain;
}

/* Conservamos el espacio del historial React, pero mostramos el historial mejorado encima. */
.runtime-operational-grid > .runtime-alert-history {
  visibility: hidden !important;
  pointer-events: none !important;
}

.runtime-alert-history-panel {
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--runtime-history-width);
  min-width: 22.5rem;
  height: auto;
  border-radius: 0.72rem;
}

.runtime-alert-history-panel__header {
  min-height: 4rem;
  padding: 0.72rem 0.82rem;
}

.runtime-alert-history-panel__title-copy strong {
  font-size: 0.9rem;
}

.runtime-alert-history-panel__title-copy small {
  font-size: 0.7rem;
}

.runtime-alert-history-panel__list {
  padding: 0.65rem;
  gap: 0.58rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Cada alerta muestra tipo, hora, ticker, estrategia y mensaje; no solo el título. */
.runtime-alert-history-panel__item {
  min-height: 6.9rem;
  padding: 0.78rem 0.82rem 0.82rem 0.92rem;
  gap: 0.34rem;
  flex: 0 0 auto;
}

.runtime-alert-history-panel__topline strong {
  font-size: 0.8rem;
}

.runtime-alert-history-panel__topline small {
  font-size: 0.67rem;
}

.runtime-alert-history-panel__strategy {
  color: #edf5fb;
  font-size: 0.76rem;
  line-height: 1.35;
  white-space: normal;
}

.runtime-alert-history-panel__message {
  display: -webkit-box;
  color: #bacbda;
  font-size: 0.73rem;
  font-weight: 650;
  line-height: 1.46;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

@media (max-width: 1180px) {
  :root {
    --runtime-history-width: 23rem;
  }

  .runtime-alert-history-panel {
    min-width: 20rem;
  }
}

@media (max-width: 920px) {
  body:has(.monitors-workspace--tabs) {
    height: auto;
    overflow: auto;
  }

  body:has(.monitors-workspace--tabs) .app-shell,
  body:has(.monitors-workspace--tabs) .app-main {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  body:has(.monitors-workspace--tabs) .content {
    display: block;
    overflow: visible;
  }

  .monitors-workspace--tabs,
  .runtime-viewer--compact,
  .runtime-operational-grid,
  .runtime-console-panel--primary {
    height: auto;
    overflow: visible;
  }

  .runtime-operational-grid > .runtime-alert-history {
    display: none !important;
  }
}

/* v0.7.8 — alertas detalladas por ticker */
.monitors-workspace--tabs .monitor-tabs--compact,
.monitors-workspace--tabs .monitor-tabs {
  position: sticky;
  top: 0;
  z-index: 85;
  padding-top: 0.3rem;
  background: linear-gradient(180deg, rgba(3, 14, 27, 0.99), rgba(3, 14, 27, 0.96));
  backdrop-filter: blur(8px);
}

.runtime-console-panel--primary > header {
  position: sticky;
  top: 3.25rem;
  z-index: 75;
  background: rgba(6, 20, 34, 0.99);
  box-shadow: 0 1px 0 rgba(112, 151, 183, 0.22);
}

/* El historial comienza debajo de la cabecera de ticker/estrategia. */
.runtime-viewer--compact > .runtime-alert-history-panel {
  top: 3.45rem !important;
}

.runtime-operational-grid > .runtime-alert-history {
  margin-top: 3.45rem;
  height: calc(100% - 3.45rem);
  max-height: calc(100% - 3.45rem);
}

.runtime-alert-history-panel__header,
.runtime-alert-history__header {
  position: sticky;
  top: 0;
  z-index: 4;
}

/* Scroll interno visible; al revisar líneas antiguas no vuelve forzosamente al final. */
.monitors-workspace--tabs .runtime-console--workspace,
.runtime-console--live-compact {
  overflow: auto !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
  scrollbar-width: auto;
  scrollbar-color: rgba(119, 157, 188, 0.72) rgba(7, 20, 33, 0.72);
}

.monitors-workspace--tabs .runtime-console--workspace::-webkit-scrollbar,
.runtime-console--live-compact::-webkit-scrollbar,
.runtime-alert-history-panel__list::-webkit-scrollbar,
.runtime-alert-history__list::-webkit-scrollbar {
  width: 0.86rem;
  height: 0.86rem;
}

.monitors-workspace--tabs .runtime-console--workspace::-webkit-scrollbar-track,
.runtime-console--live-compact::-webkit-scrollbar-track,
.runtime-alert-history-panel__list::-webkit-scrollbar-track,
.runtime-alert-history__list::-webkit-scrollbar-track {
  background: rgba(7, 20, 33, 0.72);
}

.monitors-workspace--tabs .runtime-console--workspace::-webkit-scrollbar-thumb,
.runtime-console--live-compact::-webkit-scrollbar-thumb,
.runtime-alert-history-panel__list::-webkit-scrollbar-thumb,
.runtime-alert-history__list::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: rgba(119, 157, 188, 0.72);
  background-clip: content-box;
}

@media (max-width: 920px) {
  .runtime-console-panel--primary > header {
    top: 3.05rem;
  }

  .runtime-viewer--compact > .runtime-alert-history-panel {
    top: auto !important;
  }

  .runtime-operational-grid > .runtime-alert-history {
    margin-top: 0.65rem;
    height: 16rem;
    max-height: 16rem;
  }
}


/* v0.8.9 — align the injected alert history below the live strategy header */
.runtime-viewer > .runtime-alert-history-panel {
  top: 3.55rem !important;
  bottom: 0 !important;
  height: auto !important;
}

.runtime-viewer > .runtime-alert-history-panel .runtime-alert-history-panel__header {
  position: sticky;
  top: 0;
  z-index: 5;
}

.runtime-viewer > .runtime-alert-history-panel .runtime-alert-history-panel__list {
  min-height: 0;
  overflow-y: auto;
}

/* Keep the console title/control strip fully above the history column. */
.runtime-console-panel--primary > header {
  z-index: 90 !important;
}

@media (max-width: 920px) {
  .runtime-viewer > .runtime-alert-history-panel {
    top: auto !important;
  }
}


/* v0.8.9: use the native ticker-scoped history in Live Strategies. */
.runtime-viewer:has(.runtime-operational-grid > .runtime-alert-history) > .runtime-alert-history-panel { display: none !important; }
.runtime-operational-grid > .runtime-alert-history {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  height: 100% !important;
  max-height: none !important;
  align-self: stretch !important;
}
.runtime-operational-grid > .runtime-alert-history .runtime-alert-history__list { min-height: 0; overflow-y: auto; }


/* v0.8.9 — native Live Strategies workspace, same structure as the global board */
body:has(.monitors-workspace--tabs) {
  overflow: hidden;
}

body:has(.monitors-workspace--tabs) .content {
  min-height: 0;
  padding: 0.45rem 0.75rem 0;
  overflow: hidden;
}

.monitors-workspace--tabs {
  display: grid !important;
  width: 100%;
  height: 100%;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0;
  overflow: hidden !important;
}

.monitors-workspace--tabs .monitor-tabs,
.monitors-workspace--tabs .monitor-tabs--compact {
  position: relative !important;
  top: auto !important;
  z-index: 10;
  min-height: 3rem;
  margin: 0 !important;
  padding: 0.15rem 0 0 !important;
  overflow-x: auto;
  overflow-y: hidden;
  background: #07111f;
  box-shadow: none;
}

.monitors-workspace--tabs .monitor-tab-panel,
.monitors-workspace--tabs .monitor-tab-panel--compact {
  min-height: 0;
  padding: 0 !important;
  overflow: hidden !important;
}

.runtime-viewer--native-grid {
  display: grid !important;
  width: 100%;
  height: 100%;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden !important;
  border: 1px solid rgba(116, 153, 183, 0.2);
  border-radius: 0.7rem 0.7rem 0 0;
  background: #030b13;
}

.runtime-live-toolbar {
  position: relative;
  z-index: 20;
  display: grid;
  min-height: 3rem;
  padding: 0.45rem 0.62rem;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  border-bottom: 1px solid rgba(116, 153, 183, 0.22);
  background: #0b1a2a;
  box-shadow: none;
}

.runtime-live-toolbar .runtime-console-panel__title {
  min-width: 0;
}

.runtime-live-toolbar .runtime-console-controls {
  min-width: 0;
  margin: 0;
}

.runtime-live-body {
  --runtime-history-width: 360px;
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) 0.72rem minmax(280px, var(--runtime-history-width));
  overflow: hidden;
  background: #02080e;
}

.runtime-live-body > .runtime-console {
  width: 100%;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0;
  padding: 0.78rem 0.92rem 1.1rem;
  overflow: auto !important;
  border: 0;
  border-radius: 0;
  white-space: pre;
  overflow-wrap: normal;
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
}

.runtime-live-column-resizer {
  position: relative;
  z-index: 8;
  width: 100%;
  height: 100%;
  cursor: ew-resize;
  touch-action: none;
  background: rgba(7, 18, 31, 0.95);
}

.runtime-live-column-resizer::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.22rem;
  height: 4.5rem;
  content: "";
  border-radius: 999px;
  background: rgba(132, 166, 195, 0.44);
  transform: translate(-50%, -50%);
  transition: background 150ms ease, box-shadow 150ms ease;
}

.runtime-live-column-resizer:hover::after,
body.runtime-live-column-resizing .runtime-live-column-resizer::after {
  background: var(--green);
  box-shadow: 0 0 18px rgba(66, 211, 146, 0.45);
}

body.runtime-live-column-resizing,
body.runtime-live-column-resizing * {
  cursor: ew-resize !important;
  user-select: none !important;
}

.runtime-live-body > .runtime-alert-history {
  position: relative !important;
  inset: auto !important;
  display: flex !important;
  visibility: visible !important;
  width: auto !important;
  min-width: 0 !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 !important;
  align-self: stretch !important;
  flex-direction: column;
  overflow: hidden;
  pointer-events: auto !important;
  border: 0;
  border-left: 1px solid rgba(116, 153, 183, 0.22);
  border-radius: 0;
  background: linear-gradient(180deg, rgba(10, 27, 43, 0.99), rgba(5, 16, 28, 0.99));
}

.runtime-live-body > .runtime-alert-history .runtime-alert-history__header {
  position: relative;
  top: auto;
  z-index: 2;
  flex: 0 0 auto;
}

.runtime-live-body > .runtime-alert-history .runtime-alert-history__list {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.runtime-viewer--native-grid > .runtime-alert-bar {
  position: relative !important;
  z-index: 12;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  width: 100%;
  min-height: 4.8rem;
  max-height: 9.5rem;
  margin: 0;
  padding: 0.62rem 0.85rem;
  grid-template-columns: minmax(8rem, 10rem) minmax(0, 1fr) auto auto;
  border-top-width: 1px;
  box-shadow: 0 -8px 22px rgba(0, 0, 0, 0.28);
}

.runtime-viewer--native-grid > .runtime-alert-bar--idle {
  min-height: 4rem;
  grid-template-columns: auto minmax(0, 1fr);
}

.runtime-viewer--native-grid > .runtime-alert-history-panel {
  display: none !important;
}

@media (max-width: 920px) {
  body:has(.monitors-workspace--tabs) {
    overflow: auto;
  }

  body:has(.monitors-workspace--tabs) .content {
    overflow: visible;
  }

  .monitors-workspace--tabs,
  .runtime-viewer--native-grid {
    height: auto;
    overflow: visible !important;
  }

  .runtime-live-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .runtime-live-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(26rem, 65vh) 16rem;
  }

  .runtime-live-column-resizer {
    display: none;
  }

  .runtime-live-body > .runtime-alert-history {
    border-top: 1px solid rgba(116, 153, 183, 0.22);
    border-left: 0;
  }

  .runtime-viewer--native-grid > .runtime-alert-bar {
    grid-template-columns: minmax(0, 1fr);
    max-height: none;
  }
}


/* v0.8.9 — una sola barra inferior y contenido completo en el historial */
.runtime-live-body {
  grid-template-columns: minmax(0, 1fr) 0.72rem minmax(360px, var(--runtime-history-width));
}

.runtime-live-body > .runtime-alert-history .runtime-alert-history__list {
  gap: 0.62rem;
  padding: 0.68rem;
}

.runtime-live-body > .runtime-alert-history .runtime-alert-history__item {
  min-height: fit-content;
  padding: 0.76rem 0.82rem 0.82rem 0.92rem;
  gap: 0.38rem;
  overflow: visible;
  align-content: start;
}

.runtime-live-body > .runtime-alert-history .runtime-alert-history__item-topline {
  align-items: flex-start;
}

.runtime-live-body > .runtime-alert-history .runtime-alert-history__item-topline strong {
  overflow: visible;
  white-space: normal;
  text-overflow: clip;
  font-size: 0.78rem;
  line-height: 1.25;
}

.runtime-live-body > .runtime-alert-history .runtime-alert-history__strategy {
  overflow: visible;
  white-space: normal;
  text-overflow: clip;
  font-size: 0.73rem;
  line-height: 1.35;
}

.runtime-live-body > .runtime-alert-history .runtime-alert-history__message {
  display: block;
  overflow: visible;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  color: #c1d0dc;
  font-size: 0.72rem;
  line-height: 1.48;
  -webkit-line-clamp: unset;
  -webkit-box-orient: initial;
}

.runtime-viewer--native-grid > .runtime-alert-bar {
  position: relative !important;
  min-height: 64px !important;
  max-height: none !important;
  overflow: hidden;
  padding-top: 0.9rem;
}

.runtime-alert-bar__resize-handle {
  position: absolute;
  z-index: 30;
  top: 0;
  right: 0;
  left: 0;
  height: 0.82rem;
  cursor: ns-resize;
  touch-action: none;
  user-select: none;
}

.runtime-alert-bar__resize-handle::after {
  position: absolute;
  top: 0.24rem;
  left: 50%;
  width: 5.4rem;
  height: 0.24rem;
  content: "";
  border-radius: 999px;
  background: rgba(189, 211, 227, 0.46);
  transform: translateX(-50%);
  transition: width 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.runtime-alert-bar__resize-handle:hover::after,
body.runtime-live-alert-resizing .runtime-alert-bar__resize-handle::after {
  width: 7.4rem;
  background: var(--green);
  box-shadow: 0 0 14px rgba(66, 211, 146, 0.45);
}

body.runtime-live-alert-resizing,
body.runtime-live-alert-resizing * {
  cursor: ns-resize !important;
  user-select: none !important;
}

/* Defensa contra la barra antigua inyectada por la capa global. */
.app-shell:has(.runtime-viewer--native-grid) > #runtime-alert-idle-bar,
.app-shell:has(.runtime-viewer--native-grid) > .runtime-alert-idle-bar,
.app-shell:has(.runtime-viewer--native-grid) > .runtime-alert-backdrop {
  display: none !important;
}

@media (max-width: 920px) {
  .runtime-live-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .runtime-live-body > .runtime-alert-history .runtime-alert-history__message {
    font-size: 0.7rem;
  }
}

/* WEB v0.8.9 — contrato sombra visible y espacio operativo completo */
body:has(.monitors-workspace--tabs),
body:has(.monitors-workspace--tabs) #root,
body:has(.monitors-workspace--tabs) .app-shell {
  width: 100%;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}
body:has(.monitors-workspace--tabs) .app-main {
  display: grid;
  height: 100vh;
  min-height: 0;
  grid-template-rows: 4.5rem minmax(0, 1fr);
  overflow: hidden;
}
body:has(.monitors-workspace--tabs) .topbar { position: relative; top: auto; height: 4.5rem; }
body:has(.monitors-workspace--tabs) .content {
  width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0.45rem 0.75rem 0; overflow: hidden;
}
.monitors-workspace--tabs,
.monitors-workspace--tabs .monitor-tab-panel,
.monitors-workspace--tabs .monitor-tab-panel--compact,
.runtime-viewer--native-grid { height: 100% !important; min-height: 0 !important; }
.runtime-viewer--native-grid { grid-template-rows: auto auto minmax(0, 1fr) auto !important; }
.runtime-viewer--native-grid > .option-shadow-strip {
  display: grid !important; visibility: visible !important; min-height: 3.35rem; max-height: none; opacity: 1 !important; overflow: visible;
}
.runtime-live-body { min-height: 0 !important; height: 100% !important; }
.runtime-viewer--native-grid > .runtime-alert-bar { align-self: end; margin-top: 0 !important; }
.option-shadow-strip__actions button { min-width: 10.5rem; }

/* WEB v0.8.9 — cierre del contrato y eliminación del espacio inferior */
.monitors-workspace--tabs .monitor-tab-panel,
.monitors-workspace--tabs .monitor-tab-panel--compact {
  display: grid !important;
  grid-template-rows: minmax(0, 1fr) !important;
  min-height: 0 !important;
}
.runtime-viewer--native-grid {
  height: 100% !important;
  min-height: 0 !important;
  max-height: 100% !important;
  align-content: stretch !important;
  grid-template-rows: auto auto minmax(0, 1fr) var(--runtime-live-alert-height, 84px) !important;
}
.runtime-viewer--native-grid > .runtime-alert-bar,
.runtime-viewer--native-grid > .runtime-alert-bar--idle {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 !important;
  align-self: stretch !important;
  overflow: hidden;
}
.runtime-viewer--native-grid > .runtime-alert-bar .runtime-alert-bar__content {
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  scrollbar-gutter: stable;
}
.runtime-contract-exit-report {
  margin: 0.48rem 0 0;
  padding: 0.58rem 0.65rem;
  overflow: visible;
  color: #cfe0ec;
  border: 1px solid rgba(66, 211, 146, 0.24);
  border-radius: 0.5rem;
  background: rgba(2, 10, 18, 0.72);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.67rem;
  font-weight: 650;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.runtime-contract-exit-report--history {
  width: 100%;
  max-height: none;
  margin-top: 0.45rem;
  color: #d8e6ef;
  font-size: 0.65rem;
  text-align: left;
}
.runtime-alert-bar .runtime-contract-exit-report {
  max-height: calc(var(--runtime-live-alert-height, 84px) - 3.2rem);
  overflow: auto;
}
@media (max-width: 920px) {
  .runtime-viewer--native-grid {
    height: auto !important;
    max-height: none !important;
    grid-template-rows: auto auto auto auto !important;
  }
  .runtime-viewer--native-grid > .runtime-alert-bar,
  .runtime-viewer--native-grid > .runtime-alert-bar--idle {
    min-height: 5rem !important;
    height: auto !important;
  }
}

/* WEB v0.8.9 — grabación configurable por ticker para replay */
.runtime-viewer--native-grid {
  grid-template-rows: auto auto auto minmax(0, 1fr) var(--runtime-live-alert-height, 84px) !important;
}

.recording-strip {
  position: relative;
  z-index: 16;
  display: grid;
  min-height: 3.3rem;
  padding: 0.45rem 0.65rem;
  grid-template-columns: minmax(9.5rem, 0.75fr) minmax(15rem, 1.6fr) auto;
  align-items: center;
  gap: 0.8rem;
  border-bottom: 1px solid rgba(116, 153, 183, 0.2);
  background: linear-gradient(90deg, rgba(8, 25, 40, 0.98), rgba(6, 18, 31, 0.98));
}

.recording-strip--active {
  border-bottom-color: rgba(66, 211, 146, 0.35);
  background: linear-gradient(90deg, rgba(8, 36, 37, 0.98), rgba(6, 22, 34, 0.98));
}

.recording-strip__mode,
.recording-strip__details {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.55rem;
}

.recording-strip__mode svg {
  flex: 0 0 auto;
  color: var(--green);
}

.recording-strip__mode span,
.recording-strip__details {
  display: grid;
  gap: 0.05rem;
}

.recording-strip small {
  color: #8299ad;
  font-size: 0.58rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.recording-strip strong {
  overflow: hidden;
  color: #eff6fb;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recording-strip__details span {
  overflow: hidden;
  color: #9eb1c2;
  font-size: 0.62rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recording-strip__controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.recording-strip__controls select {
  min-width: 10.5rem;
  height: 2rem;
  padding: 0 1.8rem 0 0.58rem;
  color: #eaf2f8;
  border: 1px solid rgba(116, 153, 183, 0.28);
  border-radius: 0.45rem;
  outline: 0;
  background: #071522;
  font-size: 0.64rem;
  font-weight: 800;
}

.recording-strip__controls button {
  min-width: 9.7rem;
}

.recording-strip__error {
  position: absolute;
  right: 0.7rem;
  bottom: -1.05rem;
  z-index: 4;
  margin: 0;
  color: #ff9a9f;
  font-size: 0.58rem;
}

@media (max-width: 1100px) {
  .recording-strip {
    grid-template-columns: minmax(8rem, 0.8fr) minmax(12rem, 1fr) auto;
  }
  .recording-strip__details span {
    display: none;
  }
}

@media (max-width: 760px) {
  .runtime-viewer--native-grid {
    grid-template-rows: auto auto auto minmax(24rem, 1fr) auto !important;
  }
  .recording-strip {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }
  .recording-strip__controls {
    justify-content: stretch;
  }
  .recording-strip__controls select,
  .recording-strip__controls button {
    flex: 1 1 0;
    min-width: 0;
  }
}
