:root {
  --bg: #071018;
  --panel: rgba(12, 24, 36, 0.82);
  --panel-strong: rgba(16, 32, 48, 0.94);
  --line: rgba(148, 163, 184, 0.22);
  --line-strong: rgba(148, 163, 184, 0.36);
  --text: #e6edf5;
  --muted: #aab8c8;
  --muted-2: #7f91a5;
  --brand: #42d392;
  --brand-2: #59a6ff;
  --warn: #ffd166;
  --danger: #ff6b6b;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.35);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 5%, rgba(66, 211, 146, 0.13), transparent 28%),
    radial-gradient(circle at 90% 8%, rgba(89, 166, 255, 0.15), transparent 32%),
    linear-gradient(135deg, #06111a 0%, #08131d 48%, #0b1420 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1420px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 60px;
}

.hero {
  border: 1px solid var(--line);
  border-radius: 30px;
  background: linear-gradient(140deg, rgba(14, 32, 48, 0.92), rgba(8, 20, 32, 0.72));
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -80px -120px auto;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: rgba(66, 211, 146, 0.09);
  filter: blur(12px);
  pointer-events: none;
}

.nav,
.hero-grid,
.main-grid,
.output {
  position: relative;
  z-index: 1;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px 28px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  width: 52px;
  height: 52px;
  border-radius: 17px;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: #04110b;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 12px 36px rgba(66, 211, 146, 0.18);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}

h2 {
  font-size: clamp(2.3rem, 5vw, 5.4rem);
  line-height: 0.98;
  letter-spacing: -0.07em;
  max-width: 970px;
}

h3 {
  font-size: 1.2rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.lede {
  color: var(--muted);
  line-height: 1.65;
  font-size: 1.05rem;
  max-width: 770px;
  margin-top: 22px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 30px;
  padding: 46px 28px 34px;
  align-items: end;
}

.runtime {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(66, 211, 146, 0.38);
  color: #b8ffd9;
  background: rgba(66, 211, 146, 0.11);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 800;
}

.pill.ghost {
  color: var(--muted);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.pipeline-card,
.panel,
.result-card,
.empty-card {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(16px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.pipeline-card {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.pipeline-step {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  font-weight: 800;
}

.pipeline-step.active {
  color: var(--text);
  border-color: rgba(66, 211, 146, 0.5);
  background: rgba(66, 211, 146, 0.1);
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(330px, 0.6fr);
  gap: 22px;
  margin-top: 22px;
}

.panel {
  padding: 24px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 20px;
}

.form-stack {
  display: grid;
  gap: 16px;
}

.field-label,
.options-grid label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

input,
select,
textarea {
  width: 100%;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 15px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(66, 211, 146, 0.58);
  box-shadow: 0 0 0 4px rgba(66, 211, 146, 0.09);
  background: rgba(255, 255, 255, 0.07);
}

button[type="submit"],
.primary-button {
  border: 0;
  border-radius: 16px;
  padding: 14px 20px;
  color: #03110b;
  background: linear-gradient(135deg, var(--brand), #9af7c7);
  font-weight: 900;
  box-shadow: 0 14px 40px rgba(66, 211, 146, 0.2);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.secondary-button,
.icon-button,
.text-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  border-radius: 14px;
  padding: 10px 12px;
  font-weight: 800;
}

.text-button {
  color: var(--brand);
  border-color: rgba(66, 211, 146, 0.3);
  background: rgba(66, 211, 146, 0.08);
  padding: 4px 8px;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.options-grid label {
  display: grid;
  gap: 8px;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.checkbox-line input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.progress {
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  border: 1px solid rgba(66, 211, 146, 0.22);
  background: rgba(66, 211, 146, 0.08);
  border-radius: 18px;
  padding: 15px;
}

.progress strong {
  color: var(--text);
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.error-box {
  margin-top: 18px;
  border: 1px solid rgba(255, 107, 107, 0.38);
  background: rgba(255, 107, 107, 0.08);
  color: #ffd0d0;
  border-radius: 16px;
  padding: 14px;
  line-height: 1.55;
}

.history-list {
  display: grid;
  gap: 10px;
  max-height: 480px;
  overflow: auto;
  padding-right: 4px;
}

.history-item {
  text-align: left;
  display: grid;
  gap: 6px;
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  border-radius: 16px;
  padding: 14px;
}

.history-item:hover {
  border-color: rgba(66, 211, 146, 0.35);
  background: rgba(66, 211, 146, 0.07);
}

.history-title {
  font-weight: 900;
}

.history-meta,
.history-score {
  color: var(--muted);
  font-size: 0.82rem;
}

.empty-state,
.empty-output {
  color: var(--muted);
}

.output {
  margin-top: 22px;
}

.output-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.empty-card {
  padding: 32px;
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.result-card {
  padding: 22px;
  overflow: hidden;
}

.result-card h4 {
  margin: 0 0 14px;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
}

.card-subtitle {
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 14px;
}

.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: 12px;
}

.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.kv {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.035);
}

.kv span {
  display: block;
  color: var(--muted-2);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 900;
  margin-bottom: 7px;
}

.kv strong {
  line-height: 1.45;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 0.84rem;
}

.driver-grid,
.news-grid,
.risk-grid,
.source-grid,
.check-grid,
.forecast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.mini-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.035);
  min-width: 0;
}

.mini-card h5 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.mini-card p,
.mini-card li {
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.9rem;
}

.mini-card ul {
  padding-left: 18px;
  margin: 10px 0 0;
}

.prompt-box {
  white-space: pre-wrap;
  background: rgba(1, 8, 14, 0.72);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  color: #d6e8fb;
  line-height: 1.55;
  max-height: 560px;
  overflow: auto;
}

.score-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
}

.score-circle {
  --score: 0;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--brand) calc(var(--score) * 1%), rgba(255, 255, 255, 0.09) 0);
  position: relative;
}

.score-circle::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: var(--panel-strong);
}

.score-circle strong {
  position: relative;
  z-index: 1;
  font-size: 1.7rem;
}

.advisory {
  border-color: rgba(66, 211, 146, 0.34);
  background: linear-gradient(135deg, rgba(66, 211, 146, 0.09), rgba(89, 166, 255, 0.07));
}

.disclaimer {
  border-color: rgba(255, 209, 102, 0.32);
  background: rgba(255, 209, 102, 0.08);
  color: #ffe8aa;
}

.source-link {
  color: #a9d3ff;
  word-break: break-word;
}

.hidden {
  display: none !important;
}

@media (max-width: 1100px) {
  .hero-grid,
  .main-grid {
    grid-template-columns: 1fr;
  }

  .options-grid,
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 18px, 1420px);
    padding-top: 9px;
  }

  .nav,
  .output-header,
  .input-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .runtime,
  .action-row {
    justify-content: start;
  }

  h2 {
    font-size: 2.25rem;
    letter-spacing: -0.05em;
  }

  .hero-grid,
  .nav,
  .panel,
  .result-card,
  .empty-card {
    padding: 18px;
  }

  .options-grid,
  .grid-2,
  .grid-3,
  .grid-4,
  .score-card {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: white;
    color: #111827;
  }

  .hero,
  .main-grid,
  .action-row,
  .history-panel {
    display: none !important;
  }

  .result-card,
  .mini-card,
  .kv {
    box-shadow: none;
    border-color: #d1d5db;
    background: white;
    color: #111827;
  }

  .mini-card p,
  .mini-card li,
  .card-subtitle,
  .kv span {
    color: #374151;
  }

  .output {
    margin: 0;
  }
}

.section-gap {
  margin-top: 12px;
}

.nested {
  margin-top: 12px;
  box-shadow: none;
}

.muted {
  color: var(--muted);
}

.compact {
  margin-bottom: 8px;
}

.saved-prompt {
  margin-top: 20px;
  border: 1px solid rgba(89, 166, 255, 0.42);
  background: rgba(89, 166, 255, 0.08);
  border-radius: 16px;
  padding: 16px 18px;
  display: grid;
  gap: 14px;
}

.saved-prompt.hidden {
  display: none;
}

.saved-prompt-header strong {
  color: var(--text);
  font-size: 15px;
}

.saved-prompt-header .card-subtitle {
  margin-top: 4px;
  color: var(--muted);
}

.saved-prompt-list {
  display: grid;
  gap: 10px;
}

.saved-prompt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.saved-prompt-actions #refresh-new {
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #04121f;
  font-weight: 700;
  cursor: pointer;
}

.saved-prompt-actions #refresh-new:hover {
  filter: brightness(1.08);
}

/* ── CR-001: Async Job Progress Panel ───────────────────────────────────────── */

.job-panel {
  margin-top: 20px;
  border: 1px solid rgba(66, 211, 146, 0.28);
  background: rgba(66, 211, 146, 0.06);
  border-radius: 18px;
  padding: 16px 18px;
  display: grid;
  gap: 10px;
}

.job-panel.hidden { display: none !important; }

.job-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.job-panel-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
}

.job-status-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.job-status-queued   { background: rgba(255,255,255,0.1);  color: var(--muted); }
.job-status-running  { background: rgba(89,166,255,0.18);  color: #a9d3ff; }
.job-status-completed{ background: rgba(66,211,146,0.18);  color: #b8ffd9; }
.job-status-failed   { background: rgba(255,107,107,0.18); color: #ffd0d0; }
.job-status-cancelled{ background: rgba(255,209,102,0.18); color: #ffe8aa; }

.job-progress-bar-track {
  width: 100%;
  height: 5px;
  background: rgba(255,255,255,0.1);
  border-radius: 999px;
  overflow: hidden;
}

.job-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  border-radius: 999px;
  transition: width 0.5s ease;
  min-width: 4px;
}

.job-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.job-meta-muted { opacity: 0.7; }

.job-spinner-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.spinner.small {
  width: 14px;
  height: 14px;
  border-width: 2px;
}

.job-cancel-btn {
  font-size: 0.8rem;
  padding: 0.2rem 0.6rem;
  color: var(--muted);
  flex-shrink: 0;
}

.error-action-btn {
  margin-left: 0.75rem;
  font-size: 0.82rem;
  padding: 0.25rem 0.75rem;
}


/* ═══════════════════════════════════════════════════════════════════════════
   CR-002 — RationalMode AI Tab Styles
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Utility ─────────────────────────────────────────────────────────────── */
.rm-hidden { display: none !important; }

/* ── Sample data disclaimer (SF-5) ──────────────────────────────────────── */
.rm-sample-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(89,166,255,0.08);
  border: 1px solid rgba(89,166,255,0.3);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 4px;
  font-size: 0.88rem;
  color: var(--muted);
}
.rm-sample-disclaimer strong { color: var(--brand-2); }
.rm-sample-disclaimer .rm-danger-icon { color: var(--brand-2); flex-shrink: 0; margin-top: 1px; }

/* ── View tab bar ────────────────────────────────────────────────────────── */
.view-tabs {
  display: flex;
  gap: 4px;
  margin: 28px 0 0;
  padding: 6px;
  background: rgba(12, 24, 36, 0.7);
  border: 1px solid var(--line);
  border-radius: 18px;
  width: fit-content;
}

.view-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 22px;
  border-radius: 13px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}

.view-tab:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

.view-tab-active {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #04110b;
  font-weight: 700;
}

.view-tab-badge {
  background: rgba(255,255,255,0.25);
  color: inherit;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 6px;
  letter-spacing: 0.04em;
}

/* ── RationalMode container ──────────────────────────────────────────────── */
.rational-mode {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding-bottom: 60px;
}

/* ── Section shell ───────────────────────────────────────────────────────── */
.rm-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 32px;
  backdrop-filter: blur(8px);
}

.rm-section-header {
  margin-bottom: 22px;
}

.rm-section-eyebrow {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 6px;
}

.rm-section-title {
  font-size: clamp(1.3rem, 2.5vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 6px;
  color: var(--text);
}

.rm-section-sub {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

/* ── Status colors ───────────────────────────────────────────────────────── */
.rm-status-bullish { color: var(--brand) !important; }
.rm-status-bearish { color: var(--danger) !important; }
.rm-status-caution { color: var(--warn) !important; }
.rm-status-info    { color: var(--brand-2) !important; }

/* ── Badge ───────────────────────────────────────────────────────────────── */
.rm-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(255,255,255,0.07);
}

/* ── Confidence bar ──────────────────────────────────────────────────────── */
.rm-confidence-bar {
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  margin-top: 6px;
  overflow: hidden;
}
.rm-confidence-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  border-radius: 4px;
  transition: width 0.6s ease;
}

/* ── Executive Summary ───────────────────────────────────────────────────── */
.rm-executive-summary {
  background: linear-gradient(140deg, rgba(14,32,48,0.96), rgba(8,20,32,0.88));
  border-color: var(--line-strong);
}

.rm-exec-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.rm-exec-state {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rm-exec-label {
  font-size: 0.78rem;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
}

.rm-exec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.rm-exec-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rm-exec-card-warn {
  border-color: rgba(255,107,107,0.25);
  background: rgba(255,107,107,0.05);
}

.rm-exec-card-label {
  font-size: 0.74rem;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.rm-exec-card-value {
  font-size: 1rem;
  font-weight: 700;
}

.rm-exec-action {
  background: rgba(66,211,146,0.06);
  border: 1px solid rgba(66,211,146,0.2);
  border-radius: 14px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.rm-exec-action-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

/* ── Market Overview ─────────────────────────────────────────────────────── */
.rm-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.rm-overview-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rm-overview-label {
  font-size: 0.72rem;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.rm-overview-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

/* ── Danger window banner ────────────────────────────────────────────────── */
.rm-danger-window {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: rgba(255,107,107,0.1);
  border: 1px solid rgba(255,107,107,0.35);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 18px;
}

.rm-danger-window strong { color: var(--danger); }
.rm-danger-window p { margin: 4px 0 0; font-size: 0.85rem; color: var(--muted); }
.rm-danger-icon { font-size: 1.2rem; color: var(--danger); flex-shrink: 0; margin-top: 2px; }

/* ── Timeline ────────────────────────────────────────────────────────────── */
.rm-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rm-event-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 18px;
  background: rgba(255,255,255,0.03);
}

.rm-event-high { border-left: 3px solid var(--danger); }
.rm-event-medium { border-left: 3px solid var(--warn); }
.rm-event-low { border-left: 3px solid var(--brand); }

.rm-event-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.rm-event-name { font-weight: 700; font-size: 0.95rem; }
.rm-event-time { font-size: 0.78rem; color: var(--muted); margin-left: auto; }
.rm-countdown { font-size: 0.75rem; color: var(--brand-2); font-weight: 600; white-space: nowrap; }

.rm-impact-badge {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

.rm-impact-high { background: rgba(255,107,107,0.2); color: var(--danger); }
.rm-impact-medium { background: rgba(255,209,102,0.2); color: var(--warn); }
.rm-impact-low { background: rgba(66,211,146,0.15); color: var(--brand); }

.rm-event-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}

.rm-event-kv {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rm-event-kv span { font-size: 0.72rem; color: var(--muted-2); text-transform: uppercase; letter-spacing: 0.05em; }
.rm-event-kv strong { font-size: 0.85rem; }
.rm-event-action strong { color: var(--brand-2); }

/* ── AI Market Analysis ──────────────────────────────────────────────────── */
.rm-analysis-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 24px;
}

.rm-analysis-paragraph {
  font-size: 0.97rem;
  line-height: 1.72;
  color: var(--text);
  margin: 0 0 18px;
}

.rm-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rm-chip {
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.rm-analysis-chips .rm-chip { font-size: 0.82rem; }

/* ── Visualized Market Report ────────────────────────────────────────────── */
.rm-visual-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(260px, 0.55fr);
  gap: 20px;
  align-items: start;
}

.rm-chart-area {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rm-chart-placeholder {
  background: rgba(6,17,26,0.8);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
}

.rm-chart-inner {
  position: relative;
}

.rm-chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

.rm-chart-overlay-info {
  position: absolute;
  top: 10px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-end;
}

.rm-chart-label {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  backdrop-filter: blur(4px);
}

.rm-chart-label-entry { background: rgba(66,211,146,0.2); color: var(--brand); }
.rm-chart-label-sl    { background: rgba(255,107,107,0.2); color: var(--danger); }
.rm-chart-label-tp    { background: rgba(255,209,102,0.2); color: var(--warn); }
.rm-chart-label-rr    { background: rgba(89,166,255,0.2); color: var(--brand-2); }

.rm-chart-note {
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted-2);
  padding: 8px 12px 12px;
  margin: 0;
}

/* ── Heatmap ─────────────────────────────────────────────────────────────── */
.rm-heatmap {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
}

.rm-heatmap-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 12px;
}

.rm-heatmap-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.rm-heatmap-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  min-width: 56px;
}

.rm-heatmap-tf { font-size: 0.72rem; color: var(--muted-2); font-weight: 600; }
.rm-heatmap-sig { font-size: 0.78rem; font-weight: 700; }

/* ── Intelligence panel ──────────────────────────────────────────────────── */
.rm-intelligence-panel {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.rm-intel-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 14px;
}

.rm-intel-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.rm-intel-row:last-of-type { border-bottom: none; }
.rm-intel-label { font-size: 0.8rem; color: var(--muted); }
.rm-intel-value { font-size: 0.88rem; font-weight: 700; }
.rm-intel-divider { height: 1px; background: var(--line-strong); margin: 14px 0; }

.rm-intel-zones { display: flex; flex-direction: column; gap: 12px; }
.rm-zone-group { display: flex; flex-direction: column; gap: 6px; }
.rm-zone-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }

.rm-zone-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  margin: 2px 4px 2px 0;
}

.rm-zone-support    { background: rgba(66,211,146,0.12); color: var(--brand); border: 1px solid rgba(66,211,146,0.25); }
.rm-zone-resistance { background: rgba(255,107,107,0.12); color: var(--danger); border: 1px solid rgba(255,107,107,0.25); }
.rm-zone-tp         { background: rgba(255,209,102,0.12); color: var(--warn); border: 1px solid rgba(255,209,102,0.25); }

/* ── Setup section ───────────────────────────────────────────────────────── */
.rm-subtabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px;
  width: fit-content;
}

.rm-subtab {
  padding: 8px 20px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.rm-subtab:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.rm-subtab-active { background: rgba(255,255,255,0.1); color: var(--text); font-weight: 700; }

.rm-setup-panel { display: flex; flex-direction: column; gap: 18px; }
.rm-mode-desc { font-size: 0.85rem; color: var(--muted); margin: 0 0 4px; }

.rm-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.rm-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

.rm-field-sm { min-width: 0; }

.rm-input, .rm-select, .rm-textarea {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.15s;
}

.rm-input:focus, .rm-select:focus, .rm-textarea:focus {
  border-color: var(--brand);
}

.rm-textarea { resize: vertical; min-height: 90px; }

.rm-subsection-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 8px 0 10px;
}

/* ── Strategy checkboxes ─────────────────────────────────────────────────── */
.rm-strategy-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.rm-strategy-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.rm-strategy-check:hover { border-color: var(--brand); background: rgba(66,211,146,0.05); }
.rm-strategy-check input { margin-top: 2px; accent-color: var(--brand); }
.rm-check-label { font-weight: 600; font-size: 0.88rem; }
.rm-check-desc { font-size: 0.75rem; color: var(--muted-2); margin-top: 2px; }

.rm-strategy-input-area { display: flex; flex-direction: column; gap: 10px; }

/* ── AI converted strategy ───────────────────────────────────────────────── */
.rm-converted-strategy {
  background: rgba(66,211,146,0.05);
  border: 1px solid rgba(66,211,146,0.2);
  border-radius: 14px;
  padding: 18px 20px;
  margin-top: 4px;
}

.rm-converted-grid { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }

.rm-converted-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(66,211,146,0.1);
  font-size: 0.88rem;
}

.rm-converted-label { color: var(--muted); }
.rm-converted-value { font-weight: 700; color: var(--text); }

/* ── Strategy Builder ────────────────────────────────────────────────────── */
.rm-workflow-board {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 18px;
}

.rm-workflow-step {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 20px;
}

.rm-workflow-step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.rm-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #04110b;
  font-weight: 800;
  font-size: 0.82rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.rm-step-title { font-weight: 700; font-size: 0.95rem; }
.rm-step-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }

.rm-risk-controls-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,107,107,0.08);
  border: 1px solid rgba(255,107,107,0.3);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--muted);
}

.rm-risk-controls-banner strong { color: var(--danger); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.rm-btn {
  padding: 10px 22px;
  border-radius: 11px;
  border: none;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.rm-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.rm-btn:active { transform: translateY(0); }

.rm-btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #04110b;
}

.rm-btn-secondary {
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--line);
  color: var(--text);
}

.rm-btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}

/* ── Public Strategies ───────────────────────────────────────────────────── */
.rm-strategy-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.rm-strategy-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.15s;
}

.rm-strategy-card:hover { border-color: var(--line-strong); }

.rm-strategy-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.rm-strategy-name { font-size: 1rem; font-weight: 700; }

.rm-strategy-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--muted);
}

.rm-strategy-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.rm-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(255,255,255,0.03);
  border-radius: 9px;
  padding: 8px 10px;
}

.rm-stat span { font-size: 0.7rem; color: var(--muted-2); text-transform: uppercase; letter-spacing: 0.05em; }
.rm-stat strong { font-size: 0.88rem; font-weight: 700; }

.rm-strategy-indicators { display: flex; flex-wrap: wrap; gap: 6px; }
.rm-strategy-condition { font-size: 0.78rem; color: var(--muted); margin: 0; }

.rm-strategy-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

/* ── Risk Warning Modal ──────────────────────────────────────────────────── */
.rm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.rm-modal {
  background: var(--panel-strong);
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  padding: 28px 32px;
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow);
}

.rm-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.rm-modal-header h3 { margin: 0; font-size: 1.1rem; }

.rm-modal-body { margin-bottom: 22px; }

.rm-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.rm-risk-warning-content { display: flex; flex-direction: column; gap: 14px; }

.rm-risk-warning-banner {
  background: rgba(255,107,107,0.1);
  border: 1px solid rgba(255,107,107,0.3);
  border-radius: 12px;
  padding: 14px 16px;
}

.rm-risk-warning-banner strong { color: var(--danger); display: block; margin-bottom: 6px; }
.rm-risk-warning-banner p { margin: 0; font-size: 0.85rem; color: var(--muted); }

.rm-risk-details { display: flex; flex-direction: column; gap: 6px; }

.rm-risk-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.rm-risk-row span { color: var(--muted); }

.rm-paper-trade-rec {
  background: rgba(66,211,146,0.07);
  border: 1px solid rgba(66,211,146,0.2);
  border-radius: 10px;
  padding: 12px 14px;
}

.rm-paper-trade-rec strong { display: block; color: var(--brand); margin-bottom: 4px; font-size: 0.88rem; }
.rm-paper-trade-rec p { margin: 0; font-size: 0.82rem; color: var(--muted); }

.rm-disclaimer-small { font-size: 0.75rem; color: var(--muted-2); margin: 0; }

/* ── Alerts & Journal ────────────────────────────────────────────────────── */
.rm-aj-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 20px;
  align-items: start;
}

.rm-panel-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 14px;
}

.rm-alerts-list { display: flex; flex-direction: column; gap: 10px; }

.rm-alert-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  align-items: center;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.82rem;
}

.rm-alert-time { color: var(--muted-2); white-space: nowrap; }
.rm-alert-text { color: var(--text); }
.rm-alert-action { color: var(--brand-2); font-size: 0.75rem; white-space: nowrap; }

.rm-journal-table-wrap { overflow-x: auto; }

.rm-journal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.rm-journal-table th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--muted-2);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.rm-journal-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  vertical-align: top;
}

.rm-journal-win td:first-child { border-left: 2px solid var(--brand); }
.rm-journal-loss td:first-child { border-left: 2px solid var(--danger); }
.rm-journal-review { font-size: 0.75rem; color: var(--muted); }

/* ── Current Output ──────────────────────────────────────────────────────── */
.rm-current-output-section {
  border-style: dashed;
}

.rm-current-output-note {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0;
  padding: 18px;
  background: rgba(255,255,255,0.02);
  border-radius: 12px;
  border: 1px solid var(--line);
}

.rm-output-clone {
  opacity: 0.92;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .rm-visual-grid {
    grid-template-columns: 1fr;
  }

  /* Chart-first on mobile */
  .rm-chart-area { order: -1; }
  .rm-intelligence-panel { order: 1; }

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

@media (max-width: 640px) {
  .rm-section { padding: 18px 16px; }
  .rm-exec-grid { grid-template-columns: 1fr 1fr; }
  .rm-overview-grid { grid-template-columns: repeat(3, 1fr); }
  .rm-strategy-cards { grid-template-columns: 1fr; }
  .rm-strategy-checkboxes { grid-template-columns: 1fr; }
  .rm-form-grid { grid-template-columns: 1fr; }
  .rm-step-fields { grid-template-columns: 1fr; }
  .rm-alert-row { grid-template-columns: 1fr 1fr; }
  .view-tab { padding: 8px 14px; font-size: 0.82rem; }
}
