:root {
  /* Prop Hunt brand — matches landing theme.js */
  --surface: #081428;
  --stage: #081428;
  --container: #0f2550;
  --container-low: #0a1830;
  --container-high: #162a52;
  --container-highest: #1e3464;
  --outline: rgba(59, 130, 246, 0.5);
  --outline-soft: rgba(255, 255, 255, 0.14);
  --text: #f4f9ff;
  --muted: #cbd8f0;
  --primary: #3b82f6;
  --primary-dim: rgba(59, 130, 246, 0.18);
  --green: #22c55e;
  --red: #ef4444;
  --orange: #f59e0b;
  --amber: #fbbf24;
  --secondary: #06d6f0;
  --secondary-dim: #38bdf8;
  --tertiary: #34eef8;
  --primary-bright: #06d6f0;
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --glow: 0 0 28px rgba(59, 130, 246, 0.45);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; color-scheme: dark; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(ellipse 80% 50% at 50% -5%, rgba(59, 130, 246, 0.22), transparent 55%),
    linear-gradient(180deg, #081428 0%, #0d1e3a 40%, #0f2550 100%);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button, select, input { font: inherit; color: inherit; }
/* Keep native select menus readable on Windows (avoids white-on-white options) */
select {
  color-scheme: dark;
  color: #e8eef8;
  background-color: rgba(8, 20, 40, 0.92);
}
select option,
select optgroup {
  background-color: #0d1e3a;
  color: #e8eef8;
}
a { color: inherit; }
.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  font-size: 20px;
  line-height: 1;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100vh;
  max-width: 1100px;
  margin: 0 auto;
}

/* ——— Top bar (Prop Hunt header style) ——— */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: -0.25rem 0 1.25rem;
  padding: 0.75rem 0.35rem 1rem;
  border-bottom: 1px solid rgba(59, 130, 246, 0.28);
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.1), rgba(15, 37, 80, 0.35), rgba(6, 214, 240, 0.08));
  backdrop-filter: blur(18px);
  border-radius: 0 0 var(--radius) var(--radius);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.15rem 0.25rem;
  text-decoration: none;
}
.brand-mark {
  height: 42px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  display: block;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.btn-ghost,
.btn-glow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.55rem 1.15rem;
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: 0.25s ease;
}
.btn-ghost {
  border: 1px solid rgba(59, 130, 246, 0.65);
  background: transparent;
  color: #06d6f0;
}
.btn-ghost:hover {
  background: rgba(59, 130, 246, 0.18);
  box-shadow: 0 0 28px rgba(59, 130, 246, 0.45);
  color: #fff;
}
.btn-glow {
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, #1d4ed8, #3b82f6, #06d6f0);
  box-shadow: 0 0 28px rgba(59, 130, 246, 0.45);
}
.btn-glow:hover {
  box-shadow: 0 0 36px rgba(6, 214, 240, 0.55);
  transform: translateY(-1px);
}

.side-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}
.side-card-head > span {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}
.connection-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}
.connection-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.7rem;
}
.connection-right .status-pill {
  align-self: flex-end;
  flex-shrink: 0;
}
.connection-bar .mt5-meta {
  max-width: 420px;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: 999px;
  padding: 0.15rem 0.45rem;
  border: 1px solid rgba(94, 234, 212, 0.3);
  background: rgba(94, 234, 212, 0.08);
  color: var(--green);
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  font-weight: 800;
}
#mt5Dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #667788;
  display: inline-block;
}
#mt5Dot.on {
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(94, 234, 212, 0.45);
  animation: ping 1.6s infinite;
}
.mt5-stream {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}
.mt5-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.mt5-meta span {
  display: block;
  font-size: 0.56rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.mt5-meta b {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.78rem;
  font-weight: 700;
}

/* ——— Stage ——— */
.stage {
  min-width: 0;
  padding: 1.15rem 1.35rem 2rem;
  background: transparent;
}
.stage-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.1rem;
}
.eyebrow {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--secondary);
  font-weight: 700;
}
.stage-top h1 {
  margin: 0;
  font-size: clamp(1.55rem, 2.4vw, 2.15rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.15;
  background: linear-gradient(180deg, #ffffff 10%, #7dd3fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.sub {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  max-width: 40rem;
}
.api-field {
  display: grid;
  gap: 0.3rem;
}
.api-field span {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.api-field input {
  width: 200px;
  border: 1px solid rgba(59, 130, 246, 0.35);
  background: rgba(15, 37, 80, 0.75);
  border-radius: 999px;
  padding: 0.7rem 1rem;
  outline: none;
  transition: 0.2s ease;
}
.api-field input:focus {
  border-color: rgba(6, 214, 240, 0.7);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.panel {
  border: 1px solid rgba(59, 130, 246, 0.28);
  border-radius: var(--radius);
  padding: 1.05rem 1.15rem;
  background: linear-gradient(180deg, rgba(22, 42, 82, 0.92) 0%, rgba(16, 32, 64, 0.92) 100%);
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.desk-scan,
.result {
  scroll-margin-top: 1.25rem;
}
.controls-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.85fr 1.15fr;
  gap: 0.85rem;
  margin-bottom: 1rem;
}
.field { display: grid; gap: 0.35rem; min-width: 0; }
.field-label, .card-label {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.field select, .live-box {
  width: 100%;
  border: 1px solid rgba(59, 130, 246, 0.3);
  background: rgba(8, 20, 40, 0.92);
  color: #e8eef8;
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  outline: none;
  font-size: 0.9rem;
  font-weight: 500;
}
.field select option,
.field select optgroup {
  background-color: #0d1e3a;
  color: #e8eef8;
}
.field select:focus {
  border-color: rgba(6, 214, 240, 0.65);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}
.live-box {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border-color: rgba(6, 214, 240, 0.35);
  background: rgba(6, 214, 240, 0.08);
}
.live-box.market-closed {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.1);
}
.market-closed-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  margin: 0.85rem 0 0.35rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.12);
  color: #fde68a;
}
.market-closed-banner[hidden] { display: none !important; }
.market-closed-banner .material-symbols-outlined {
  color: #fbbf24;
  margin-top: 0.1rem;
}
.market-closed-banner strong {
  display: block;
  font-size: 0.92rem;
  color: #fef3c7;
}
.market-closed-banner p {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: #fcd34d;
  line-height: 1.4;
}
.result-market-note { margin: 0.75rem 0 1rem; }
.status-pill.closed,
.status-pill.stale {
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.12);
}
.status-pill.closed #mt5Dot,
.status-pill.closed i,
.status-pill.stale #mt5Dot,
.status-pill.stale i {
  background: #f59e0b;
}
.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #667788;
  flex: 0 0 auto;
}
.pulse.on {
  background: var(--green);
  animation: ping 1.6s infinite;
}
.live-box strong { display: block; font-size: 0.88rem; font-weight: 700; }
.live-box p { margin: 0.1rem 0 0; color: var(--muted); font-size: 0.72rem; }

.btn-primary {
  width: 100%;
  min-height: 64px;
  display: grid;
  grid-template-columns: 28px 1fr 28px;
  align-items: center;
  gap: 0.65rem;
  border: 0;
  border-radius: 999px;
  padding: 0.95rem 1.2rem;
  cursor: pointer;
  background: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 45%, #06d6f0 100%);
  color: #ffffff;
  box-shadow: 0 0 32px rgba(59, 130, 246, 0.45), 0 10px 28px rgba(6, 214, 240, 0.18);
  transition: 0.25s ease;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 42px rgba(6, 214, 240, 0.55), 0 12px 32px rgba(59, 130, 246, 0.3);
}
.btn-primary b {
  display: block;
  font-size: 1rem;
  letter-spacing: 0.02em;
  font-weight: 800;
}
.btn-primary small {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.74rem;
  opacity: 0.88;
  font-weight: 600;
}
.btn-primary .chev { justify-self: end; }
.btn-primary:disabled { opacity: 0.7; cursor: wait; transform: none; }
.btn-primary.loading {
  pointer-events: none;
  box-shadow: 0 0 28px rgba(59, 130, 246, 0.35);
}
.btn-primary.loading > .material-symbols-outlined:first-child {
  animation: btnSpin 0.85s linear infinite;
}
.btn-primary.loading .chev { opacity: 0.35; }
@keyframes btnSpin {
  to { transform: rotate(360deg); }
}

.progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 0.85rem;
  color: var(--muted);
  font-size: 0.74rem;
}
.progress-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.progress-track {
  width: 120px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1d4ed8, #3b82f6, #06d6f0);
  transition: width 0.3s ease;
}
.progress-meta b { color: var(--primary); font-size: 0.76rem; }
.status { min-height: 1rem; margin: 0.45rem 0 0; color: var(--muted); font-size: 0.78rem; }
.status.error { color: var(--red); }

/* ——— Desk scan (multi-agent) ——— */
.desk-scan[hidden] { display: none !important; }
.desk-scan {
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 50% at 50% 40%, rgba(192, 193, 255, 0.07), transparent 65%),
    rgba(27, 27, 35, 0.9);
}
.desk-scan-head {
  text-align: center;
  margin-bottom: 0.35rem;
}
.desk-scan-head h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #f4f9ff, var(--primary-bright));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.desk-scan-status {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  min-height: 1.4em;
  transition: opacity 0.25s ease;
}
.typing {
  display: inline-flex;
  gap: 5px;
  justify-content: center;
  margin-top: 0.65rem;
}
.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  animation: typing 1.1s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
.typing[hidden] { display: none !important; }

.scan-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin: 0.85rem auto 0;
  max-width: 280px;
}
.scan-progress-track {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.scan-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3b82f6, #06d6f0, var(--green));
  background-size: 200% 100%;
  animation: shimmer 1.8s linear infinite;
  transition: width 0.45s ease;
}
#scanProgressText {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--primary);
  min-width: 2.5rem;
  text-align: right;
}

.agent-ring {
  position: relative;
  width: min(100%, 560px);
  height: 380px;
  margin: 0.5rem auto 1rem;
}
.agent-links {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}
.agent-links line {
  stroke: #3d3c4c;
  stroke-width: 1;
  stroke-linecap: round;
  stroke-dasharray: none;
  opacity: 0.55;
  vector-effect: non-scaling-stroke;
  transition: stroke 0.3s ease, stroke-width 0.3s ease, opacity 0.3s ease;
}
.agent-links line.active {
  stroke: rgba(192, 193, 255, 0.9);
  stroke-width: 1.5;
  opacity: 1;
  filter: drop-shadow(0 0 2.5px rgba(192, 193, 255, 0.4));
  animation: linkPulse 1.2s ease-in-out infinite;
}
.desk-scan.synthesizing .agent-links line,
.agent-links.synthesizing line {
  stroke: rgba(192, 193, 255, 0.55);
  stroke-width: 1.15;
  opacity: 0.9;
  filter: drop-shadow(0 0 2px rgba(192, 193, 255, 0.3));
  animation: none;
}

.agent-node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.28rem;
  width: 112px;
  text-align: center;
  opacity: 0.4;
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(.34,1.2,.64,1);
  z-index: 2;
}
.agent-node.active,
.agent-node.done,
.agent-node.hub.active {
  opacity: 1;
}
.agent-node.active { transform: translate(-50%, -50%) scale(1.08); }
.agent-node.done { transform: translate(-50%, -50%) scale(1); }
.agent-node.hub { z-index: 3; width: 128px; opacity: 0.65; }
.agent-node.hub.active { animation: hubBreathe 2.2s ease-in-out infinite; }
.node-core {
  --c: var(--primary-bright);
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 1px solid var(--outline-soft);
  background: radial-gradient(circle at 40% 35%, rgba(255,255,255,0.06), var(--surface) 70%);
  display: grid;
  place-items: center;
  color: var(--c);
  box-shadow: 0 0 0 0 transparent;
  transition: box-shadow 0.4s ease, border-color 0.3s ease, transform 0.3s ease;
}
.agent-node.hub .node-core {
  width: 78px;
  height: 78px;
}
.agent-node.hub .node-core .material-symbols-outlined { font-size: 32px; }
.agent-node.active .node-core,
.agent-node.hub.active .node-core {
  border-color: color-mix(in srgb, var(--c) 60%, transparent);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent),
    0 0 32px 6px color-mix(in srgb, var(--c) 40%, transparent);
}
.agent-node.done .node-core {
  border-color: color-mix(in srgb, var(--green) 45%, transparent);
}
.agent-node.done .node-core::after {
  content: "check";
  font-family: "Material Symbols Outlined";
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--green);
  color: #0d0d15;
  font-size: 13px;
  display: grid;
  place-items: center;
  box-shadow: 0 0 10px rgba(94, 234, 212, 0.5);
  animation: popIn 0.35s cubic-bezier(.34,1.4,.64,1);
}
.agent-node strong {
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.2;
}
.agent-node em {
  font-style: normal;
  font-size: 0.58rem;
  color: var(--muted);
}

.sonar {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--primary) 40%, transparent);
  opacity: 0;
  pointer-events: none;
}
.agent-node.active .sonar,
.agent-node.hub.active .sonar {
  animation: sonar 1.5s ease-out infinite;
}
.sonar.delay { animation-delay: 0.75s !important; }

.flow-dot {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 4;
  box-shadow: 0 0 8px currentColor;
}

.desk-stages {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
  max-width: 580px;
  margin-inline: auto;
}
.desk-stages li {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  border: 1px solid var(--outline-soft);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  background: rgba(19, 19, 27, 0.7);
  font-size: 0.8rem;
  color: var(--muted);
  animation: fadeIn 0.35s ease;
}
.desk-stages li.done-stage {
  border-color: rgba(94, 234, 212, 0.25);
  background: rgba(94, 234, 212, 0.05);
}
.desk-stages li strong {
  color: var(--text);
  font-size: 0.74rem;
  display: block;
  margin-bottom: 0.12rem;
}
.desk-stages .stage-dot {
  width: 8px;
  height: 8px;
  margin-top: 0.4rem;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--primary);
  box-shadow: 0 0 8px currentColor;
}

@keyframes typing {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}
@keyframes sonar {
  0% { transform: scale(0.8); opacity: 0.6; }
  100% { transform: scale(1.55); opacity: 0; }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  0% { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}
@keyframes linkPulse {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}
@keyframes hubBreathe {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.05); }
}
@keyframes popIn {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Result */
.result[hidden] { display: none !important; }
.result-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}
.bias-title {
  margin: 0;
  font-size: clamp(1.35rem, 2.2vw, 1.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}
.bias-title.buy { color: var(--green); }
.bias-title.sell { color: var(--red); }
.bias-title.neutral { color: var(--orange); }
.confidence-line {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}
.confidence-line strong { color: var(--text); margin-right: 0.35rem; }
.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 0.15rem 0.45rem;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  border: 1px solid var(--outline-soft);
  background: rgba(52, 52, 61, 0.6);
  color: var(--text);
}
.badge.strong { color: var(--green); border-color: rgba(94, 234, 212, 0.35); background: rgba(94, 234, 212, 0.1); }
.badge.forming { color: var(--orange); border-color: rgba(240, 180, 90, 0.35); background: rgba(240, 180, 90, 0.1); }
.badge.weak { color: var(--red); border-color: rgba(255, 122, 138, 0.35); background: rgba(255, 122, 138, 0.1); }
.badge.muted { color: var(--muted); }

.result-id {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-family: var(--mono);
}
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--outline-soft);
  background: var(--container);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.bias-desc {
  margin: 0.7rem 0 1rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
  max-width: 70ch;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
.card {
  border: 1px solid var(--outline-soft);
  border-radius: 14px;
  padding: 0.9rem;
  background: rgba(19, 19, 27, 0.75);
  display: flex;
  flex-direction: column;
  min-height: 180px;
}
.card-label { margin-bottom: 0.65rem; }

.bias-card {
  background:
    radial-gradient(ellipse 80% 60% at 10% 0%, rgba(192, 193, 255, 0.1), transparent 55%),
    rgba(19, 19, 27, 0.85);
}
.conv-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.conv-head .card-label { margin: 0; }
.conv-badge {
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  border: 1px solid var(--outline-soft);
  color: var(--muted);
}
.conv-badge.strong {
  color: var(--green);
  border-color: rgba(94, 234, 212, 0.35);
  background: rgba(94, 234, 212, 0.1);
}
.conv-badge.forming {
  color: var(--orange);
  border-color: rgba(240, 180, 90, 0.35);
  background: rgba(240, 180, 90, 0.1);
}
.conv-badge.weak {
  color: var(--red);
  border-color: rgba(255, 122, 138, 0.35);
  background: rgba(255, 122, 138, 0.1);
}

.gauge-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.9rem;
  align-items: center;
  margin-bottom: 0.85rem;
}
.gauge {
  position: relative;
  width: 108px;
  height: 108px;
  flex: 0 0 auto;
}
.gauge svg {
  width: 108px;
  height: 108px;
  transform: rotate(-90deg);
  filter: drop-shadow(0 0 10px rgba(192, 193, 255, 0.15));
}
.gauge-bg { fill: none; stroke: rgba(255, 255, 255, 0.08); stroke-width: 9; }
.gauge-arc {
  fill: none;
  stroke: var(--primary);
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 289;
  stroke-dashoffset: 289;
  transition: stroke-dashoffset 0.55s ease, stroke 0.35s ease;
}
.gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
  line-height: 1;
}
.gauge-center b {
  font-size: 1.35rem;
  font-weight: 800;
  font-family: var(--mono);
  letter-spacing: -0.03em;
}
.gauge-center span {
  font-size: 0.95rem;
  font-weight: 800;
  opacity: 0.9;
}

.conv-meta { min-width: 0; }
.conv-dir {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.conv-dir.buy { color: var(--green); }
.conv-dir.sell { color: var(--red); }
.conv-dir.neutral { color: var(--orange); }
.conv-score {
  margin: 0.25rem 0 0.55rem;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}
.conv-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.chip-mini {
  border-radius: 999px;
  padding: 0.22rem 0.5rem;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--muted);
  border: 1px solid var(--outline-soft);
  background: rgba(52, 52, 61, 0.45);
}
.chip-mini i {
  font-style: normal;
  color: var(--text);
  font-family: var(--mono);
  margin-right: 0.15rem;
}

.bars { display: grid; gap: 0.45rem; margin-bottom: 0.65rem; }
.conv-risk {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: auto;
  border: 1px solid rgba(240, 180, 90, 0.28);
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  background: rgba(240, 180, 90, 0.06);
}
.conv-risk .lbl {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9a99ad;
  font-weight: 700;
}
.conv-risk .val {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.conv-risk .val.warn { color: #f0b45a; }
.conv-risk .val.bad { color: #ff7a8a; }
.conv-risk .val.good { color: #5eead4; }
.bar-row {
  display: grid;
  grid-template-columns: 62px 1fr 40px;
  gap: 0.4rem;
  align-items: center;
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 700;
}
.bar-tag {
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  font-weight: 800;
}
.bar-tag.buy { color: var(--green); }
.bar-tag.neu { color: var(--orange); }
.bar-tag.sell { color: var(--red); }
.bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  transition: width 0.45s ease;
}
.bar.buy i {
  background: linear-gradient(90deg, #2dd4bf, var(--green));
  box-shadow: 0 0 8px rgba(94, 234, 212, 0.35);
}
.bar.neu i {
  background: linear-gradient(90deg, #f0a14a, var(--orange));
}
.bar.sell i {
  background: linear-gradient(90deg, #ff5d6c, var(--red));
  box-shadow: 0 0 8px rgba(255, 122, 138, 0.3);
}
.bar-row em {
  font-style: normal;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text);
  text-align: right;
}

.conv-foot {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}
.conv-foot > div {
  border: 1px solid var(--outline-soft);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  background: rgba(8, 8, 14, 0.45);
}
.conv-foot span {
  display: block;
  font-size: 0.56rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.conv-foot strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  font-weight: 800;
}

.plan-list, .intel-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.4rem;
}
.plan-list div, .intel-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(70, 69, 84, 0.35);
  font-size: 0.82rem;
}
.plan-list dt, .intel-list span { margin: 0; color: var(--muted); }
.plan-list dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  text-align: right;
}
.plan-list .good { color: var(--green); }
.plan-list .bad { color: var(--red); }

/* Trade plan card (Intel X style — prominent) */
.trade-plan-card {
  padding: 1rem 1.05rem 1.1rem;
  min-height: 260px;
  border-color: rgba(192, 193, 255, 0.22);
  background:
    radial-gradient(ellipse 90% 55% at 0% 0%, rgba(192, 193, 255, 0.12), transparent 55%),
    rgba(19, 19, 27, 0.95);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}
.trade-plan {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  height: 100%;
}
.tp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(70, 69, 84, 0.45);
}
.tp-head-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}
.tp-symbol-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: rgba(245, 197, 66, 0.18);
  border: 1px solid rgba(245, 197, 66, 0.45);
  color: var(--amber);
  box-shadow: 0 0 16px rgba(245, 197, 66, 0.2);
}
.tp-symbol-icon .material-symbols-outlined { font-size: 24px; }
.tp-symbol-icon.fx {
  background: rgba(192, 193, 255, 0.16);
  border-color: rgba(192, 193, 255, 0.4);
  color: var(--primary);
  box-shadow: 0 0 16px rgba(192, 193, 255, 0.2);
}
.tp-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.45rem;
}
.tp-title .tp-tf {
  font-size: 0.95rem;
  font-weight: 700;
  color: #c9c8d8;
  letter-spacing: 0.02em;
}
.tp-title span:not(.tp-tf) {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.tp-sub {
  margin: 0.28rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
  letter-spacing: 0.02em;
}
.tp-side {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 0.42rem 0.95rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  border: 1.5px solid rgba(94, 234, 212, 0.55);
  color: var(--green);
  background: rgba(94, 234, 212, 0.14);
  box-shadow: 0 0 18px rgba(94, 234, 212, 0.18);
}
.tp-side.sell {
  border-color: rgba(255, 122, 138, 0.55);
  color: var(--red);
  background: rgba(255, 122, 138, 0.14);
  box-shadow: 0 0 18px rgba(255, 122, 138, 0.18);
}
.tp-side.neutral {
  border-color: rgba(240, 180, 90, 0.5);
  color: var(--orange);
  background: rgba(240, 180, 90, 0.12);
  box-shadow: none;
}
.tp-levels {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.tp-level {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  border: 1px solid rgba(70, 69, 84, 0.55);
  border-radius: 12px;
  padding: 0.72rem 0.9rem;
  background: rgba(8, 8, 14, 0.72);
  min-width: 0;
}
.tp-level .lbl {
  flex: 1 1 auto;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9a99ad;
  font-weight: 700;
  line-height: 1.3;
}
.tp-level .val {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
  overflow: visible;
  letter-spacing: -0.01em;
  text-align: right;
}
.tp-level .val.good {
  color: #5eead4;
  text-shadow: 0 0 18px rgba(94, 234, 212, 0.25);
}
.tp-level .val.bad {
  color: #ff7a8a;
  text-shadow: 0 0 18px rgba(255, 122, 138, 0.22);
}
.tp-level .val.warn {
  color: #f0b45a;
  text-shadow: 0 0 14px rgba(240, 180, 90, 0.2);
}
.tp-entry-val {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.tp-price {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
  line-height: 1.2;
  color: inherit;
}
.tp-entry-sep {
  color: #7a798c;
  font-size: 0.95rem;
  font-weight: 600;
  flex: 0 0 auto;
}
.tp-level.entry {
  border-color: rgba(94, 234, 212, 0.28);
  background: rgba(94, 234, 212, 0.06);
}
.tp-level.tp {
  border-color: rgba(94, 234, 212, 0.28);
  background: rgba(94, 234, 212, 0.06);
}
.tp-level.sl {
  border-color: rgba(255, 122, 138, 0.28);
  background: rgba(255, 122, 138, 0.06);
}
.tp-list {
  display: grid;
  gap: 0;
  border: 1px solid var(--outline-soft);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(19, 19, 27, 0.65);
}
.tp-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid rgba(70, 69, 84, 0.35);
  font-size: 0.82rem;
}
.tp-row:last-child { border-bottom: 0; }
.tp-row .lbl { color: var(--muted); letter-spacing: 0.06em; font-size: 0.68rem; font-weight: 700; }
.tp-row .val {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}
.tp-row .val.good { color: var(--green); }
.tp-row .val.bad { color: var(--red); }

@media (max-width: 640px) {
  .tp-level .val,
  .tp-price { font-size: 0.98rem; }
}
.intel-list strong.pass { color: var(--green); }
.intel-list strong.fail { color: var(--orange); }

.brief-text {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
  flex: 1;
  background: none;
  box-shadow: none;
}
.risk-box {
  margin-top: auto;
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  border: 1px solid rgba(59, 130, 246, 0.3);
  background: rgba(15, 37, 80, 0.65);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}
.risk-box p {
  margin: 0;
  background: transparent !important;
  color: var(--muted);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.risk-box .material-symbols-outlined {
  font-size: 18px;
  color: var(--secondary);
  flex: 0 0 auto;
  margin-top: 0.05rem;
  background: transparent;
}

/* ——— Right rail ——— */
.rail {
  border-left: 1px solid rgba(59, 130, 246, 0.28);
  background: linear-gradient(180deg, rgba(10, 24, 48, 0.95), rgba(15, 37, 80, 0.9));
  padding: 1rem 0.9rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.rail-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.agent-feed {
  list-style: none;
  margin: 1rem 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}
.agent {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  border: 1px solid var(--outline-soft);
  border-radius: 12px;
  padding: 0.7rem 0.75rem;
  background: var(--container);
}
.agent-dot {
  width: 8px;
  height: 8px;
  margin-top: 0.35rem;
  border-radius: 50%;
  background: #667788;
  flex: 0 0 auto;
}
.agent.active .agent-dot {
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(192, 193, 255, 0.15);
}
.agent.done .agent-dot { background: var(--green); }
.agent strong { display: block; font-size: 0.78rem; }
.agent p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.35;
}
.rail-card {
  border: 1px solid var(--outline-soft);
  border-radius: 14px;
  padding: 0.8rem;
  background: var(--container);
}
.badges { display: flex; flex-wrap: wrap; gap: 0.4rem; }

@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(94, 234, 212, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(94, 234, 212, 0); }
  100% { box-shadow: 0 0 0 0 rgba(94, 234, 212, 0); }
}

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
  .topbar-actions { width: 100%; }
  .connection-bar { grid-template-columns: 1fr; }
  .connection-right { align-items: flex-end; }
  .connection-right .status-pill { align-self: flex-end; }
  .controls-grid { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
  .stage-top { flex-direction: column; }
  .connection-bar .mt5-meta { max-width: none; }
}
