/* ==========================================================
   TVABIERTA MISSION CONTROL
   Design System v1.0 · Core v4
   Capa visual sin cambios funcionales
   ========================================================== */

:root {
  color-scheme: dark;

  /* Color */
  --mc-bg-0: #03070c;
  --mc-bg-1: #071019;
  --mc-bg-2: #0a1620;
  --mc-surface-1: rgba(13, 27, 38, 0.86);
  --mc-surface-2: rgba(17, 35, 48, 0.92);
  --mc-surface-3: rgba(22, 44, 59, 0.92);

  --mc-line-soft: rgba(148, 190, 220, 0.10);
  --mc-line: rgba(126, 181, 219, 0.18);
  --mc-line-strong: rgba(109, 190, 247, 0.30);

  --mc-text: #f7fbff;
  --mc-text-soft: #c5d4de;
  --mc-muted: #8298a7;
  --mc-muted-2: #5e7585;

  --mc-blue: #63b9ff;
  --mc-blue-bright: #91d2ff;
  --mc-cyan: #45d9ef;
  --mc-green: #55e59a;
  --mc-yellow: #f3ce73;
  --mc-red: #ff7e87;
  --mc-purple: #b89cff;

  /* Geometry */
  --mc-radius-xs: 8px;
  --mc-radius-sm: 11px;
  --mc-radius-md: 15px;
  --mc-radius-lg: 20px;
  --mc-radius-xl: 26px;

  /* Spacing */
  --mc-space-1: 4px;
  --mc-space-2: 8px;
  --mc-space-3: 12px;
  --mc-space-4: 16px;
  --mc-space-5: 24px;
  --mc-space-6: 32px;
  --mc-space-7: 48px;

  /* Elevation */
  --mc-shadow-sm:
    0 8px 24px rgba(0, 0, 0, 0.18);

  --mc-shadow-md:
    0 18px 55px rgba(0, 0, 0, 0.28);

  --mc-shadow-glow:
    0 0 0 1px rgba(102, 187, 255, 0.05),
    0 18px 50px rgba(0, 92, 163, 0.11);

  /* Motion */
  --mc-fast: 130ms;
  --mc-normal: 220ms;
  --mc-slow: 420ms;

  /* Compatibility with current stylesheet */
  --bg: var(--mc-bg-0);
  --panel: var(--mc-surface-1);
  --line: var(--mc-line);
  --text: var(--mc-text);
  --muted: var(--mc-muted);
  --blue: var(--mc-blue);
  --green: var(--mc-green);
  --red: var(--mc-red);
  --yellow: var(--mc-yellow);
  --purple: var(--mc-purple);
}

/* ==========================================================
   BASE
   ========================================================== */

* {
  scrollbar-width: thin;
  scrollbar-color:
    rgba(114, 174, 215, 0.32)
    rgba(4, 10, 15, 0.45);
}

html {
  background: var(--mc-bg-0);
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(
      circle at 8% -10%,
      rgba(53, 144, 211, 0.19),
      transparent 29%
    ),
    radial-gradient(
      circle at 92% 2%,
      rgba(69, 217, 239, 0.08),
      transparent 24%
    ),
    linear-gradient(
      180deg,
      var(--mc-bg-1) 0%,
      var(--mc-bg-0) 58%,
      #020509 100%
    );
  color: var(--mc-text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  letter-spacing: -0.005em;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: 0.24;
  background-image:
    linear-gradient(
      rgba(255, 255, 255, 0.016) 1px,
      transparent 1px
    ),
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.016) 1px,
      transparent 1px
    );
  background-size: 42px 42px;
  mask-image:
    linear-gradient(
      to bottom,
      black,
      transparent 78%
    );
}

body::after {
  content: "";
  position: fixed;
  width: 520px;
  height: 520px;
  right: -260px;
  bottom: -300px;
  z-index: -1;
  pointer-events: none;
  border-radius: 50%;
  background:
    radial-gradient(
      circle,
      rgba(54, 165, 235, 0.10),
      transparent 66%
    );
}

/* ==========================================================
   TOPBAR / BRAND
   ========================================================== */

.topbar {
  min-height: 88px;
  padding:
    18px
    clamp(18px, 4vw, 64px);
  border-bottom:
    1px solid
    var(--mc-line-soft);
  background:
    linear-gradient(
      180deg,
      rgba(7, 16, 25, 0.94),
      rgba(5, 12, 19, 0.84)
    );
  box-shadow:
    0 12px 42px rgba(0, 0, 0, 0.18);
  backdrop-filter:
    blur(22px)
    saturate(1.25);
}

.brand {
  gap: 15px;
}

.brand-mark {
  position: relative;
  width: 52px;
  height: 52px;
  overflow: hidden;
  border:
    1px solid
    rgba(116, 199, 255, 0.33);
  border-radius: 16px;
  background:
    linear-gradient(
      145deg,
      rgba(32, 89, 127, 0.72),
      rgba(8, 27, 40, 0.94)
    );
  color: #ffffff;
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.10),
    0 10px 30px rgba(29, 133, 204, 0.15);
  font-size: 13px;
  letter-spacing: 0.06em;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: -45%;
  transform: rotate(35deg);
  background:
    linear-gradient(
      90deg,
      transparent,
      rgba(255, 255, 255, 0.13),
      transparent
    );
}

.brand small,
.section-title small,
.dialog-head small {
  color: var(--mc-blue-bright);
  letter-spacing: 0.17em;
}

.brand h1 {
  margin: 2px 0 1px;
  font-size:
    clamp(21px, 2.2vw, 28px);
  font-weight: 790;
  letter-spacing: -0.035em;
}

.brand h1 span {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  margin-left: 5px;
  padding: 2px 7px;
  border:
    1px solid
    rgba(99, 185, 255, 0.18);
  border-radius: 999px;
  background:
    rgba(99, 185, 255, 0.08);
  color: var(--mc-blue-bright);
  font-size: 10px;
  letter-spacing: 0.08em;
  vertical-align: middle;
}

.brand p {
  color: var(--mc-muted);
  font-size: 11px;
}

.top-actions {
  gap: 8px;
}

/* ==========================================================
   BUTTONS / CONTROLS
   ========================================================== */

button,
.button {
  min-height: 36px;
  padding: 8px 12px;
  border:
    1px solid
    rgba(117, 172, 210, 0.25);
  border-radius: var(--mc-radius-sm);
  background:
    linear-gradient(
      180deg,
      rgba(23, 47, 64, 0.92),
      rgba(14, 31, 43, 0.92)
    );
  color: var(--mc-text-soft);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.035);
  font-weight: 650;
  transition:
    transform var(--mc-fast) ease,
    border-color var(--mc-normal) ease,
    background var(--mc-normal) ease,
    color var(--mc-normal) ease,
    box-shadow var(--mc-normal) ease;
}

button:hover,
.button:hover {
  transform: translateY(-1px);
  border-color:
    rgba(116, 196, 250, 0.46);
  background:
    linear-gradient(
      180deg,
      rgba(29, 59, 79, 0.98),
      rgba(17, 39, 53, 0.98)
    );
  color: #ffffff;
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.16);
}

button:active,
.button:active {
  transform: translateY(0);
}

button:focus-visible,
.button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline:
    2px solid
    rgba(99, 185, 255, 0.86);
  outline-offset: 2px;
}

.primary {
  border-color:
    rgba(121, 207, 255, 0.45);
  background:
    linear-gradient(
      135deg,
      #8fd3ff,
      #55b7f4
    );
  color: #031018;
  box-shadow:
    0 10px 26px rgba(45, 157, 226, 0.20);
}

.primary:hover {
  border-color:
    rgba(179, 226, 255, 0.75);
  background:
    linear-gradient(
      135deg,
      #b0e2ff,
      #6fc5fa
    );
  color: #020b11;
  box-shadow:
    0 14px 32px rgba(45, 157, 226, 0.28);
}

.danger {
  color: #ffc2c5;
  border-color:
    rgba(255, 126, 135, 0.28);
}

.danger:hover {
  border-color:
    rgba(255, 126, 135, 0.52);
  background:
    rgba(255, 126, 135, 0.10);
}

.success {
  color: #c3f8d8;
  border-color:
    rgba(85, 229, 154, 0.28);
}

.pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border:
    1px solid
    rgba(137, 181, 211, 0.22);
  background:
    rgba(13, 28, 39, 0.75);
  color: var(--mc-muted);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.035);
}

.pill.connected {
  color: var(--mc-green);
  border-color:
    rgba(85, 229, 154, 0.23);
  background:
    rgba(85, 229, 154, 0.055);
}

.pill.disconnected {
  color: var(--mc-red);
  border-color:
    rgba(255, 126, 135, 0.23);
}

/* ==========================================================
   PAGE LAYOUT
   ========================================================== */

main {
  width: min(1760px, 100%);
  margin: 0 auto;
  padding:
    28px
    clamp(18px, 4vw, 64px)
    72px;
}

/* ==========================================================
   SUMMARY / SYSTEM HEALTH
   ========================================================== */

.summary {
  gap: 12px;
}

.summary article {
  position: relative;
  min-height: 112px;
  overflow: hidden;
  padding: 18px;
  border:
    1px solid
    var(--mc-line);
  border-radius: var(--mc-radius-md);
  background:
    linear-gradient(
      145deg,
      rgba(18, 39, 53, 0.90),
      rgba(8, 20, 29, 0.90)
    );
  box-shadow: var(--mc-shadow-glow);
  transition:
    transform var(--mc-normal) ease,
    border-color var(--mc-normal) ease,
    box-shadow var(--mc-normal) ease;
}

.summary article::after {
  content: "";
  position: absolute;
  width: 120px;
  height: 120px;
  right: -48px;
  bottom: -62px;
  border-radius: 50%;
  background:
    radial-gradient(
      circle,
      rgba(99, 185, 255, 0.14),
      transparent 68%
    );
}

.summary article:hover {
  transform: translateY(-2px);
  border-color:
    rgba(102, 190, 247, 0.34);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.24);
}

.summary small {
  color: var(--mc-muted);
  letter-spacing: 0.11em;
}

.summary b {
  position: relative;
  z-index: 1;
  margin-top: 5px;
  font-size:
    clamp(29px, 3vw, 38px);
  font-weight: 790;
  letter-spacing: -0.055em;
}

.summary span {
  color: var(--mc-muted-2);
  font-size: 10px;
}

.health {
  gap: 8px;
  margin: 12px 0 25px;
  padding: 10px;
  border:
    1px solid
    var(--mc-line-soft);
  border-radius: var(--mc-radius-md);
  background:
    rgba(9, 21, 30, 0.68);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.025);
}

.health div {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border:
    1px solid
    rgba(85, 229, 154, 0.08);
  border-radius: var(--mc-radius-xs);
  background:
    rgba(85, 229, 154, 0.025);
  color: var(--mc-green);
}

.health b {
  margin-left: auto;
  color: var(--mc-text-soft);
}

/* ==========================================================
   TOOLBAR
   ========================================================== */

.toolbar {
  align-items: center;
  margin-bottom: 28px;
  padding: 10px;
  border:
    1px solid
    var(--mc-line-soft);
  border-radius: var(--mc-radius-md);
  background:
    rgba(8, 20, 29, 0.63);
  backdrop-filter: blur(14px);
}

input,
select {
  min-height: 40px;
  border:
    1px solid
    rgba(116, 174, 214, 0.23);
  border-radius: var(--mc-radius-sm);
  background:
    rgba(4, 13, 20, 0.84);
  color: var(--mc-text);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.25);
  transition:
    border-color var(--mc-normal) ease,
    background var(--mc-normal) ease,
    box-shadow var(--mc-normal) ease;
}

input:hover,
select:hover {
  border-color:
    rgba(116, 190, 239, 0.34);
}

input:focus,
select:focus {
  border-color:
    rgba(105, 194, 252, 0.58);
  background:
    rgba(5, 16, 24, 0.98);
  box-shadow:
    0 0 0 3px rgba(99, 185, 255, 0.08);
}

.filter {
  min-height: 34px;
  background: transparent;
  color: var(--mc-muted);
}

.filter.active {
  border-color:
    rgba(99, 185, 255, 0.33);
  background:
    linear-gradient(
      180deg,
      rgba(99, 185, 255, 0.15),
      rgba(99, 185, 255, 0.07)
    );
  color: var(--mc-blue-bright);
}

.section-title {
  margin-bottom: 14px;
}

.section-title h2 {
  font-size: 20px;
  letter-spacing: -0.025em;
}

.section-title span {
  padding: 5px 9px;
  border:
    1px solid
    var(--mc-line-soft);
  border-radius: 999px;
  background:
    rgba(255, 255, 255, 0.025);
}

/* ==========================================================
   STREAM GRID / CARDS
   ========================================================== */

.grid {
  grid-template-columns:
    repeat(
      auto-fill,
      minmax(355px, 1fr)
    );
  gap: 15px;
}

.card {
  position: relative;
  overflow: hidden;
  border:
    1px solid
    var(--mc-line);
  border-radius: var(--mc-radius-lg);
  background:
    linear-gradient(
      150deg,
      rgba(15, 32, 44, 0.97),
      rgba(6, 17, 25, 0.97)
    );
  box-shadow:
    var(--mc-shadow-sm),
    inset 0 1px rgba(255, 255, 255, 0.025);
  transform: translateZ(0);
  transition:
    transform var(--mc-normal) ease,
    border-color var(--mc-normal) ease,
    box-shadow var(--mc-normal) ease;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  border-radius: inherit;
  background:
    linear-gradient(
      120deg,
      rgba(113, 202, 255, 0.035),
      transparent 28%,
      transparent 75%,
      rgba(69, 217, 239, 0.025)
    );
}

.card:hover {
  transform: translateY(-3px);
  border-color:
    rgba(105, 190, 245, 0.34);
  box-shadow:
    0 22px 58px rgba(0, 0, 0, 0.32),
    0 0 0 1px rgba(86, 182, 245, 0.035);
}

.card > * {
  position: relative;
  z-index: 1;
}

.cardhead {
  padding: 17px 17px 11px;
}

.card h3 {
  margin-top: 10px;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.card p {
  color: var(--mc-muted);
}

.mode,
.status {
  min-height: 23px;
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  letter-spacing: 0.06em;
}

.status.online {
  color: var(--mc-green);
  border:
    1px solid
    rgba(85, 229, 154, 0.17);
  background:
    rgba(85, 229, 154, 0.075);
}

.status.online::before {
  content: "";
  width: 5px;
  height: 5px;
  margin-right: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow:
    0 0 10px currentColor;
  animation:
    mc-status-pulse
    2.4s ease-in-out infinite;
}

.status.offline {
  color: var(--mc-red);
  border:
    1px solid
    rgba(255, 126, 135, 0.17);
  background:
    rgba(255, 126, 135, 0.065);
}

.play {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    linear-gradient(
      145deg,
      rgba(105, 194, 252, 0.20),
      rgba(20, 59, 82, 0.76)
    );
  color: var(--mc-blue-bright);
}

.monitor {
  min-height: 134px;
  margin:
    0
    16px;
  overflow: hidden;
  border:
    1px solid
    rgba(103, 180, 229, 0.16);
  border-radius: var(--mc-radius-sm);
  background:
    radial-gradient(
      circle at 50% 48%,
      rgba(39, 90, 123, 0.26),
      rgba(5, 14, 21, 0.95) 64%
    );
}

.monitor::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(
      180deg,
      transparent,
      rgba(57, 164, 227, 0.035),
      transparent
    );
  transform: translateY(-100%);
  animation:
    mc-monitor-scan
    5s linear infinite;
}

.scan {
  opacity: 0.07;
  background-size: 29px 29px;
}

.tech {
  gap: 7px;
  padding:
    11px
    16px;
}

.tech div {
  padding: 9px;
  border:
    1px solid
    rgba(255, 255, 255, 0.055);
  border-radius: var(--mc-radius-xs);
  background:
    rgba(255, 255, 255, 0.023);
}

.tech small,
.detailcards small,
.pipeline small {
  color: var(--mc-muted-2);
  letter-spacing: 0.08em;
}

.tech b {
  margin-top: 2px;
  color: var(--mc-text-soft);
}

.pipeline {
  gap: 6px;
  padding:
    0
    16px
    11px;
}

.pipeline div {
  border:
    1px solid
    rgba(255, 255, 255, 0.055);
  background:
    rgba(255, 255, 255, 0.025);
}

.pipeline .accent {
  border-color:
    rgba(99, 185, 255, 0.20);
  background:
    rgba(99, 185, 255, 0.055);
}

.pipeline .process {
  border-color:
    rgba(184, 156, 255, 0.22);
  background:
    rgba(184, 156, 255, 0.055);
}

.runtimebar {
  margin:
    0
    16px
    11px;
  border-radius: var(--mc-radius-xs);
}

.card > .actions {
  padding:
    2px
    16px
    16px;
  border-top:
    1px solid
    rgba(255, 255, 255, 0.035);
  padding-top: 13px;
}

/* ==========================================================
   DIALOGS
   ========================================================== */

dialog {
  width:
    min(
      920px,
      calc(100vw - 28px)
    );
  max-height:
    calc(100vh - 28px);
  padding: 22px;
  border:
    1px solid
    rgba(112, 185, 232, 0.25);
  border-radius: var(--mc-radius-xl);
  background:
    linear-gradient(
      155deg,
      rgba(12, 28, 39, 0.985),
      rgba(5, 15, 23, 0.99)
    );
  box-shadow:
    0 35px 110px rgba(0, 0, 0, 0.62),
    inset 0 1px rgba(255, 255, 255, 0.045);
}

dialog[open] {
  animation:
    mc-dialog-enter
    var(--mc-normal)
    cubic-bezier(.2, .8, .2, 1);
}

dialog::backdrop {
  background:
    rgba(0, 4, 8, 0.79);
  backdrop-filter:
    blur(9px)
    saturate(0.75);
}

.dialog-head {
  align-items: flex-start;
  padding-bottom: 15px;
  border-bottom:
    1px solid
    var(--mc-line-soft);
}

.dialog-head h2 {
  font-size: 22px;
  letter-spacing: -0.03em;
}

.dialog-head p {
  max-width: 680px;
  color: var(--mc-muted);
  line-height: 1.55;
}

.dialog-head > button {
  border-radius: 50%;
}

label {
  color: var(--mc-text-soft);
  font-weight: 650;
}

.probe,
.push-toolbar,
.push-form,
.push-list {
  border-color:
    var(--mc-line);
  background:
    rgba(8, 20, 29, 0.70);
}

video {
  margin-top: 16px;
  border:
    1px solid
    rgba(116, 185, 228, 0.18);
  border-radius: var(--mc-radius-md);
  box-shadow:
    0 20px 55px rgba(0, 0, 0, 0.32);
}

pre {
  border:
    1px solid
    rgba(109, 173, 213, 0.16);
  border-radius: var(--mc-radius-sm);
  background:
    #03090e;
  color: #bdd0dc;
  line-height: 1.55;
}

/* ==========================================================
   ANIMATION
   ========================================================== */

@keyframes mc-status-pulse {
  0%,
  100% {
    opacity: 0.72;
    transform: scale(0.9);
  }

  50% {
    opacity: 1;
    transform: scale(1.15);
  }
}

@keyframes mc-monitor-scan {
  from {
    transform: translateY(-100%);
  }

  to {
    transform: translateY(100%);
  }
}

@keyframes mc-dialog-enter {
  from {
    opacity: 0;
    transform:
      translateY(8px)
      scale(0.985);
  }

  to {
    opacity: 1;
    transform:
      translateY(0)
      scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================
   RESPONSIVE
   ========================================================== */

@media (max-width: 1100px) {
  .topbar {
    align-items: flex-start;
  }

  .top-actions {
    justify-content: flex-end;
  }

  .grid {
    grid-template-columns:
      repeat(
        auto-fill,
        minmax(320px, 1fr)
      );
  }
}

@media (max-width: 900px) {
  .summary {
    grid-template-columns:
      repeat(2, 1fr);
  }

  .health {
    grid-template-columns:
      repeat(2, 1fr);
  }
}

@media (max-width: 700px) {
  .topbar {
    position: relative;
    padding: 17px;
  }

  .brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 14px;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  main {
    padding:
      19px
      14px
      56px;
  }

  .toolbar {
    align-items: stretch;
  }

  .summary article {
    min-height: 100px;
    padding: 15px;
  }

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

  .card {
    border-radius: var(--mc-radius-md);
  }

  .monitor {
    margin:
      0
      13px;
  }

  .tech,
  .pipeline,
  .card > .actions {
    padding-left: 13px;
    padding-right: 13px;
  }

  dialog {
    width:
      calc(100vw - 16px);
    max-height:
      calc(100vh - 16px);
    padding: 16px;
    border-radius: 18px;
  }
}

@media (max-width: 460px) {
  .summary {
    gap: 8px;
  }

  .summary article {
    min-height: 91px;
  }

  .summary b {
    font-size: 27px;
  }

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

  .tech {
    grid-template-columns:
      repeat(2, 1fr);
  }

  .top-actions button,
  .top-actions .pill {
    flex: 1 1 auto;
    justify-content: center;
  }
}
