:root {
  /* Match Prop Hunt main site theme */
  --bg: #081428;
  --bg-2: #0f2550;
  --surface: rgba(16, 32, 64, 0.78);
  --surface-solid: #102040;
  --border: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(59, 130, 246, 0.5);
  --text: #f4f9ff;
  --muted: #c0cfea;
  --primary: #3b82f6;
  --primary-dim: rgba(59, 130, 246, 0.15);
  --cyan: #06d6f0;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --radius: 14px;
  --glow: 0 0 32px rgba(59, 130, 246, 0.35);
  --btn-grad: linear-gradient(135deg, #3b82f6 0%, #60a5fa 55%, #06d6f0 100%);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  width: 100%;
  overflow-x: hidden;
}
img, svg, video, canvas { max-width: 100%; height: auto; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    linear-gradient(
      90deg,
      rgba(59, 130, 246, 0.18) 0%,
      #081428 20%,
      #081428 80%,
      rgba(6, 214, 240, 0.15) 100%
    ),
    linear-gradient(180deg, #081428 0%, #0d1e3a 35%, #0f2550 100%);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, select, input { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  font-size: 20px;
  line-height: 1;
}

.app-shell {
  min-height: 100vh;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem 2.5rem;
  width: 100%;
  min-width: 0;
}
.stage {
  padding-top: 0.5rem;
  min-width: 0;
  width: 100%;
}

.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

/* ——— Top bar ——— */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.5rem 0 1.25rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.14), rgba(8, 20, 40, 0.75), rgba(6, 214, 240, 0.1));
  backdrop-filter: blur(18px);
}
.brand-mark {
  height: 40px;
  width: auto;
  max-width: 190px;
  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;
  transition: 0.25s ease;
}
.btn-ghost {
  border: 1px solid rgba(59, 130, 246, 0.55);
  background: rgba(59, 130, 246, 0.08);
  color: #7cb9ff;
}
.btn-ghost:hover {
  background: rgba(59, 130, 246, 0.15);
  color: #fff;
}
.btn-glow {
  border: 0;
  color: #fff;
  background: var(--btn-grad);
  box-shadow: var(--glow);
}
.btn-glow:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 36px rgba(6, 214, 240, 0.35), 0 0 28px rgba(59, 130, 246, 0.45);
}

.stage-top { margin-bottom: 1rem; }
.eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: var(--primary);
}
.stage-top h1 {
  margin: 0;
  font-size: clamp(1.45rem, 3vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.sub {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 42rem;
}

.panel {
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1rem;
}

/* ——— Connection ——— */
.connection-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
}
.side-card-head span {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 700;
}
.mt5-stream {
  margin: 0.35rem 0 0.65rem;
  font-size: 0.95rem;
  font-weight: 600;
}
.mt5-meta {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.mt5-meta span {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}
.mt5-meta b {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 600;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #86efac;
}
.status-pill i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
  display: inline-block;
}
.status-pill i.on {
  background: #22c55e;
  box-shadow: 0 0 10px #22c55e;
}

/* ——— Controls ——— */
.controls-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.7fr 1.1fr;
  gap: 0.9rem;
  margin-bottom: 1rem;
}
.field-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--muted);
}
.select-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.field-icon {
  position: absolute;
  left: 0.75rem;
  color: var(--primary);
  pointer-events: none;
  font-size: 18px;
}
.select-wrap select,
.live-box {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(8, 20, 40, 0.72);
  padding: 0.85rem 2.2rem 0.85rem 2.5rem;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
}
.select-wrap select {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.live-box {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.9rem;
  background-image: none;
}
.live-box strong {
  display: block;
  font-size: 0.85rem;
}
.live-box p {
  margin: 0.15rem 0 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}
.pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #64748b;
  flex-shrink: 0;
}
.pulse.on {
  background: #22c55e;
  box-shadow: 0 0 12px #22c55e;
  animation: pulseDot 1.6s ease infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.85); }
}

.app-shell[data-step="processing"] #controlsGrid {
  opacity: 0.55;
  pointer-events: none;
}
.app-shell[data-step="processing"] #controlsGrid select {
  cursor: not-allowed;
}

.btn-primary {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  cursor: pointer;
  color: #fff;
  background: var(--btn-grad);
  box-shadow: var(--glow);
  transition: 0.25s ease;
  min-height: 68px;
  position: relative;
  overflow: hidden;
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); }
.btn-primary:disabled { cursor: wait; }
.btn-idle,
.btn-analyzing,
.btn-ready {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  max-width: 100%;
  min-width: 0;
}
/* Critical: class display rules override HTML [hidden] — force hide inactive states */
.btn-idle[hidden],
.btn-analyzing[hidden],
.btn-ready[hidden],
.btn-primary > [hidden] {
  display: none !important;
}
.btn-ico {
  flex-shrink: 0;
  font-size: 26px !important;
}
.btn-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  min-width: 0;
}
.btn-copy b {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.2;
}
.btn-copy small {
  opacity: 0.85;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.3;
}
.btn-primary[data-state="analyzing"] {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.9), rgba(6, 214, 240, 0.75), rgba(59, 130, 246, 0.9));
  background-size: 200% 100%;
  animation: telemSweep 1.4s linear infinite;
}
.btn-primary[data-state="ready"] {
  background: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 50%, #06d6f0 100%);
}
.analyze-pulse {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #34eef8;
  box-shadow: 0 0 14px #06d6f0;
  animation: pulseDot 0.9s ease infinite;
}
@keyframes telemSweep {
  0% { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}

.status {
  margin: 0.75rem 0 0;
  min-height: 1.2em;
  font-size: 0.85rem;
  color: var(--muted);
}
.status.error { color: #fca5a5; }

/* ——— Skeleton ——— */
.section-label {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 0.85rem;
}
.skeleton-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.skeleton-grid.compact { margin-top: 1rem; opacity: 0.55; }
.skel-card {
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(15, 23, 42, 0.45);
  padding: 1rem;
}
.skel-line,
.skel-block {
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(148,163,184,0.08), rgba(148,163,184,0.18), rgba(148,163,184,0.08));
  background-size: 200% 100%;
  animation: skel 1.4s ease infinite;
  margin-bottom: 0.65rem;
}
.skel-line { height: 12px; }
.skel-block { height: 72px; }
.skel-block.tall { height: 120px; }
.w35 { width: 35%; } .w40 { width: 40%; } .w45 { width: 45%; }
.w50 { width: 50%; } .w55 { width: 55%; } .w60 { width: 60%; }
.w70 { width: 70%; } .w80 { width: 80%; }
@keyframes skel {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.app-shell[data-step="processing"] #placeholderPanel,
.app-shell[data-step="ready"] #placeholderPanel { display: none; }

/* ——— Desk / telemetry ——— */
.desk-scan-head h2 {
  margin: 0.2rem 0 0.35rem;
  font-size: 1.15rem;
}
.desk-scan-status {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.9rem;
  min-height: 1.35em;
}
.scan-progress {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.25rem;
}
.scan-progress-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  overflow: hidden;
}
.scan-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3b82f6, #60a5fa, #06d6f0);
  transition: width 0.35s ease;
  box-shadow: 0 0 12px rgba(6, 214, 240, 0.35);
}
#scanProgressText {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: #7cb9ff;
  min-width: 2.6rem;
  text-align: right;
}
.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 1rem 0;
}
.telem-card {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(16, 32, 64, 0.72);
  padding: 0.75rem;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}
.telem-card.active {
  border-color: rgba(59, 130, 246, 0.65);
  box-shadow: 0 0 22px rgba(59, 130, 246, 0.25);
  transform: translateY(-1px);
}
.telem-card.done {
  border-color: rgba(34, 197, 94, 0.45);
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.12);
}
.telem-card.hub-card {
  background: linear-gradient(150deg, rgba(59, 130, 246, 0.14), rgba(16, 32, 64, 0.72));
}
.telem-top {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}
.telem-top strong { font-size: 0.8rem; flex: 1; }
.telem-state {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
}
.telem-card.active .telem-state { color: #93c5fd; }
.telem-card.done .telem-state { color: #86efac; }
.telem-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
  flex-shrink: 0;
}
.telem-card.active .telem-dot {
  background: #3b82f6;
  box-shadow: 0 0 10px #3b82f6;
  animation: pulseDot 1s ease infinite;
}
.telem-card.done .telem-dot {
  background: #22c55e;
  box-shadow: 0 0 10px #22c55e;
  animation: none;
}
.telem-note {
  margin: 0.45rem 0 0;
  font-size: 0.7rem;
  color: var(--muted);
  min-height: 2.1em;
  line-height: 1.35;
}
.spark-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 42px;
  padding: 2px 0;
}
.spark-bars i {
  flex: 1;
  display: block;
  border-radius: 3px 3px 1px 1px;
  background: rgba(100, 116, 139, 0.45);
  height: 28%;
  transition: height 0.25s ease, background 0.25s ease;
}
.telem-card.active .spark-bars i {
  background: linear-gradient(180deg, #60a5fa, #3b82f6);
  animation: sparkBounce 0.7s ease-in-out infinite alternate;
}
.telem-card.active .spark-bars i:nth-child(2) { animation-delay: 0.05s; }
.telem-card.active .spark-bars i:nth-child(3) { animation-delay: 0.1s; }
.telem-card.active .spark-bars i:nth-child(4) { animation-delay: 0.15s; }
.telem-card.active .spark-bars i:nth-child(5) { animation-delay: 0.2s; }
.telem-card.active .spark-bars i:nth-child(6) { animation-delay: 0.25s; }
.telem-card.active .spark-bars i:nth-child(7) { animation-delay: 0.12s; }
.telem-card.active .spark-bars i:nth-child(8) { animation-delay: 0.18s; }
.telem-card.active .spark-bars i:nth-child(9) { animation-delay: 0.08s; }
.telem-card.active .spark-bars i:nth-child(10) { animation-delay: 0.22s; }
.telem-card.active .spark-bars i:nth-child(11) { animation-delay: 0.14s; }
.telem-card.active .spark-bars i:nth-child(12) { animation-delay: 0.28s; }
.telem-card.done .spark-bars i {
  animation: none;
  background: linear-gradient(180deg, #4ade80, #22c55e);
}
.telem-card.done .spark-bars i:nth-child(odd) { height: 55%; }
.telem-card.done .spark-bars i:nth-child(even) { height: 78%; }
.telem-card.done .spark-bars i:nth-child(3n) { height: 42%; }
@keyframes sparkBounce {
  from { height: 22%; }
  to { height: 92%; }
}

.log-table-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(16, 32, 64, 0.55);
  max-height: 220px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.log-table th,
.log-table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}
.log-table th {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
  background: rgba(59, 130, 246, 0.06);
}
.log-table td:first-child { font-weight: 700; }
.log-table tbody tr:last-child td { border-bottom: 0; }
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.pill.success {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.3);
}
.pill.progress {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* ——— Result dashboard ——— */
.result-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}
.bias-title {
  margin: 0.15rem 0;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 900;
  letter-spacing: -0.02em;
}
.bias-title.buy { color: #22c55e; }
.bias-title.sell { color: #ef4444; }
.bias-title.neutral { color: #f59e0b; }
.confidence-line {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--muted);
}
.confidence-line strong { color: var(--text); }
.badge {
  display: inline-flex;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}
.badge.strong { background: rgba(34,197,94,0.15); color: #86efac; }
.badge.forming { background: rgba(59,130,246,0.15); color: #93c5fd; }
.badge.weak { background: rgba(245,158,11,0.15); color: #fcd34d; }
.result-id {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}
.icon-btn {
  border: 1px solid var(--border);
  background: rgba(16, 32, 64, 0.65);
  color: var(--text);
  border-radius: 10px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.bias-desc {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.result-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.35fr);
  gap: 1rem;
  align-items: start;
  width: 100%;
  min-width: 0;
}
.signal-core {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
}
.card {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(16, 32, 64, 0.65);
  padding: 1rem;
}
.card-label {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 0.65rem;
}

.conv-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.conv-badge {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(148,163,184,0.12);
}
.conv-badge.strong { color: #86efac; background: rgba(34,197,94,0.12); }
.conv-badge.forming { color: #93c5fd; background: rgba(59,130,246,0.12); }
.conv-badge.weak { color: #fcd34d; background: rgba(245,158,11,0.12); }

.gauge-wrap {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0.75rem;
  align-items: center;
  margin: 0.5rem 0 0.85rem;
}
.gauge { position: relative; width: 120px; height: 120px; }
.gauge svg { width: 120px; height: 120px; transform: rotate(-90deg); }
.gauge-bg { fill: none; stroke: rgba(148,163,184,0.15); stroke-width: 10; }
.gauge-arc {
  fill: none;
  stroke: var(--primary);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 289;
  stroke-dashoffset: 289;
  transition: stroke-dashoffset 0.6s ease, stroke 0.3s ease;
}
.gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: none;
}
.gauge-center b {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 800;
}
.gauge-center span { font-size: 1rem; }
.conv-dir {
  margin: 0;
  font-weight: 800;
  font-size: 0.95rem;
}
.conv-dir.buy { color: #22c55e; }
.conv-dir.sell { color: #ef4444; }
.conv-dir.neutral { color: #f59e0b; }
.conv-score {
  margin: 0.25rem 0 0.5rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.conv-chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.chip-mini {
  font-size: 0.68rem;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: rgba(148,163,184,0.1);
  color: var(--muted);
}
.chip-mini i { font-style: normal; font-weight: 800; color: var(--text); font-family: var(--mono); }

.bars { display: flex; flex-direction: column; gap: 0.45rem; }
.bar-row {
  display: grid;
  grid-template-columns: 64px 1fr 40px;
  gap: 0.45rem;
  align-items: center;
}
.bar-tag {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.bar-tag.buy { color: #22c55e; }
.bar-tag.sell { color: #ef4444; }
.bar-tag.neu { color: #f59e0b; }
.bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(148,163,184,0.12);
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  transition: width 0.5s ease;
}
.bar.buy i { background: #22c55e; }
.bar.sell i { background: #ef4444; }
.bar.neu i { background: #f59e0b; }
.bar-row em {
  font-style: normal;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  text-align: right;
}
.conv-risk {
  margin-top: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(148,163,184,0.1);
}
.conv-risk .lbl {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  font-weight: 800;
  color: var(--muted);
}
.conv-risk .val { font-weight: 800; font-size: 0.85rem; }
.conv-risk .val.warn { color: #fbbf24; }
.conv-risk .val.bad { color: #f87171; }

.trade-plan .tp-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: flex-start;
  margin-bottom: 0.85rem;
}
.tp-head-left { display: flex; gap: 0.6rem; align-items: center; }
.tp-symbol-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary);
}
.tp-title { margin: 0; font-size: 0.85rem; font-weight: 700; }
.tp-sub { margin: 0.15rem 0 0; font-size: 0.72rem; color: var(--muted); }
.tp-side {
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: rgba(59,130,246,0.15);
  color: #93c5fd;
}
.tp-side.sell { background: rgba(239,68,68,0.15); color: #fca5a5; }
.tp-side.neutral { background: rgba(245,158,11,0.15); color: #fcd34d; }
.tp-levels { display: flex; flex-direction: column; gap: 0.55rem; }
.tp-level {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: rgba(148,163,184,0.06);
  border: 1px solid rgba(148,163,184,0.08);
}
.tp-level .lbl {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  font-weight: 800;
  color: var(--muted);
}
.tp-level .val {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.85rem;
}
.tp-level.entry { border-color: rgba(59,130,246,0.3); }
.tp-level.tp { border-color: rgba(34,197,94,0.3); }
.tp-level.sl { border-color: rgba(239,68,68,0.3); }
.tp-level .good { color: #86efac; }
.tp-level.entry .good { color: #93c5fd; }
.tp-level .bad { color: #fca5a5; }
.tp-entry-val { display: inline-flex; gap: 0.35rem; align-items: center; }
.tp-list .tp-row {
  display: flex;
  justify-content: space-between;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(148,163,184,0.08);
  font-size: 0.85rem;
}
.tp-list .lbl { color: var(--muted); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; }
.tp-list .val { font-family: var(--mono); font-weight: 700; }

.intel-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.intel-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(148,163,184,0.08);
  font-size: 0.85rem;
}
.intel-list li:last-child { border-bottom: 0; }
.intel-list strong.pass { color: #86efac; }
.intel-list strong.fail { color: #fca5a5; }

.brief-text {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: #cbd5e1;
}
.risk-box {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  padding: 0.7rem;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.18);
  font-size: 0.75rem;
  color: var(--muted);
}
.risk-box p { margin: 0; }
.risk-box .material-symbols-outlined { color: var(--primary); }

/* ——— Chart ——— */
.chart-core {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(16, 32, 64, 0.72);
  padding: 1rem;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 1rem;
  min-width: 0;
  width: 100%;
}
.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  gap: 0.75rem;
}
.chart-title {
  margin: 0.15rem 0 0;
  font-weight: 700;
  font-size: 0.95rem;
}
.rr-badge {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.4rem 0.7rem;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #93c5fd;
  white-space: nowrap;
}
.tv-chart {
  flex: 1;
  min-height: 420px;
  width: 100%;
  max-width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(148,163,184,0.1);
  background: #081428;
}
.chart-footnote {
  margin: 0.65rem 0 0;
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1.4;
}

/* ——— Responsive ——— */
@media (max-width: 1100px) {
  .result-dashboard { grid-template-columns: 1fr; }
  .chart-core {
    position: static;
    min-height: 0;
  }
  .tv-chart { min-height: 340px; }
}

@media (max-width: 980px) {
  .app-shell { padding: 0 0.85rem 2rem; }
  .controls-grid { grid-template-columns: 1fr 1fr; }
  .controls-grid .live-field { grid-column: 1 / -1; }
  .telemetry-grid { grid-template-columns: 1fr 1fr; }
  .skeleton-grid { grid-template-columns: 1fr; }
  .panel { padding: 1rem; }
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.75rem;
  }
  .brand-mark { height: 34px; max-width: 150px; }
  .topbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
  .btn-ghost,
  .btn-glow {
    width: 100%;
    text-align: center;
    padding: 0.55rem 0.65rem;
    font-size: 0.8rem;
    white-space: nowrap;
  }
  .connection-bar { grid-template-columns: 1fr; gap: 0.75rem; }
  .connection-right { justify-self: start; }
  .controls-grid { grid-template-columns: 1fr; }
  .controls-grid .live-field { grid-column: auto; }
  .telemetry-grid { grid-template-columns: 1fr; }
  .result-head {
    flex-direction: column;
    align-items: stretch;
  }
  .result-id {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }
  .gauge-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
  .conv-meta { text-align: center; }
  .conv-chips { justify-content: center; }
  .chart-head {
    flex-direction: column;
    align-items: stretch;
  }
  .rr-badge { align-self: flex-start; }
  .tv-chart { min-height: 280px; }
  .tp-level {
    flex-wrap: wrap;
    gap: 0.35rem;
  }
  .tp-level .val {
    font-size: 0.8rem;
    word-break: break-all;
  }
  .bar-row {
    grid-template-columns: 56px 1fr 36px;
    gap: 0.35rem;
  }
  .intel-list li {
    flex-wrap: wrap;
    gap: 0.35rem;
  }
  .log-table {
    min-width: 480px;
  }
  .stage-top h1 { font-size: 1.35rem; }
  .sub { font-size: 0.88rem; }
  .bias-title { font-size: 1.45rem; }
  .bias-desc { font-size: 0.86rem; }
  .chart-footnote { font-size: 0.65rem; }

  /* Mobile / short width: single-line button label only */
  .btn-primary {
    min-height: 52px;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    gap: 0.5rem;
  }
  .btn-idle:not([hidden]),
  .btn-analyzing:not([hidden]),
  .btn-ready:not([hidden]) {
    width: 100%;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
  }
  .btn-idle[hidden],
  .btn-analyzing[hidden],
  .btn-ready[hidden] {
    display: none !important;
  }
  .btn-ico { font-size: 22px !important; }
  .btn-copy {
    align-items: center;
    text-align: center;
    flex: 0 1 auto;
  }
  .btn-copy b {
    font-size: 0.95rem;
    white-space: nowrap;
    line-height: 1.2;
  }
  .btn-primary[data-state="idle"] .btn-sub,
  .btn-primary[data-state="ready"] #readySub {
    display: none !important;
  }
  .btn-primary[data-state="analyzing"] .btn-copy b {
    font-size: 0.9rem;
  }
  .btn-primary[data-state="analyzing"] #analyzeTimer {
    font-size: 0.72rem;
    text-align: center;
  }
}

@media (max-width: 420px) {
  .app-shell { padding: 0 0.65rem 1.5rem; }
  .topbar-actions { grid-template-columns: 1fr; }
  .btn-ghost,
  .btn-glow { font-size: 0.78rem; }
  .btn-primary {
    min-height: 48px;
    padding: 0.75rem 0.8rem;
  }
  .btn-copy b { font-size: 0.9rem; }
  .btn-ico { font-size: 20px !important; }
  .tv-chart { min-height: 240px; }
  .card { padding: 0.85rem; }
  .panel { padding: 0.85rem; margin-bottom: 0.75rem; }
  .status-pill { font-size: 0.68rem; padding: 0.4rem 0.7rem; }
}

/* Short height / compact windows: keep button to one label line */
@media (max-height: 720px) {
  .btn-primary[data-state="idle"] .btn-sub,
  .btn-primary[data-state="ready"] #readySub {
    display: none !important;
  }
  .btn-primary {
    min-height: 52px;
    padding: 0.8rem 1rem;
  }
}
