/* 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);
  }
}
