/* ══════════════════════════════════════════════════════════════════════════
   ALPHAGLYPH — Design System
   GitHub dark palette · Inter UI + JetBrains Mono data
   ══════════════════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ──────────────────────────────────────────────── */
/* Palette mirrors the landing page (landing.css): near-black with a green
   undertone + financial green accent, so the app and landing read as one
   product instead of two. */
:root {
  --bg:        #080b0a;
  --surface:   #0f1411;
  --surface2:  #151c17;
  --border:    #1e2723;
  --border-lt: #2a352f;
  --text:      #e9efeb;
  --muted:     #8a978f;
  /* Primary accent is green to match the landing page. The variable is still
     named --blue for historical reasons — every accent in the app reads it. */
  --blue:       #3fb950;
  --green:      #3fb950;
  --green-deep: #2ea043;
  --red:        #f85149;
  --yellow:     #e3b341;
  --purple:     #d2a8ff;

  /* derived */
  --blue-dim:   rgba(63,185,80,0.14);
  --green-dim:  rgba(63,185,80,0.12);
  --red-dim:    rgba(248,81,73,0.12);
  --yellow-dim: rgba(227,179,65,0.12);
  --purple-dim: rgba(210,168,255,0.12);

  --font-ui:   'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --radius:    10px;
  --radius-sm: 6px;
  --shadow:    0 1px 3px rgba(0,0,0,0.55), 0 8px 28px rgba(0,0,0,0.35);
}

/* ── Reset / Base ───────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  background:  var(--bg);
  /* faint green halo at the top — the landing page's signature glow */
  background-image: radial-gradient(1100px 480px at 50% -160px,
                                    rgba(46,160,67,0.07), transparent 70%);
  background-repeat: no-repeat;
  color:       var(--text);
  font-family: var(--font-ui);
  font-size:   14px;
  line-height: 1.5;
  min-height:  100vh;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(46,160,67,0.28); color: var(--text); }

/* Numbers, data, code — mono everywhere */
.mono,
.stat-value,
.stat-delta,
td,
th,
.data-value,
.badge,
input[type="number"],
input[type="date"] {
  font-family: var(--font-mono);
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar              { width: 6px; height: 6px; }
::-webkit-scrollbar-track        { background: var(--bg); }
::-webkit-scrollbar-thumb        { background: var(--border-lt); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover  { background: var(--green-deep); }

/* ── Navbar ─────────────────────────────────────────────────────────────── */
.navbar {
  position:        fixed;
  top:             0;
  left:            0;
  right:           0;
  z-index:         200;
  height:          56px;
  background:      rgba(8, 11, 10, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom:   1px solid var(--border);
  display:         flex;
  align-items:     center;
  padding:         0 24px;
  gap:             24px;
}

.nav-brand {
  display:     flex;
  align-items: center;
  gap:         8px;
  flex-shrink: 0;
}
.brand-logo { width: 20px; height: 20px; color: var(--green); flex-shrink: 0; }
.nav-brand-name {
  font-family:    var(--font-mono);
  font-size:      16px;
  font-weight:    700;
  color:          var(--blue);
  letter-spacing: 1px;
}
.nav-brand-sub {
  font-size: 11px;
  color:     var(--muted);
}

.nav-links {
  display: flex;
  gap:     4px;
  flex:    1;
}
.nav-link {
  padding:        6px 14px;
  border-radius:  var(--radius-sm);
  color:          var(--muted);
  font-size:      13px;
  font-weight:    500;
  transition:     background .15s, color .15s;
  white-space:    nowrap;
}
.nav-link:hover        { background: var(--surface2); color: var(--text); text-decoration: none; }
.nav-link.active       { background: var(--blue-dim); color: var(--blue); font-weight: 600; }

.nav-badge {
  font-family:    var(--font-mono);
  font-size:      10px;
  letter-spacing: 1.5px;
  font-weight:    700;
  padding:        3px 10px;
  border-radius:  20px;
  background:     var(--red-dim);
  border:         1px solid var(--red);
  color:          var(--red);
  flex-shrink:    0;
}

/* ── Page wrapper ───────────────────────────────────────────────────────── */
.page-wrap {
  max-width:   1400px;
  margin:      0 auto;
  padding:     72px 20px 40px;
}

.page-header {
  margin-bottom: 24px;
}
.page-header h1 {
  font-size:   24px;
  font-weight: 700;
  margin-bottom: 6px;
}
.page-header p { color: var(--muted); font-size: 14px; }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: var(--radius);
  padding:       20px;
  transition:    border-color .15s;
}
.card:hover { border-color: var(--border-lt); }
.card + .card { margin-top: 16px; }

/* ── Section headers ────────────────────────────────────────────────────── */
.section-header {
  font-size:     11px;
  font-weight:   700;
  letter-spacing: 1.5px;
  color:         var(--muted);
  text-transform: uppercase;
  padding-bottom: 12px;
  margin-bottom:  16px;
  border-bottom:  1px solid var(--border);
}

/* ── Hero stat rows ─────────────────────────────────────────────────────── */
.hero-row {
  display:   flex;
  gap:       16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.hero-stat {
  flex:          1;
  min-width:     160px;
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: var(--radius);
  padding:       20px 24px;
  position:      relative;
  overflow:      hidden;
  transition:    border-color .15s;
}
/* thin green light-bar across the top — the app's signature cyber accent */
.hero-stat::before {
  content:    '';
  position:   absolute;
  top: 0; left: 0; right: 0;
  height:     2px;
  background: linear-gradient(90deg, transparent 0%,
                              rgba(63,185,80,0.55) 50%, transparent 100%);
}
.hero-stat:hover { border-color: var(--border-lt); }
.hero-stat-value {
  font-family: var(--font-mono);
  font-size:   28px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 6px;
}
.hero-stat-label {
  font-size:      11px;
  font-weight:    600;
  letter-spacing: 1.2px;
  color:          var(--muted);
  text-transform: uppercase;
}

/* ── Stats grid ─────────────────────────────────────────────────────────── */
.stats-grid {
  display:               grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap:                   12px;
}

.stat-card {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: var(--radius);
  padding:       16px 18px;
}
.stat-value {
  font-family: var(--font-mono);
  font-size:   22px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 4px;
}
.stat-label {
  font-size:      10px;
  font-weight:    600;
  letter-spacing: 1.2px;
  color:          var(--muted);
  text-transform: uppercase;
}
.stat-delta {
  font-family: var(--font-mono);
  font-size:   11px;
  margin-top:  4px;
}

/* ── Color utilities ────────────────────────────────────────────────────── */
.positive  { color: var(--green)  !important; }
.negative  { color: var(--red)    !important; }
.neutral   { color: var(--blue)   !important; }
.text-muted{ color: var(--muted); }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display:        inline-flex;
  align-items:    center;
  padding:        2px 8px;
  border-radius:  var(--radius-sm);
  font-family:    var(--font-mono);
  font-size:      10px;
  font-weight:    700;
  letter-spacing: .5px;
  white-space:    nowrap;
}
.badge-green  { background: var(--green-dim);  color: var(--green);  border: 1px solid rgba(63,185,80,.3); }
.badge-red    { background: var(--red-dim);    color: var(--red);    border: 1px solid rgba(248,81,73,.3); }
.badge-blue   { background: var(--blue-dim);   color: var(--blue);   border: 1px solid rgba(63,185,80,.3); }
.badge-yellow { background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(227,179,65,.3); }
.badge-purple { background: var(--purple-dim); color: var(--purple); border: 1px solid rgba(210,168,255,.3); }
.badge-buy    { background: var(--green-dim);  color: var(--green);  border: 1px solid rgba(63,185,80,.3); }
.badge-sell   { background: var(--red-dim);    color: var(--red);    border: 1px solid rgba(248,81,73,.3); }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

.data-table {
  width:           100%;
  border-collapse: collapse;
  font-family:     var(--font-mono);
  font-size:       12px;
}
.data-table thead {
  position: sticky;
  top:      0;
  z-index:  1;
}
.data-table th {
  background:     var(--surface);
  padding:        10px 14px;
  text-align:     left;
  font-size:      10px;
  font-weight:    700;
  letter-spacing: 1.2px;
  color:          var(--muted);
  border-bottom:  2px solid var(--border);
  white-space:    nowrap;
  text-transform: uppercase;
}
.data-table td {
  padding:       9px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space:   nowrap;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover   { background: var(--surface2); }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display:        block;
  font-size:      11px;
  font-weight:    600;
  letter-spacing: 1px;
  color:          var(--muted);
  text-transform: uppercase;
  margin-bottom:  6px;
}
.form-row {
  display:   flex;
  gap:       12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

input[type="text"],
input[type="number"],
input[type="date"],
select,
.input,
.select {
  background:    var(--surface2);
  border:        1px solid var(--border);
  border-radius: var(--radius-sm);
  color:         var(--text);
  font-family:   var(--font-mono);
  font-size:     13px;
  padding:       8px 12px;
  outline:       none;
  width:         100%;
  transition:    border-color .15s;
}
input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus,
.input:focus,
.select:focus {
  border-color: var(--blue);
  box-shadow:   0 0 0 3px rgba(63,185,80,0.13);
}

select option  { background: var(--surface); }

/* colour scheme for date pickers */
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.6);
  cursor: pointer;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display:        inline-flex;
  align-items:    center;
  justify-content: center;
  gap:            6px;
  padding:        8px 18px;
  border:         1px solid var(--border);
  border-radius:  var(--radius-sm);
  background:     var(--surface2);
  color:          var(--text);
  font-family:    var(--font-ui);
  font-size:      13px;
  font-weight:    600;
  cursor:         pointer;
  transition:     background .15s, border-color .15s, color .15s;
  white-space:    nowrap;
  user-select:    none;
}
.btn:hover:not(:disabled)  { background: var(--border); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled               { opacity: .4; cursor: not-allowed; }

/* Solid green with dark text — same treatment as the landing page CTA */
.btn-primary {
  background:   var(--green-deep);
  border-color: var(--green-deep);
  color:        #04140a;
}
.btn-primary:hover:not(:disabled) {
  background:   var(--green);
  border-color: var(--green);
  box-shadow:   0 0 16px rgba(63,185,80,0.25);
}

.btn-danger {
  background:   var(--red-dim);
  border-color: var(--red);
  color:        var(--red);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(248,81,73,0.2);
}

.btn-ghost {
  background:   transparent;
  border-color: transparent;
  color:        var(--muted);
}
.btn-ghost:hover:not(:disabled) {
  background:   var(--surface2);
  border-color: var(--border);
  color:        var(--text);
}

.btn-sm {
  padding:   5px 12px;
  font-size: 12px;
}

/* ── Tab system ─────────────────────────────────────────────────────────── */
.tabs { }

.tab-list {
  display:       flex;
  gap:           2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x:    auto;
  scrollbar-width: none;
}
.tab-list::-webkit-scrollbar { display: none; }

.tab-btn {
  padding:        8px 16px;
  border:         none;
  border-bottom:  2px solid transparent;
  background:     transparent;
  color:          var(--muted);
  font-family:    var(--font-ui);
  font-size:      13px;
  font-weight:    500;
  cursor:         pointer;
  transition:     color .15s, border-color .15s;
  white-space:    nowrap;
  margin-bottom:  -1px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color:        var(--text);
  border-bottom-color: var(--blue);
  font-weight:  600;
}

/* Research tab — special styling to draw attention */
.tab-btn[data-tab="research-tab"] {
  color: var(--purple);
  font-weight: 600;
}
.tab-btn[data-tab="research-tab"]:hover { color: #e2c5ff; }
.tab-btn[data-tab="research-tab"].active {
  border-bottom-color: var(--purple);
  color: var(--purple);
}

.tab-panel         { display: none; }
.tab-panel.active  { display: block; }

/* ── Sidebar layout ─────────────────────────────────────────────────────── */
.sidebar-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap:     24px;
  align-items: start;
}

.form-panel {
  position:      sticky;
  top:           72px;
  max-height:    calc(100vh - 90px);
  overflow-y:    auto;
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: var(--radius);
  padding:       24px;
}
.form-panel h2 {
  font-size:      12px;
  font-weight:    700;
  letter-spacing: 2px;
  color:          var(--muted);
  text-transform: uppercase;
  margin-bottom:  20px;
}

.results-area { min-width: 0; }

@media (max-width: 1024px) {
  .sidebar-layout { grid-template-columns: 1fr; }
  .form-panel { position: static; max-height: none; }
}

/* ── Two-column grid ────────────────────────────────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
}

/* ── Chart section ──────────────────────────────────────────────────────── */
.chart-section { }
.chart-wrap {
  position:   relative;
  height:     300px;
}
.chart-wrap canvas {
  width:  100% !important;
  height: 100% !important;
}

/* ── Status dot ─────────────────────────────────────────────────────────── */
.dot {
  display:       inline-block;
  width:         8px;
  height:        8px;
  border-radius: 50%;
  flex-shrink:   0;
}
.dot-green  { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot-red    { background: var(--red); }
.dot-yellow {
  background: var(--yellow);
  animation:  pulse-yellow 1.5s ease-in-out infinite;
}
@keyframes pulse-yellow {
  0%, 100% { box-shadow: 0 0 3px var(--yellow); }
  50%       { box-shadow: 0 0 10px var(--yellow); }
}

/* ── Loading spinner ────────────────────────────────────────────────────── */
.spinner {
  display:       inline-block;
  width:         16px;
  height:        16px;
  border:        2px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation:     spin .7s linear infinite;
  flex-shrink:   0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-state {
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  gap:             16px;
  padding:         64px 20px;
  color:           var(--muted);
  font-size:       14px;
}
.loading-state .spinner { width: 32px; height: 32px; border-width: 3px; }

/* ── Empty state ────────────────────────────────────────────────────────── */
.empty-state {
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  gap:             12px;
  padding:         64px 20px;
  color:           var(--muted);
  font-size:       14px;
  text-align:      center;
}
.empty-state-icon { font-size: 40px; opacity: .4; }

/* ── Scroll box ─────────────────────────────────────────────────────────── */
.scroll-box {
  max-height: 400px;
  overflow-y: auto;
}

/* ── Status bar ─────────────────────────────────────────────────────────── */
.status-bar {
  display:       flex;
  align-items:   center;
  gap:           12px;
  margin-bottom: 20px;
  flex-wrap:     wrap;
}
.status-bar-item {
  display:     flex;
  align-items: center;
  gap:         6px;
  font-size:   13px;
}
.status-bar-sep { color: var(--border); }

/* ── Ticker chips ───────────────────────────────────────────────────────── */
.chip-grid {
  display:   flex;
  flex-wrap: wrap;
  gap:       6px;
}
.ticker-chip {
  padding:       5px 12px;
  border:        1px solid var(--border);
  border-radius: var(--radius-sm);
  background:    var(--surface2);
  color:         var(--muted);
  font-family:   var(--font-mono);
  font-size:     12px;
  font-weight:   600;
  cursor:        pointer;
  transition:    all .15s;
  user-select:   none;
}
.ticker-chip:hover  { border-color: var(--blue); color: var(--blue); }
.ticker-chip.selected {
  display:      inline-flex;
  align-items:  center;
  gap:          6px;
  border-color: var(--blue);
  background:   var(--blue-dim);
  color:        var(--blue);
}

/* Free-text ticker input */
.ticker-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.ticker-input-row input {
  flex: 1;
  text-transform: uppercase;
}
.ticker-input-row .btn { flex-shrink: 0; }

.ticker-error {
  font-size: 12px;
  color: var(--red);
  background: var(--red-dim);
  border: 1px solid rgba(248,81,73,.3);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  margin-bottom: 8px;
}

/* Remove (×) button inside a ticker chip */
.chip-x {
  border: none;
  background: transparent;
  color: var(--blue);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  opacity: .65;
  transition: opacity .15s;
}
.chip-x:hover { opacity: 1; }

/* ── Risk buttons ───────────────────────────────────────────────────────── */
.risk-btn-group {
  display: flex;
  gap:     6px;
}
.risk-btn {
  flex:          1;
  padding:       8px 10px;
  border:        1px solid var(--border);
  border-radius: var(--radius-sm);
  background:    var(--surface2);
  color:         var(--muted);
  font-family:   var(--font-mono);
  font-size:     11px;
  font-weight:   600;
  cursor:        pointer;
  text-align:    center;
  transition:    all .15s;
  user-select:   none;
}
.risk-btn:hover { border-color: var(--blue); color: var(--text); }
.risk-btn.active {
  border-color: var(--blue);
  background:   var(--blue-dim);
  color:        var(--blue);
}

/* ── Verdict card — Research tab ────────────────────────────────────────── */
.verdict-card {
  border:        2px solid var(--border);
  border-radius: var(--radius);
  padding:       24px;
  margin-bottom: 20px;
  text-align:    center;
}
.verdict-label {
  font-size:      10px;
  font-weight:    700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color:          var(--muted);
  margin-bottom:  12px;
}
.verdict-main {
  font-family:    var(--font-mono);
  font-size:      20px;
  font-weight:    700;
  margin-bottom:  20px;
}
.verdict-card.verdict-significant {
  border-color: var(--green);
  background:   var(--green-dim);
}
.verdict-card.verdict-significant .verdict-main { color: var(--green); }
.verdict-card.verdict-promising {
  border-color: var(--yellow);
  background:   var(--yellow-dim);
}
.verdict-card.verdict-promising .verdict-main { color: var(--yellow); }
.verdict-card.verdict-inconclusive {
  border-color: var(--red);
  background:   var(--red-dim);
}
.verdict-card.verdict-inconclusive .verdict-main { color: var(--red); }

.verdict-tests {
  display:   flex;
  flex-direction: column;
  gap:       10px;
  text-align: left;
  max-width: 560px;
  margin:    0 auto;
}
.verdict-test {
  display:     flex;
  align-items: flex-start;
  gap:         10px;
  padding:     10px 14px;
  border-radius: var(--radius-sm);
  background:  rgba(0,0,0,0.2);
  font-size:   13px;
}
.verdict-test.pass { border-left: 3px solid var(--green); }
.verdict-test.fail { border-left: 3px solid var(--red); }
.test-icon {
  font-size:  16px;
  flex-shrink: 0;
  line-height: 1.4;
}
.verdict-test.pass .test-icon { color: var(--green); }
.verdict-test.fail .test-icon { color: var(--red); }
.test-label { color: var(--text); line-height: 1.5; }

/* ── Research section cards ─────────────────────────────────────────────── */
.research-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
@media (max-width: 768px) {
  .research-grid { grid-template-columns: 1fr; }
}

.psr-bar-wrap {
  margin: 8px 0;
}
.psr-bar-label {
  display:       flex;
  justify-content: space-between;
  font-size:     11px;
  color:         var(--muted);
  margin-bottom: 4px;
}
.psr-bar-track {
  height:        8px;
  background:    var(--surface2);
  border-radius: 4px;
  overflow:      hidden;
}
.psr-bar-fill {
  height:        100%;
  border-radius: 4px;
  transition:    width .5s ease;
}
.psr-bar-fill.green  { background: var(--green); }
.psr-bar-fill.yellow { background: var(--yellow); }
.psr-bar-fill.red    { background: var(--red); }

/* ── Regime badge ───────────────────────────────────────────────────────── */
.regime-badge {
  font-family:    var(--font-mono);
  font-size:      11px;
  font-weight:    700;
  letter-spacing: 1px;
  padding:        3px 10px;
  border-radius:  20px;
  border:         1px solid var(--border);
  color:          var(--muted);
}
.regime-badge.TRENDING_UP    { border-color: var(--green);  color: var(--green);  background: var(--green-dim); }
.regime-badge.TRENDING_DOWN  { border-color: var(--red);    color: var(--red);    background: var(--red-dim); }
.regime-badge.RANGING        { border-color: var(--yellow); color: var(--yellow); background: var(--yellow-dim); }
.regime-badge.HIGH_VOLATILITY{ border-color: #e3913b;       color: #e3913b;       background: rgba(227,145,59,.12); }

/* ── Walk-forward banner ────────────────────────────────────────────────── */
.wf-banner {
  background:    var(--blue-dim);
  border:        1px solid var(--blue);
  border-radius: var(--radius-sm);
  padding:       10px 16px;
  font-size:     13px;
  color:         var(--blue);
  margin-bottom: 16px;
}

/* ── Collapsible / details ──────────────────────────────────────────────── */
.collapsible {
  border:        1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow:      hidden;
  margin-top:    16px;
}
.collapsible summary {
  padding:        10px 14px;
  cursor:         pointer;
  font-size:      12px;
  font-weight:    600;
  color:          var(--muted);
  letter-spacing: .5px;
  list-style:     none;
  display:        flex;
  align-items:    center;
  justify-content: space-between;
  user-select:    none;
}
.collapsible summary:hover { background: var(--surface2); color: var(--text); }
.collapsible summary::after {
  content: '›';
  font-size: 16px;
  transition: transform .2s;
}
.collapsible[open] summary::after { transform: rotate(90deg); }
.collapsible-body { padding: 14px; border-top: 1px solid var(--border); }

/* ── Horizontal progress bars (portfolio weights) ─────────────────────── */
.weight-row {
  display:       flex;
  align-items:   center;
  gap:           10px;
  margin-bottom: 8px;
}
.weight-ticker {
  font-family: var(--font-mono);
  font-size:   12px;
  font-weight: 700;
  color:       var(--text);
  width:       48px;
  flex-shrink: 0;
}
.weight-bar-track {
  flex:          1;
  height:        8px;
  background:    var(--surface2);
  border-radius: 4px;
  overflow:      hidden;
}
.weight-bar-fill {
  height:        100%;
  background:    var(--blue);
  border-radius: 4px;
  transition:    width .5s ease;
}
.weight-pct {
  font-family: var(--font-mono);
  font-size:   12px;
  color:       var(--blue);
  width:       44px;
  text-align:  right;
  flex-shrink: 0;
}

/* ── Correlation heatmap ────────────────────────────────────────────────── */
.corr-table {
  width:           100%;
  border-collapse: collapse;
  font-family:     var(--font-mono);
  font-size:       12px;
}
.corr-table th {
  padding:     8px 12px;
  text-align:  center;
  font-size:   11px;
  color:       var(--muted);
  font-weight: 700;
}
.corr-table td {
  padding:    7px 10px;
  text-align: center;
  border:     1px solid var(--border);
  font-weight: 600;
  font-size:  12px;
}

/* ── Portfolio optimizer stats ──────────────────────────────────────────── */
.opt-stat-row {
  display:       flex;
  justify-content: space-between;
  align-items:   center;
  padding:       8px 0;
  border-bottom: 1px solid var(--border);
  font-size:     13px;
}
.opt-stat-row:last-child { border-bottom: none; }
.opt-stat-label { color: var(--muted); font-size: 12px; }
.opt-stat-value { font-family: var(--font-mono); font-weight: 700; }

/* ── Controls card (dashboard) ──────────────────────────────────────────── */
#controls-card .form-group { margin-bottom: 12px; }

/* ── Market regime card metrics ─────────────────────────────────────────── */
.regime-metric-row {
  display:         flex;
  justify-content: space-between;
  align-items:     center;
  padding:         6px 0;
  border-bottom:   1px solid var(--border);
  font-size:       13px;
}
.regime-metric-row:last-child { border-bottom: none; }
.regime-metric-label { color: var(--muted); font-size: 12px; }
.regime-metric-value { font-family: var(--font-mono); font-weight: 700; }

/* ── Performance stats compact grid ────────────────────────────────────── */
.perf-grid {
  display:               grid;
  grid-template-columns: 1fr 1fr;
  gap:                   0;
}
.perf-item {
  padding:       10px 0;
  border-bottom: 1px solid var(--border);
}
.perf-item:nth-child(odd)  { padding-right: 12px; border-right: 1px solid var(--border); }
.perf-item:nth-child(even) { padding-left: 12px; }
.perf-item:nth-last-child(-n+2) { border-bottom: none; }
.perf-label {
  font-size:      10px;
  font-weight:    600;
  letter-spacing: 1px;
  color:          var(--muted);
  text-transform: uppercase;
  margin-bottom:  2px;
}
.perf-value {
  font-family: var(--font-mono);
  font-size:   16px;
  font-weight: 700;
}

/* ── Log lines ──────────────────────────────────────────────────────────── */
.log-line {
  padding:     4px 0;
  font-family: var(--font-mono);
  font-size:   12px;
  color:       var(--muted);
  line-height: 1.5;
}
.log-line:first-child { color: var(--text); }

/* ── Error banner ───────────────────────────────────────────────────────── */
.error-banner {
  background:    var(--red-dim);
  border:        1px solid var(--red);
  border-radius: var(--radius-sm);
  padding:       10px 16px;
  font-size:     13px;
  color:         var(--red);
  margin-bottom: 12px;
}

/* ── Info tooltips (plain-English explainers on jargon) ─────────────────── */
.info {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  width:           14px;
  height:          14px;
  margin-left:     5px;
  border:          1px solid var(--muted);
  border-radius:   50%;
  color:           var(--muted);
  font-family:     var(--font-ui);
  font-size:       9px;
  font-weight:     700;
  font-style:      normal;
  line-height:     1;
  letter-spacing:  normal;
  text-transform:  none;
  cursor:          help;
  vertical-align:  middle;
  position:        relative;
  flex-shrink:     0;
  transition:      border-color .15s, color .15s;
}
.info::before { content: 'i'; }
.info:hover,
.info:focus { border-color: var(--blue); color: var(--blue); outline: none; }

/* tooltip bubble */
.info::after {
  content:        attr(data-tip);
  position:       absolute;
  bottom:         calc(100% + 8px);
  left:           50%;
  transform:      translateX(-50%) translateY(4px);
  width:          max-content;
  max-width:      240px;
  padding:        8px 11px;
  background:     #0a0f0c;
  border:         1px solid var(--border);
  border-radius:  var(--radius-sm);
  color:          var(--text);
  font-family:    var(--font-ui);
  font-size:      11.5px;
  font-weight:    500;
  font-style:     normal;
  line-height:    1.45;
  letter-spacing: normal;
  text-transform: none;
  text-align:     left;
  white-space:    normal;
  box-shadow:     var(--shadow);
  opacity:        0;
  pointer-events: none;
  transition:     opacity .15s, transform .15s;
  z-index:        300;
}
.info:hover::after,
.info:focus::after { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── "Watch it trade" funnel banner ─────────────────────────────────────── */
.see-trade {
  display:       flex;
  align-items:   center;
  gap:           14px;
  padding:       12px 18px;
  margin-bottom: 20px;
  background:    linear-gradient(90deg, rgba(46,160,67,0.10), transparent 70%);
  border:        1px solid var(--green-line, var(--border));
  border-left:   3px solid var(--green);
  border-radius: var(--radius);
}
.st-icon {
  flex-shrink:     0;
  width:           30px;
  height:          30px;
  border-radius:   50%;
  background:      var(--green-dim);
  color:           var(--green);
  display:         flex;
  align-items:     center;
  justify-content: center;
  font-size:       12px;
}
.st-text { flex: 1; font-size: 13px; line-height: 1.5; color: var(--muted); }
.st-text strong { color: var(--text); }
.see-trade .btn { flex-shrink: 0; }
@media (max-width: 640px) {
  .see-trade { flex-direction: column; align-items: flex-start; }
}

/* ── Live activity narration card ───────────────────────────────────────── */
.live-activity .section-header {
  display:     flex;
  align-items: center;
  gap:         8px;
}
.la-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(63,185,80,0.6);
  animation: tr-pulse 2s infinite;
  flex-shrink: 0;
}
.bot-now {
  font-size:   15px;
  line-height: 1.6;
  color:       var(--text);
}
.bot-now strong { color: var(--green); font-weight: 700; }
.bot-now .bn-muted { color: var(--muted); }
.bot-last {
  margin-top:    12px;
  padding-top:   12px;
  border-top:    1px solid var(--border);
  font-family:   var(--font-mono);
  font-size:     12px;
  color:         var(--muted);
}
.bot-last strong { color: var(--text); font-weight: 600; }

/* ── Owner-only controls note ───────────────────────────────────────────── */
.control-note {
  margin-top:  10px;
  font-size:   11.5px;
  line-height: 1.5;
  color:       var(--muted);
  text-align:  center;
}
.control-note a { color: var(--green); }

/* ── Live track-record strip ────────────────────────────────────────────── */
.track-record {
  display:        flex;
  align-items:    center;
  flex-wrap:      wrap;
  gap:            14px;
  padding:        10px 16px;
  margin-bottom:  20px;
  background:     linear-gradient(90deg, rgba(46,160,67,0.10), rgba(46,160,67,0.02) 60%, transparent);
  border:         1px solid var(--border);
  border-left:    3px solid var(--green);
  border-radius:  var(--radius);
  font-family:    var(--font-mono);
  font-size:      12px;
}
.tr-live {
  display:        inline-flex;
  align-items:    center;
  gap:            7px;
  font-weight:    700;
  letter-spacing: 1.5px;
  color:          var(--green);
}
.tr-live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(63,185,80,0.6);
  animation: tr-pulse 2s infinite;
}
@keyframes tr-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(63,185,80,0.55); }
  70%  { box-shadow: 0 0 0 7px rgba(63,185,80,0); }
  100% { box-shadow: 0 0 0 0 rgba(63,185,80,0); }
}
.tr-item {
  color:        var(--text);
  font-weight:  600;
  padding-left: 14px;
  border-left:  1px solid var(--border);
}
.tr-note {
  margin-left: auto;
  color:       var(--muted);
  font-size:   11px;
  letter-spacing: .3px;
}
@media (max-width: 640px) {
  .tr-note { margin-left: 0; width: 100%; }
}

/* ── First-run onboarding banner ────────────────────────────────────────── */
.onboard {
  display:       flex;
  align-items:   center;
  gap:           14px;
  background:    var(--surface);
  border:        1px solid var(--border);
  border-left:   3px solid var(--blue);
  border-radius: var(--radius);
  padding:       14px 18px;
  margin-bottom: 20px;
}
.onboard-icon {
  width:           34px;
  height:          34px;
  flex-shrink:     0;
  border-radius:   8px;
  background:      var(--blue-dim);
  color:           var(--blue);
  display:         flex;
  align-items:     center;
  justify-content: center;
}
.onboard-icon svg { width: 18px; height: 18px; }
.onboard-text { flex: 1; font-size: 13px; color: var(--muted); line-height: 1.55; }
.onboard-text strong { color: var(--text); }
.onboard-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.onboard-close {
  border:      none;
  background:  transparent;
  color:       var(--muted);
  font-size:   20px;
  line-height: 1;
  cursor:      pointer;
  padding:     2px 6px;
  border-radius: var(--radius-sm);
  transition:  color .15s, background .15s;
}
.onboard-close:hover { color: var(--text); background: var(--surface2); }

@media (max-width: 640px) {
  .onboard { flex-direction: column; align-items: flex-start; gap: 12px; }
  .onboard-actions { width: 100%; justify-content: space-between; }
}

/* ── Plain-language result summary (backtest) ───────────────────────────── */
.bt-summary {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-left:   3px solid var(--blue);
  border-radius: var(--radius);
  padding:       16px 20px;
  margin-bottom: 20px;
  font-size:     14px;
  line-height:   1.65;
  color:         var(--text);
}
.bt-summary strong { color: var(--text); font-weight: 700; }
.bt-summary .summary-take { display: block; margin-top: 8px; color: var(--muted); font-size: 13px; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero-row          { gap: 12px; }
  .stats-grid        { grid-template-columns: 1fr 1fr; }
  .two-col           { grid-template-columns: 1fr; }
  .research-grid     { grid-template-columns: 1fr; }
  .perf-grid         { grid-template-columns: 1fr; }
  .perf-item         { padding-right: 0 !important; border-right: none !important; padding-left: 0 !important; }
  .sidebar-layout    { grid-template-columns: 1fr; }
  .form-panel        { position: static; max-height: none; }
  .page-wrap         { padding: 68px 12px 32px; }
  .navbar            { padding: 0 12px; }
  .verdict-tests     { max-width: 100%; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .hero-stat-value { font-size: 22px; }
}

/* ── Mobile refinements ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* 16px inputs stop iOS Safari from auto-zooming when a field is focused */
  input[type="text"],
  input[type="number"],
  input[type="date"],
  select, .input, .select { font-size: 16px; }
  .btn { padding: 10px 18px; }            /* comfortable tap target */
}

@media (max-width: 640px) {
  /* Top nav: compact, swipeable, never overflows the screen */
  .navbar         { padding: 0 12px; gap: 10px; }
  .nav-brand-sub,
  .nav-badge      { display: none; }
  .nav-brand-name { font-size: 15px; letter-spacing: .5px; }
  .nav-links {
    gap:             2px;
    flex-wrap:       nowrap;
    overflow-x:      auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-link { padding: 7px 11px; font-size: 12.5px; }

  /* Tighter spacing so content isn't cramped against the edges */
  .page-wrap      { padding: 62px 10px 28px; }
  .card           { padding: 15px; }
  .page-header h1 { font-size: 20px; }

  /* Hero metric tiles: two per row instead of one tall column */
  .hero-row        { gap: 10px; }
  .hero-stat       { min-width: calc(50% - 6px); padding: 15px 16px; }
  .hero-stat-value { font-size: 23px; }

  /* Data tables: smooth horizontal scroll with tighter cells */
  .table-wrap     { -webkit-overflow-scrolling: touch; }
  .data-table th,
  .data-table td  { padding: 8px 10px; }

  /* Status bar wraps cleanly without stray separators */
  .status-bar     { gap: 8px 10px; }
  .status-bar-sep { display: none; }

  /* Tab strips stay swipeable */
  .tab-list { -webkit-overflow-scrolling: touch; }
}
