/* ==========================================================================
   SDK PODS · AI FACTORY — Mission Control Stylesheet
   Zero-build static CSS · Deep space telemetry aesthetic
   ========================================================================== */

:root {
  --bg: #070b14;
  --panel: #0d1322;
  --panel-elevated: #111a2e;
  --panel-inset: #090e1a;
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(34, 211, 238, 0.34);

  --text-primary: #e6eefb;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --cyan: #22d3ee;
  --cyan-soft: rgba(34, 211, 238, 0.14);
  --cyan-glow: rgba(34, 211, 238, 0.32);

  --emerald: #34d399;
  --emerald-soft: rgba(52, 211, 153, 0.14);
  --emerald-glow: rgba(52, 211, 153, 0.32);

  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.14);
  --amber-glow: rgba(251, 191, 36, 0.32);

  --rose: #fb7185;
  --rose-soft: rgba(251, 113, 133, 0.14);

  --slate-soft: rgba(148, 163, 184, 0.12);

  --font-sans: "PingFang SC", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --radius: 6px;
  --radius-sm: 4px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

/* ---------- Ambient Tactical Background ---------- */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(34, 211, 238, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(34, 211, 238, 0.045) 1px, transparent 1px),
    linear-gradient(to right, rgba(34, 211, 238, 0.09) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(34, 211, 238, 0.09) 1px, transparent 1px);
  background-size: 28px 28px, 28px 28px, 140px 140px, 140px 140px;
}

.bg-scanlines {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.015) 0px,
    rgba(255, 255, 255, 0.015) 1px,
    transparent 1px,
    transparent 4px
  );
  opacity: 0.7;
}

.bg-vignette {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 75% 40% at 50% 0%, rgba(34, 211, 238, 0.08), transparent 65%),
    radial-gradient(ellipse 100% 100% at 50% 50%, transparent 45%, rgba(3, 6, 12, 0.75) 100%);
}

/* ---------- Layout Shell ---------- */
.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1460px;
  margin: 0 auto;
  padding: 18px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.mission-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ---------- Tactical Panel with Corner Brackets ---------- */
.panel {
  position: relative;
  background: linear-gradient(180deg, rgba(16, 24, 42, 0.92) 0%, rgba(13, 19, 34, 0.96) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(2, 6, 14, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.corner {
  position: absolute;
  width: 9px;
  height: 9px;
  pointer-events: none;
  border-color: rgba(34, 211, 238, 0.55);
  border-style: solid;
  border-width: 0;
}

.corner.tl { top: -1px; left: -1px; border-top-width: 1.5px; border-left-width: 1.5px; border-top-left-radius: 2px; }
.corner.tr { top: -1px; right: -1px; border-top-width: 1.5px; border-right-width: 1.5px; border-top-right-radius: 2px; }
.corner.bl { bottom: -1px; left: -1px; border-bottom-width: 1.5px; border-left-width: 1.5px; border-bottom-left-radius: 2px; }
.corner.br { bottom: -1px; right: -1px; border-bottom-width: 1.5px; border-right-width: 1.5px; border-bottom-right-radius: 2px; }

/* ---------- Section Headers ---------- */
.section-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.section-title-group {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.section-index {
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
  padding: 2px 6px;
  border: 1px solid rgba(34, 211, 238, 0.35);
  background: rgba(34, 211, 238, 0.08);
  border-radius: 3px;
  letter-spacing: 0.08em;
}

.section-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.section-tag {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-meta {
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

/* ---------- 1. Top Telemetry Bar ---------- */
.telemetry-bar {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-emblem {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  color: var(--cyan);
  filter: drop-shadow(0 0 10px rgba(34, 211, 238, 0.25));
}

.brand-emblem svg {
  width: 100%;
  height: 100%;
  display: block;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.brand-title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-primary);
}

.brand-subtitle {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.subtitle-domain {
  color: var(--cyan);
  font-size: 12px;
}

.subtitle-sep {
  color: var(--text-muted);
}

/* Status Beacons & Pulsing Dots */
.beacon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  border: 1px solid transparent;
}

.beacon-online {
  color: var(--emerald);
  background: var(--emerald-soft);
  border-color: rgba(52, 211, 153, 0.35);
}

.beacon-lost,
.beacon-degraded {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: rgba(251, 191, 36, 0.42);
}

.beacon-offline {
  color: var(--rose);
  background: var(--rose-soft);
  border-color: rgba(251, 113, 133, 0.4);
}

.beacon-dot {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: currentColor;
  flex-shrink: 0;
}

.beacon-online .beacon-dot::after,
.status-dot.is-pulsing::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  animation: heartbeat-ring 1.9s cubic-bezier(0.2, 0.7, 0.2, 1) infinite;
}

.beacon-dot-amber {
  color: var(--amber);
  background-color: var(--amber);
}

@keyframes heartbeat-ring {
  0% {
    transform: scale(0.75);
    opacity: 0.9;
  }
  70% {
    transform: scale(2.1);
    opacity: 0;
  }
  100% {
    transform: scale(2.1);
    opacity: 0;
  }
}

.telemetry-metrics {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.metric-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 5px 11px;
  background: rgba(7, 11, 20, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: var(--radius-sm);
  min-width: 108px;
}

.metric-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.metric-value {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.metric-accent-cyan {
  color: var(--cyan);
}

.metric-dim {
  color: var(--text-secondary);
  font-weight: 400;
  font-size: 11px;
}

.metric-poll {
  min-width: 118px;
}

.poll-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.poll-track {
  margin-top: 4px;
  width: 100%;
  height: 3px;
  background: rgba(148, 163, 184, 0.16);
  border-radius: 99px;
  overflow: hidden;
}

.poll-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--emerald));
  transform-origin: left center;
  transition: width 0.35s linear;
}

.refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(34, 211, 238, 0.42);
  background: rgba(34, 211, 238, 0.1);
  color: var(--cyan);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
}

.refresh-btn:hover {
  background: rgba(34, 211, 238, 0.18);
  border-color: var(--cyan);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.22);
}

.refresh-btn:active {
  transform: translateY(1px);
}

.refresh-btn:focus-visible,
.filter-btn:focus-visible,
.search-input:focus-visible,
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.refresh-btn.is-loading .refresh-icon {
  animation: spin 0.75s linear infinite;
}

.refresh-icon {
  width: 14px;
  height: 14px;
}

.btn-en {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  opacity: 0.85;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Signal Lost Alert Banner ---------- */
.signal-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(251, 191, 36, 0.48);
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.14), rgba(251, 191, 36, 0.06));
  color: #fde68a;
}

.signal-banner-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.signal-code {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--amber);
  padding: 2px 7px;
  border: 1px solid rgba(251, 191, 36, 0.45);
  border-radius: 3px;
  background: rgba(251, 191, 36, 0.12);
}

.signal-text {
  font-size: 13px;
}

.signal-retry {
  font-size: 11px;
  color: var(--amber);
  letter-spacing: 0.08em;
}

/* ---------- 2. Agent Workstations ---------- */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 14px;
}

.agent-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 15px 16px 14px;
  background: linear-gradient(180deg, rgba(16, 24, 42, 0.94) 0%, rgba(13, 19, 34, 0.97) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.agent-card:hover {
  border-color: rgba(34, 211, 238, 0.34);
}

.agent-card.is-running {
  border-color: rgba(34, 211, 238, 0.3);
  box-shadow: 0 8px 26px rgba(2, 6, 14, 0.45), inset 0 1px 0 rgba(34, 211, 238, 0.12);
}

.agent-card.is-waiting {
  border-color: rgba(251, 191, 36, 0.26);
}

.agent-card.is-stale {
  border-color: rgba(148, 163, 184, 0.22);
}

.agent-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.agent-identity {
  min-width: 0;
}

.agent-name {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.agent-role {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.agent-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.status-dot {
  position: relative;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.status-running {
  color: var(--cyan);
  background: var(--cyan-soft);
  border-color: rgba(34, 211, 238, 0.38);
}

.status-waiting {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: rgba(251, 191, 36, 0.36);
}

.status-idle {
  color: var(--text-secondary);
  background: var(--slate-soft);
  border-color: rgba(148, 163, 184, 0.22);
}

.status-paused {
  color: var(--rose);
  background: var(--rose-soft);
  border-color: rgba(251, 113, 133, 0.35);
}

.stale-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  background: rgba(100, 116, 139, 0.14);
  border: 1px dashed rgba(148, 163, 184, 0.3);
}

.agent-task {
  margin: 0;
  min-height: 38px;
  font-size: 13px;
  color: #d6e2f5;
  padding: 8px 10px;
  background: var(--panel-inset);
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: var(--radius-sm);
  line-height: 1.45;
}

.agent-progress-block {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.agent-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stage-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  color: var(--text-primary);
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.22);
}

.progress-pct {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.progress-track {
  width: 100%;
  height: 5px;
  background: rgba(148, 163, 184, 0.14);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
}

.progress-fill.fill-running {
  background: linear-gradient(90deg, #06b6d4, var(--cyan));
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.45);
}

.progress-fill.fill-waiting {
  background: linear-gradient(90deg, #d97706, var(--amber));
}

.progress-fill.fill-idle {
  background: #475569;
}

.progress-fill.fill-paused {
  background: linear-gradient(90deg, #e11d48, var(--rose));
}

.agent-footer {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.agent-updated {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.updated-rel {
  color: var(--text-secondary);
}

.updated-abs {
  color: var(--text-muted);
  font-size: 10.5px;
}

.agent-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--cyan);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid rgba(34, 211, 238, 0.28);
  background: rgba(34, 211, 238, 0.06);
  transition: background-color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.agent-link:hover {
  background: rgba(34, 211, 238, 0.16);
  border-color: var(--cyan);
}

/* ---------- 3. AI Factory Assembly Line ---------- */
.pipeline-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.dot-cyan { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.dot-amber { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.dot-emerald { background: var(--emerald); box-shadow: 0 0 8px var(--emerald); }

.pipeline-panel {
  padding: 20px 18px;
  overflow-x: auto;
}

.pipeline-track {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-width: 980px;
}

.station-node {
  position: relative;
  flex: 1 1 0;
  min-width: 112px;
  padding: 12px 10px;
  background: var(--panel-inset);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
}

.station-node.is-active {
  border-color: rgba(34, 211, 238, 0.55);
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.11) 0%, rgba(11, 18, 34, 0.96) 100%);
  box-shadow: 0 0 22px rgba(34, 211, 238, 0.18), inset 0 1px 0 rgba(34, 211, 238, 0.28);
}

.station-node.is-active.tone-review {
  border-color: rgba(251, 191, 36, 0.55);
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.12) 0%, rgba(11, 18, 34, 0.96) 100%);
  box-shadow: 0 0 22px rgba(251, 191, 36, 0.18), inset 0 1px 0 rgba(251, 191, 36, 0.3);
}

.station-node.is-active.tone-published {
  border-color: rgba(52, 211, 153, 0.55);
  background: linear-gradient(180deg, rgba(52, 211, 153, 0.12) 0%, rgba(11, 18, 34, 0.96) 100%);
  box-shadow: 0 0 22px rgba(52, 211, 153, 0.18), inset 0 1px 0 rgba(52, 211, 153, 0.3);
}

.station-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.station-num {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.station-node.is-active .station-num {
  color: var(--cyan);
}

.station-node.is-active.tone-review .station-num {
  color: var(--amber);
}

.station-node.is-active.tone-published .station-num {
  color: var(--emerald);
}

.station-count {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-secondary);
}

.station-node.is-active .station-count {
  background: rgba(34, 211, 238, 0.16);
  color: var(--cyan);
}

.station-node.is-active.tone-review .station-count {
  background: rgba(251, 191, 36, 0.16);
  color: var(--amber);
}

.station-node.is-active.tone-published .station-count {
  background: rgba(52, 211, 153, 0.16);
  color: var(--emerald);
}

.station-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.station-en {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.station-chips {
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px dashed rgba(148, 163, 184, 0.14);
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 28px;
}

.station-empty {
  font-size: 10px;
  color: rgba(100, 116, 139, 0.55);
  letter-spacing: 0.06em;
}

.ep-chip {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding: 4px 7px;
  border-radius: 4px;
  border: 1px solid rgba(34, 211, 238, 0.35);
  background: rgba(34, 211, 238, 0.1);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.ep-chip:hover {
  transform: translateY(-1px);
  background: rgba(34, 211, 238, 0.2);
}

.ep-chip.chip-review {
  border-color: rgba(251, 191, 36, 0.42);
  background: rgba(251, 191, 36, 0.12);
  color: #fde68a;
}

.ep-chip.chip-review:hover {
  background: rgba(251, 191, 36, 0.22);
}

.ep-chip.chip-published {
  border-color: rgba(52, 211, 153, 0.4);
  background: rgba(52, 211, 153, 0.12);
  color: #a7f3d0;
}

.ep-chip.chip-published:hover {
  background: rgba(52, 211, 153, 0.22);
}

.ep-chip-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* Flowing SVG Connectors */
.pipeline-connector {
  flex: 0 0 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.connector-h {
  width: 26px;
  height: 24px;
  display: block;
}

.connector-v {
  display: none;
  width: 24px;
  height: 28px;
}

.flow-line {
  stroke: rgba(34, 211, 238, 0.55);
  stroke-width: 1.8;
  stroke-dasharray: 4 4;
  animation: flow-dash 1.2s linear infinite;
}

.flow-arrow {
  fill: rgba(34, 211, 238, 0.72);
}

.pipeline-connector.is-hot .flow-line {
  stroke: var(--emerald);
  filter: drop-shadow(0 0 4px rgba(52, 211, 153, 0.5));
}

.pipeline-connector.is-hot .flow-arrow {
  fill: var(--emerald);
}

@keyframes flow-dash {
  from {
    stroke-dashoffset: 16;
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* ---------- 4. Episode Matrix ---------- */
.credits-chip {
  font-size: 11.5px;
  color: var(--cyan);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(34, 211, 238, 0.28);
  background: rgba(34, 211, 238, 0.08);
}

.matrix-panel {
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.matrix-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(7, 11, 20, 0.6);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.16s ease;
}

.filter-btn:hover {
  color: var(--text-primary);
  border-color: rgba(34, 211, 238, 0.35);
}

.filter-btn.is-active {
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.12);
  border-color: rgba(34, 211, 238, 0.5);
}

.filter-count {
  font-size: 10.5px;
  padding: 0 5px;
  border-radius: 3px;
  background: rgba(148, 163, 184, 0.14);
  color: inherit;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 240px;
  flex: 0 1 320px;
}

.search-icon {
  position: absolute;
  left: 10px;
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 7px 30px 7px 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel-inset);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 12.5px;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: rgba(34, 211, 238, 0.55);
}

.search-clear {
  position: absolute;
  right: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 5px;
}

.search-clear:hover {
  color: var(--text-primary);
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: var(--radius-sm);
  background: rgba(7, 11, 20, 0.55);
}

.episode-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

.episode-table thead th {
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(15, 23, 42, 0.85);
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  white-space: nowrap;
}

.th-en {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: 4px;
  letter-spacing: 0.06em;
}

.episode-table tbody tr {
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  transition: background-color 0.15s ease;
}

.episode-table tbody tr:last-child {
  border-bottom: none;
}

.episode-table tbody tr:hover {
  background: rgba(34, 211, 238, 0.045);
}

.episode-table tbody tr.is-highlighted {
  background: rgba(34, 211, 238, 0.13);
}

.episode-table tbody td {
  padding: 11px 12px;
  vertical-align: top;
}

.ep-id-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 3px;
  background: rgba(34, 211, 238, 0.09);
  border: 1px solid rgba(34, 211, 238, 0.25);
  color: var(--cyan);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.ep-title-text {
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
}

.ep-notes {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--text-secondary);
  padding-left: 8px;
  border-left: 2px solid rgba(34, 211, 238, 0.35);
}

.ep-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.ep-status-code {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.ep-status-published {
  color: var(--emerald);
  background: var(--emerald-soft);
  border-color: rgba(52, 211, 153, 0.35);
}

.ep-status-review {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: rgba(251, 191, 36, 0.38);
}

.ep-status-in_progress {
  color: var(--cyan);
  background: var(--cyan-soft);
  border-color: rgba(34, 211, 238, 0.35);
}

.ep-stage-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  white-space: nowrap;
}

.ep-stage-zh {
  font-size: 12.5px;
  color: var(--text-primary);
}

.ep-stage-id {
  font-size: 10.5px;
  color: var(--text-muted);
}

.metric-pair {
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
}

.metric-sub {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
}

.metric-empty {
  color: var(--text-muted);
}

.ep-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ext-link-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 3px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.75);
  color: var(--cyan);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 11px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
  white-space: nowrap;
}

.ext-link-pill:hover {
  border-color: var(--cyan);
  background: rgba(34, 211, 238, 0.14);
}

.empty-row td {
  text-align: center;
  padding: 28px 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.totals-row td {
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.78);
  border-top: 1px solid rgba(34, 211, 238, 0.24);
  font-size: 12px;
}

.totals-label {
  color: var(--text-secondary);
}

.totals-scope {
  margin-left: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.totals-value {
  color: var(--cyan);
  font-weight: 600;
  white-space: nowrap;
}

.totals-count {
  color: var(--text-secondary);
  font-size: 11px;
  white-space: nowrap;
}

/* ---------- 5. Lower Deck: Activity Feed & Quick Ops ---------- */
.lower-deck {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(290px, 1fr);
  gap: 18px;
  align-items: start;
}

.feed-panel {
  padding: 12px 14px;
}

.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 410px;
  overflow-y: auto;
}

.activity-item {
  display: grid;
  grid-template-columns: 82px 66px 104px minmax(0, 1fr);
  align-items: baseline;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--panel-inset);
  border: 1px solid rgba(148, 163, 184, 0.09);
  border-left: 2px solid var(--cyan);
  font-size: 12.5px;
}

.activity-item.level-success {
  border-left-color: var(--emerald);
}

.activity-item.level-warn {
  border-left-color: var(--amber);
}

.activity-item.level-error {
  border-left-color: var(--rose);
}

.event-ts {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.event-level {
  display: inline-block;
  text-align: center;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.event-level-info {
  color: var(--cyan);
  background: var(--cyan-soft);
}

.event-level-success {
  color: var(--emerald);
  background: var(--emerald-soft);
}

.event-level-warn {
  color: var(--amber);
  background: var(--amber-soft);
}

.event-level-error {
  color: var(--rose);
  background: var(--rose-soft);
}

.event-agent {
  font-size: 11.5px;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-msg {
  color: var(--text-primary);
  line-height: 1.45;
  word-break: break-word;
}

/* Quick Ops Panel */
.ops-panel {
  padding: 12px;
}

.ops-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ops-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--panel-inset);
  border: 1px solid rgba(148, 163, 184, 0.14);
  text-decoration: none;
  transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.14s ease;
}

.ops-card:hover {
  border-color: rgba(34, 211, 238, 0.5);
  background: rgba(34, 211, 238, 0.07);
  transform: translateX(2px);
}

.ops-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ops-label {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--cyan);
}

.ops-arrow {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  transition: color 0.15s ease, transform 0.15s ease;
}

.ops-card:hover .ops-arrow {
  color: var(--cyan);
  transform: translate(2px, -1px);
}

.ops-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ---------- 6. Footer ---------- */
.mission-footer {
  margin-top: 4px;
  padding: 12px 4px 4px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--text-muted);
}

.footer-left,
.footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.footer-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
}

.footer-right strong {
  color: var(--text-secondary);
  font-weight: 500;
}

.footer-sep {
  opacity: 0.45;
}

/* ---------- Responsive Breakpoints ---------- */
@media (max-width: 1080px) {
  .lower-deck {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .pipeline-panel {
    overflow-x: visible;
    padding: 14px;
  }

  .pipeline-track {
    flex-direction: column;
    min-width: 0;
  }

  .station-node {
    min-width: 0;
    width: 100%;
    padding: 12px 14px;
  }

  .station-chips {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .ep-chip {
    width: auto;
  }

  .pipeline-connector {
    flex: 0 0 28px;
    width: 100%;
  }

  .connector-h {
    display: none;
  }

  .connector-v {
    display: block;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 12px 12px 22px;
    gap: 16px;
  }

  .telemetry-bar {
    padding: 12px 14px;
  }

  .telemetry-metrics {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .refresh-btn {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .activity-item {
    grid-template-columns: 74px 62px minmax(0, 1fr);
    gap: 6px 8px;
  }

  .event-msg {
    grid-column: 1 / -1;
  }

  .search-box {
    width: 100%;
    flex: 1 1 100%;
  }
}

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