/* Weather Oracle - Modern Dashboard Styling. Dark is the base; the
   :root[data-theme="light"] block below overrides the palette. */
:root {
  --bg-main: #070b12;
  --bg-card: rgba(14, 23, 38, 0.85);
  --bg-card-hover: rgba(20, 32, 53, 0.95);
  --bg-subtle: #111c2e;
  --border-focus: #06b6d4;

  --text-main: #f8fafc;
  --text-strong: #ffffff;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;

  /* theme-flipping hairlines (were raw rgba(255,255,255,x)) */
  --hair-faint: rgba(255, 255, 255, 0.03);
  --hair: rgba(255, 255, 255, 0.06);
  --hair-strong: rgba(255, 255, 255, 0.11);
  --border-color: var(--hair-strong);

  /* chrome surfaces */
  --navbar-bg: rgba(10, 16, 26, 0.85);
  --panel-bg: rgba(7, 11, 18, 0.55);

  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.25);
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.25);
  --accent-rose: #f43f5e;
  --accent-amber: #f59e0b;

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
  --transition-fast: 0.15s ease;
  --transition-smooth: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body.dark-theme {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(6, 182, 212, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(16, 185, 129, 0.04) 0%, transparent 40%);
  background-attachment: fixed;
}

.font-mono {
  font-family: var(--font-mono);
}

/* Glassmorphism Card Utility */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: var(--transition-smooth);
}

/* Header & Navbar */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 2rem;
  background: rgba(10, 16, 26, 0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pulse-indicator {
  width: 12px;
  height: 12px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-emerald);
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, var(--text-strong) 30%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent-cyan);
}

.header-tags {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.live-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.6rem;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-cyan);
  letter-spacing: 0.05em;
}

.live-tag .dot {
  width: 6px;
  height: 6px;
  background: var(--accent-cyan);
  border-radius: 50%;
}

.sim-start-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  color: #c4b5fd;
  letter-spacing: 0.02em;
}

.sim-start-tag strong {
  color: var(--text-strong);
}

.metric-sim-badge {
  margin-top: 0.6rem;
  padding-top: 0.55rem;
  border-top: 1px dashed var(--hair-strong);
  font-size: 0.74rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.metric-sim-badge strong {
  color: #e2e8f0;
  font-weight: 700;
}
.metric-sim-badge .msb-sep { opacity: 0.4; }

/* Nav Tabs */
.nav-tabs {
  display: flex;
  background: rgba(7, 11, 18, 0.6);
  padding: 0.25rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  gap: 0.2rem;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.1rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-fast);
}

.tab-btn:hover {
  color: var(--text-main);
  background: var(--hair);
}

.tab-btn.active {
  background: var(--accent-cyan);
  color: #041018;
  font-weight: 700;
  box-shadow: 0 0 14px var(--accent-cyan-glow);
}

.tab-badge {
  background: rgba(0, 0, 0, 0.25);
  color: inherit;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-family: var(--font-mono);
}

/* "System" tab badge = a live health pill, not a count */
.sys-badge { font-weight: 700; letter-spacing: 0.03em; }
.sys-badge.sys-ok   { color: var(--accent-emerald) !important; background: color-mix(in srgb, var(--accent-emerald) 16%, transparent) !important; }
.sys-badge.sys-warn { color: var(--accent-amber) !important;   background: color-mix(in srgb, var(--accent-amber) 16%, transparent) !important; }
.sys-badge.sys-bad  { color: var(--accent-rose) !important;    background: color-mix(in srgb, var(--accent-rose) 18%, transparent) !important; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  border: 1px solid transparent;
}

.btn-primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: var(--text-strong);
  box-shadow: 0 0 16px var(--accent-emerald-glow);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* View-only visitors: mutating controls are disabled client-side (the real
   gate is the server's X-API-Key check) but still need to *look* inert
   rather than just quietly no-op on click. */
.btn:disabled,
.btn-sell-pos:disabled,
.btn-reeval:disabled {
  opacity: 0.4;
  filter: grayscale(0.4);
  cursor: not-allowed;
  box-shadow: none;
  transform: none !important;
}
.btn-primary:disabled:hover,
.btn-outline:disabled:hover {
  filter: grayscale(0.4);
  transform: none;
}

.btn-outline {
  background: var(--hair-faint);
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--hair-strong);
  border-color: var(--text-muted);
}

.btn-danger {
  background: var(--accent-rose);
  color: var(--text-strong);
}

.btn-danger:hover {
  background: #e11d48;
}

.btn-icon {
  padding: 0.55rem;
  border-radius: var(--radius-md);
  background: var(--hair);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
}

.btn-icon:hover {
  color: var(--text-main);
  background: var(--hair-strong);
}

/* Main Container */
.main-container {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 2rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.metric-card {
  padding: 1.35rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-height: 190px;
}

/* label + short tag on one line; never let a long note break in here */
.metric-header,
.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.metric-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  white-space: nowrap;
}

.metric-sublabel,
.metric-note {
  font-size: 0.74rem;
  color: var(--text-subtle);
  margin-top: -0.2rem;
}

/* key/value lines under the headline number. ONE grid shared by every row
   ([label ....] [value] [delta]) so the dollar figures align in a column
   regardless of whether a row has a trailing delta. */
.metric-lines {
  display: grid;
  grid-template-columns: 1fr auto minmax(0, auto);
  row-gap: 0.4rem;
  margin-top: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.metric-line {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  align-items: baseline;
  column-gap: 0.55rem;
}
.metric-line > span:first-child { min-width: 0; }
.metric-line > strong,
.metric-line > b {
  grid-column: 2;
  justify-self: end;
  color: var(--text-main);
  font-weight: 700;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.metric-line > .metric-delta {
  grid-column: 3;
  justify-self: end;
  font-size: 0.74rem;
  font-weight: 700;
  font-family: var(--font-mono);
  text-align: right;
}
/* the "= Live equity" total line — set it off from the addends above */
.metric-line-total {
  margin-top: 0.15rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--hair-strong);
}
.metric-line-total > span:first-child { color: var(--text-main); font-weight: 600; }
.metric-line-total > b { color: var(--text-strong); }

/* Unrealized P&L card — per-settlement-date breakdown */
.metric-lines-by-date {
  margin-top: 0.5rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--hair-strong);
}
.metric-lines-label {
  grid-column: 1 / -1;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint, var(--text-muted));
  margin-bottom: 0.15rem;
}

.metric-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
}

.metric-tag.info {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
}

.metric-value {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-strong);
}

.metric-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.metric-footer strong {
  color: var(--text-main);
}

.positive {
  color: var(--accent-emerald) !important;
}

.negative {
  color: var(--accent-rose) !important;
}

.metric-progress-bar {
  width: 100%;
  height: 5px;
  background: var(--hair);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-emerald));
  transition: width 0.4s ease;
}

/* Tab Content */
.tab-content {
  display: none;
  flex-direction: column;
  gap: 1.25rem;
}

.tab-content.active {
  display: flex;
}

.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-strong);
}

.subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.last-updated {
  font-size: 0.8rem;
  color: var(--text-subtle);
  font-family: var(--font-mono);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.custom-select {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(6, 182, 212, 0.4);
  color: var(--text-strong);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.12);
  transition: var(--transition-fast);
}

.custom-select:hover,
.custom-select:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.3);
}

/* Edge Matrix Segmented Filter Pills */
.edge-filter-pills {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--panel-bg);
  padding: 0.2rem;
  border-radius: 11px;
  border: 1px solid var(--hair);
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.filter-pill:hover {
  color: var(--text-strong);
  background: var(--hair);
}

.filter-pill.active {
  background: rgba(6, 182, 212, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(6, 182, 212, 0.35);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.18);
}

.filter-pill .pill-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
  background: var(--hair-strong);
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 700;
}

.filter-pill.active .pill-badge {
  background: rgba(6, 182, 212, 0.3);
  color: var(--text-strong);
}

/* Edge Radar */
.edge-radar-subtabs {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--panel-bg);
  padding: 0.2rem;
  border-radius: 11px;
  border: 1px solid var(--hair);
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.subtab-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.subtab-btn:hover {
  color: var(--text-strong);
  background: var(--hair);
}

.subtab-btn.active {
  background: rgba(6, 182, 212, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(6, 182, 212, 0.35);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.18);
}

.edge-radar-description {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  max-width: 68ch;
}

.edge-radar-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 0.9rem 1.2rem;
  margin-bottom: 1rem;
}

.edge-radar-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 72px;
}

.edge-radar-stat span {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-subtle);
}

.edge-radar-stat b {
  font-size: 1.15rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-strong);
}

.edge-radar-reasons {
  padding: 0.85rem 1.2rem;
  margin-bottom: 1rem;
}

.edge-radar-reasons .reasons-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-strong);
  margin-bottom: 0.55rem;
}

.edge-radar-reasons .reasons-title span {
  font-weight: 500;
  color: var(--text-subtle);
}

.reasons-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.reason-chip,
.reason-stat {
  display: inline-block;
  padding: 0.18rem 0.6rem;
  border-radius: 10px;
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-muted);
  background: var(--hair);
  border: 1px solid var(--hair-strong);
  cursor: default;
}

.reason-stat b {
  color: var(--text-strong);
  font-family: var(--font-mono);
  margin-left: 0.15rem;
}

.reason-chip.reason-bought,
.reason-chip.reason-executed,
.reason-stat.reason-executed {
  color: var(--accent-emerald);
  border-color: color-mix(in srgb, var(--accent-emerald) 35%, transparent);
  background: color-mix(in srgb, var(--accent-emerald) 12%, transparent);
}

/* exposure / cash constraints (we were out of room) read amber; rules we set on
   purpose (price floor, hedge/cluster guards, freeze) read cyan; data problems
   (thin book / liquidity) read rose */
.reason-portfolio_exposure_cap, .reason-city_day_cap, .reason-insufficient_cash,
.reason-no_capital, .reason-stake_too_small {
  color: var(--accent-amber);
  border-color: color-mix(in srgb, var(--accent-amber) 35%, transparent);
  background: color-mix(in srgb, var(--accent-amber) 12%, transparent);
}

.reason-below_price_floor, .reason-adjacent_no_cluster, .reason-no_cluster_cap,
.reason-opposite_side_held, .reason-one_yes_per_day, .reason-trading_frozen,
.reason-forecast_too_close, .reason-already_held, .reason-deduped {
  color: #38bdf8;
  border-color: rgba(6, 182, 212, 0.35);
  background: rgba(6, 182, 212, 0.12);
}

.reason-thin_liquidity, .reason-book_too_thin {
  color: var(--accent-rose);
  border-color: color-mix(in srgb, var(--accent-rose) 35%, transparent);
  background: color-mix(in srgb, var(--accent-rose) 12%, transparent);
}

.edge-radar-stat b.positive { color: var(--accent-emerald); }
.edge-radar-stat b.negative { color: var(--accent-rose); }

/* Opportunities Grid / Cards */
.opportunities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 1.25rem;
}

.opp-card {
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.opp-card:hover {
  border-color: rgba(6, 182, 212, 0.4);
  transform: translateY(-2px);
}

.opp-card.in-portfolio {
  border: 1.5px solid rgba(16, 185, 129, 0.6);
  border-left: 5px solid var(--accent-emerald);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.15);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.04) 0%, rgba(15, 23, 42, 0.6) 100%);
}

.opp-card.qualified {
  border-left: 4px solid var(--accent-emerald);
}

.opp-card.pass {
  opacity: 0.7;
  border-left: 4px solid var(--text-subtle);
  background: rgba(15, 23, 42, 0.35);
}

.opp-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.city-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  background: var(--hair);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.active-pos-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.55);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #34d399;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.25);
  letter-spacing: 0.02em;
}

.platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-mono);
  text-decoration: none;
  transition: var(--transition-fast);
  cursor: pointer;
  vertical-align: middle;
  line-height: 1;
}

.platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: var(--transition-fast);
  cursor: pointer;
  vertical-align: middle;
  line-height: 1;
}

.platform-badge.polymarket {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.22) 0%, rgba(59, 130, 246, 0.18) 100%);
  border: 1px solid rgba(139, 92, 246, 0.55);
  color: #c4b5fd;
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.2);
}

.platform-badge.polymarket:hover {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.35) 0%, rgba(59, 130, 246, 0.3) 100%);
  border-color: #a78bfa;
  color: var(--text-strong);
  transform: translateY(-1px);
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.45);
}

.platform-badge.kalshi {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(6, 182, 212, 0.18) 100%);
  border: 1px solid rgba(16, 185, 129, 0.55);
  color: #34d399;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

.platform-badge.kalshi:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.35) 0%, rgba(6, 182, 212, 0.3) 100%);
  border-color: #10b981;
  color: var(--text-strong);
  transform: translateY(-1px);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.45);
}

.platform-badge .kalshi-logo-img {
  height: 13px;
  width: auto;
  object-fit: contain;
  display: inline-block;
  vertical-align: middle;
  border-radius: 2px;
}

.metric-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.metric-type-badge.high {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

.metric-type-badge.low {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

.local-clock-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 600;
  line-height: 1;
}

.local-clock-badge.locked {
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #94a3b8;
}

.local-clock-badge.active,
.local-clock-badge.heating {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fbbf24;
}

.local-clock-badge.future {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
}

.local-clock-badge .phase-pill {
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.25);
}

.opp-card.poly-card {
  border-top: 3px solid #8b5cf6;
}

.opp-card.kalshi-card {
  border-top: 3px solid #10b981;
}

.contract-title-cell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.exit-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.exit-badge.expiry {
  background: rgba(139, 92, 246, 0.12);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.25);
}

.exit-badge.tp {
  background: rgba(16, 185, 129, 0.12);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.exit-badge.sl {
  background: rgba(244, 63, 94, 0.12);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.25);
}

.exit-badge.manual {
  background: rgba(56, 189, 248, 0.12);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

/* Live Win Probability & Weather Gauge in Positions Table */
.live-win-prob-cell {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 180px;
}

.prob-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.win-prob-val {
  font-size: 0.8rem;
  font-weight: 700;
}

.win-prob-val.prob-safe {
  color: var(--accent-emerald);
}

.win-prob-val.prob-moderate {
  color: #f59e0b;
}

.win-prob-val.prob-danger {
  color: var(--accent-rose);
}

.risk-tag {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.risk-tag.prob-safe {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.risk-tag.prob-moderate {
  background: rgba(245, 158, 11, 0.15);
  color: #fde047;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.risk-tag.prob-danger {
  background: rgba(244, 63, 94, 0.15);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.mini-prob-track {
  width: 100%;
  height: 5px;
  background: var(--hair-strong);
  border-radius: 3px;
  overflow: hidden;
}

.mini-prob-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.live-fc-status {
  font-size: 0.68rem;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.target-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.opp-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-strong);
}

/* Probability Comparison Bars */
.prob-bars-container {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--hair-faint);
}

.prob-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.prob-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.prob-track {
  width: 100%;
  height: 7px;
  background: var(--hair);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.market-fill {
  background: #64748b;
  height: 100%;
  border-radius: var(--radius-full);
}

.model-fill {
  background: linear-gradient(90deg, #06b6d4, #10b981);
  height: 100%;
  border-radius: var(--radius-full);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

/* Edge & Recommendation Section */
.opp-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.6rem;
  border-top: 1px solid var(--hair);
}

.edge-badge {
  font-size: 0.82rem;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-md);
}

.edge-badge.buy-yes {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--accent-emerald);
  color: var(--accent-emerald);
}

.edge-badge.buy-no {
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
}

.edge-badge.pass {
  background: var(--hair);
  border: 1px solid var(--border-color);
  color: var(--text-subtle);
}

.opp-rationale {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.forecast-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text-subtle);
  font-family: var(--font-mono);
}

/* Tables */
.table-container {
  overflow-x: auto;
  padding: 0.5rem;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.custom-table th {
  padding: 0.85rem 1rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.custom-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: var(--transition-fast);
}

.custom-table th.sortable:hover {
  color: var(--text-main);
  background: var(--hair);
}

.sort-icon {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.72rem;
  opacity: 0.5;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.custom-table th.sorted-asc .sort-icon,
.custom-table th.sorted-desc .sort-icon {
  opacity: 1;
  color: var(--accent-cyan);
}

.custom-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--hair);
  color: var(--text-main);
  vertical-align: middle;
}

.btn-sell-pos {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.38rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: var(--font-mono);
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.02em;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
}

/* Green = In Profit */
.btn-sell-pos.profit {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.22), rgba(5, 150, 105, 0.12));
  border: 1px solid rgba(16, 185, 129, 0.55);
  color: #34d399;
}

.btn-sell-pos.profit:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.38), rgba(5, 150, 105, 0.24));
  border-color: #10b981;
  color: #6ee7b7;
  transform: translateY(-2px);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.45);
}

/* Yellow = Neutral (Exact Entry Price) */
.btn-sell-pos.neutral {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.1));
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #fbbf24;
}

.btn-sell-pos.neutral:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.36), rgba(217, 119, 6, 0.22));
  border-color: #f59e0b;
  color: #fde68a;
  transform: translateY(-2px);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.45);
}

/* Red = In Loss (Below Entry Price) */
.btn-sell-pos.loss {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.22), rgba(190, 18, 60, 0.12));
  border: 1px solid rgba(244, 63, 94, 0.55);
  color: #fb7185;
}

.btn-sell-pos.loss:hover {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.38), rgba(190, 18, 60, 0.24));
  border-color: #f43f5e;
  color: #fecdd3;
  transform: translateY(-2px);
  box-shadow: 0 0 16px rgba(244, 63, 94, 0.45);
}

.custom-table tbody tr:hover {
  background: var(--hair-faint);
}

.side-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.75rem;
  font-family: var(--font-mono);
}

.side-badge.yes {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.side-badge.no {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.status-badge {
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.72rem;
}

.status-badge.win {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border: 1px solid var(--accent-emerald);
}

.status-badge.loss {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  border: 1px solid var(--accent-rose);
}

.status-badge.flat {
  background: var(--hair);
  color: var(--text-muted);
  border: 1px solid var(--hair-strong);
}

/* Analytics */
.analytics-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
}

.chart-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 400px;
}

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

.chart-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-strong);
}

.range-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  background: var(--hair);
  border: 1px solid var(--hair-strong);
}

.range-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: 600 0.72rem/1 var(--font-mono, 'JetBrains Mono', monospace);
  letter-spacing: 0.03em;
  padding: 0.32rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.range-tab:hover { color: var(--text-strong); }

.range-tab.is-active {
  background: var(--accent, #6366f1);
  color: #fff;
}

.chart-body {
  position: relative;
  flex: 1;
  width: 100%;
  height: 320px;
}

/* Progress Review */
.progress-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.progress-weeks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.progress-week-card {
  padding: 1.1rem 1.25rem;
  position: relative;
}

.progress-week-card.is-current {
  border: 1px solid rgba(6, 182, 212, 0.4);
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.12);
}

.progress-week-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.progress-week-label b {
  font-size: 0.95rem;
  color: var(--text-strong);
}

.progress-week-live-pill {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  background: rgba(6, 182, 212, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(6, 182, 212, 0.35);
}

.progress-week-date {
  font-size: 0.75rem;
  color: var(--text-subtle);
  margin-bottom: 0.75rem;
}

.progress-week-pnl {
  font-size: 1.4rem;
  font-weight: 700;
  font-family: var(--font-mono);
  margin-bottom: 0.5rem;
}

.progress-week-pnl.positive { color: var(--accent-emerald); }
.progress-week-pnl.negative { color: var(--accent-rose); }

.progress-week-stats {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.progress-week-stats span b { color: var(--text-strong); font-family: var(--font-mono); }

.stats-summary-box {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--hair);
  font-size: 0.85rem;
}

.stat-item .label {
  color: var(--text-muted);
}

.stat-item .val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-strong);
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(3, 7, 18, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 9999;
  align-items: flex-start;
  justify-content: center;
  padding: 2.5rem 1rem;
  overflow-y: auto;
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 620px;
  background: var(--bg-card);
  border: 1px solid var(--hair-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75), 0 0 35px rgba(6, 182, 212, 0.12);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin: 0 auto;
  max-height: calc(100vh - 5rem);
  animation: modal-fade-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-fade-in {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--hair-strong);
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-strong);
  letter-spacing: -0.01em;
}

.modal-close {
  background: var(--hair);
  border: 1px solid var(--hair-strong);
  border-radius: 6px;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition-fast);
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  overflow-y: auto;
  padding-right: 0.5rem;
  flex: 1;
}

/* Smooth custom scrollbar for modal content */
.modal-body::-webkit-scrollbar {
  width: 6px;
}
.modal-body::-webkit-scrollbar-track {
  background: var(--hair-faint);
  border-radius: 3px;
}
.modal-body::-webkit-scrollbar-thumb {
  background: var(--hair-strong);
  border-radius: 3px;
}
.modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  padding: 0.5rem 0;
}

.setting-info label {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-strong);
  display: block;
}

.setting-info p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  line-height: 1.4;
}
.setting-info p a {
  color: var(--accent-cyan);
  text-decoration: none;
}
.setting-info p a:hover {
  text-decoration: underline;
}

.setting-control {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-shrink: 0;
}

/* A setting whose description is a real paragraph (not a one-liner) reads
   better stacked full-width than squeezed into the usual left column. */
.setting-item--stacked {
  flex-direction: column;
  align-items: stretch;
  gap: 0.6rem;
}
.setting-item--stacked .setting-control {
  width: 100%;
}
.setting-item--stacked .setting-control input {
  flex: 1;
  min-width: 0;
}

.range-val {
  min-width: 55px;
  text-align: right;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--hair-strong);
  flex-shrink: 0;
}

.setting-separator {
  padding-top: 1rem;
  margin-top: 0.5rem;
  border-top: 1px dashed var(--hair-strong);
  font-size: 0.85rem;
  font-weight: 700;
  color: #c4b5fd;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* TP/SL sliders are inert until the master switch above is on. */
#tpsl-sliders.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}
#tpsl-sliders.is-disabled input[type="range"] {
  cursor: not-allowed;
}

.setting-item.form-vertical {
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
  background: rgba(139, 92, 246, 0.05);
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: var(--radius-md);
  padding: 0.85rem;
}

.whatsapp-setup-tip {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.72rem;
  line-height: 1.4;
  color: #cbd5e1;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--hair-strong);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.65rem;
}

.whatsapp-setup-tip code {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-family: var(--font-mono);
}

.form-row-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 0.75rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-field label {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-field .custom-input {
  font-size: 0.88rem;
  padding: 0.45rem 0.75rem;
}

.test-alert-action {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.test-status-msg {
  font-size: 0.75rem;
  font-weight: 600;
}

.test-status-msg.success {
  color: var(--accent-emerald);
}

.test-status-msg.error {
  color: var(--accent-rose);
}

.custom-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 1rem;
  color: var(--text-strong);
  font-size: 1.1rem;
  outline: none;
}

.custom-input:focus {
  border-color: var(--border-focus);
}

/* Switch Toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #334155;
  transition: .3s;
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent-emerald);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* Toast System */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  /* Above .modal-overlay (9999) — toasts fire from inside modals (Save
     Settings, Unlock, Sell, Reset) and must stay readable over the blur. */
  z-index: 10050;
}

.toast {
  padding: 0.85rem 1.25rem;
  background: #101826;
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 4px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: slide-toast 0.3s ease;
}
.toast strong, .toast b { color: #fff; }

.toast.success { border-left-color: var(--accent-emerald); }
.toast.error { border-left-color: var(--accent-rose); }

@keyframes slide-toast {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(6, 182, 212, 0.2);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

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

/* ==========================================================================
   RESPONSIVE DESIGN & MOBILE OPTIMIZATIONS
   ========================================================================== */

/* Responsive View Mode Toggles (Desktop vs Mobile) */
.desktop-only-view {
  display: block;
}

.mobile-only-view {
  display: none !important;
}

.mobile-sort-controls {
  display: none;
}

/* Mobile Position & Trade Cards Container */
.mobile-cards-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  width: 100%;
}

/* Mobile Active Position Card */
.mobile-pos-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: var(--shadow-card);
  transition: var(--transition-smooth);
}

.mobile-pos-card.in-profit {
  border-left: 4px solid var(--accent-emerald);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.04) 0%, rgba(14, 23, 38, 0.9) 100%);
}

.mobile-pos-card.in-loss {
  border-left: 4px solid var(--accent-rose);
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.04) 0%, rgba(14, 23, 38, 0.9) 100%);
}

.mobile-pos-card.in-neutral {
  border-left: 4px solid var(--accent-amber);
}

.mobile-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.mobile-card-tags {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.mobile-card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.mobile-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-strong);
}

.mobile-pnl-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--hair);
}

.mobile-pnl-banner.positive {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
}

.mobile-pnl-banner.negative {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.3);
}

.mobile-pnl-banner.neutral { background: var(--hair); border-color: var(--hair-strong); }
.mobile-pnl-banner.neutral .pnl-val,
.pnl-val.neutral { color: var(--text-muted); }
td.font-mono.neutral, td.font-mono.neutral strong { color: var(--text-muted); }

.mobile-pnl-banner .pnl-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.mobile-pnl-banner .pnl-val {
  font-size: 1.05rem;
  font-weight: 800;
  font-family: var(--font-mono);
}

.mobile-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.8rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--hair-faint);
}

.mobile-metric-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.mobile-metric-item .lbl {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mobile-metric-item .val {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-strong);
  font-family: var(--font-mono);
}

.mobile-metric-item .sub {
  font-size: 0.7rem;
  color: var(--text-subtle);
  font-family: var(--font-mono);
}

.mobile-live-fc-section {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.75rem;
  background: rgba(6, 182, 212, 0.05);
  border: 1px solid rgba(6, 182, 212, 0.18);
  border-radius: var(--radius-md);
}

.btn-sell-pos.mobile-btn-sell {
  width: 100%;
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  border-radius: var(--radius-md);
  justify-content: center;
}

/* Mobile Trade Settlement Card */
.mobile-trade-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  box-shadow: var(--shadow-card);
  transition: var(--transition-smooth);
}

.mobile-trade-card.win-card {
  border-left: 4px solid var(--accent-emerald);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.04) 0%, rgba(14, 23, 38, 0.9) 100%);
}

.mobile-trade-card.loss-card {
  border-left: 4px solid var(--accent-rose);
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.04) 0%, rgba(14, 23, 38, 0.9) 100%);
}

.mobile-observed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  border: 1px solid var(--hair);
}

.mobile-trade-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-subtle);
  padding-top: 0.4rem;
  border-top: 1px solid var(--hair);
}

/* Tablet & Smaller Laptops (max-width: 1024px) */
@media (max-width: 1024px) {
  .navbar {
    padding: 0.8rem 1.25rem;
  }
  .main-container {
    padding: 1.25rem;
  }
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  .opportunities-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
  }
  .analytics-grid {
    grid-template-columns: 1fr;
  }
  .progress-charts-grid {
    grid-template-columns: 1fr;
  }
}

/* Mobile Devices (max-width: 768px) */
@media (max-width: 768px) {
  .desktop-only-view {
    display: none !important;
  }

  .mobile-only-view {
    display: flex !important;
  }

  .mobile-sort-controls {
    display: flex;
    width: 100%;
  }

  .mobile-sort-controls .filter-group {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
  }

  .navbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
  }

  .nav-left {
    justify-content: space-between;
    width: 100%;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .header-tags {
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .nav-center {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .nav-center::-webkit-scrollbar {
    display: none;
  }

  .nav-tabs {
    display: inline-flex;
    width: max-content;
    padding: 0.2rem;
    gap: 0.2rem;
  }

  .tab-btn {
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .nav-right {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0.5rem;
  }

  .nav-right .btn-primary,
  .nav-right .btn-outline {
    flex: 1;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.78rem;
  }

  .main-container {
    padding: 0.85rem;
    gap: 1.25rem;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .metric-card {
    padding: 1rem;
    gap: 0.4rem;
  }

  .metric-value {
    font-size: 1.35rem;
  }

  .metric-footer {
    font-size: 0.72rem;
    flex-wrap: wrap;
    gap: 0.3rem;
  }

  .section-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .toolbar-left {
    width: 100%;
  }

  .toolbar-right {
    width: 100%;
    flex-direction: column;
    gap: 0.5rem;
  }

  .edge-filter-pills {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .edge-filter-pills::-webkit-scrollbar {
    display: none;
  }

  .filter-pill {
    white-space: nowrap;
  }

  .filter-group {
    width: 100%;
    justify-content: space-between;
  }

  .custom-select {
    flex: 1;
    width: auto;
  }

  .opportunities-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .opp-card {
    padding: 1.1rem;
    gap: 0.85rem;
  }

  .opp-title {
    font-size: 0.88rem;
  }

  .opp-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }

  .edge-badge {
    text-align: center;
    width: 100%;
  }

  /* Modals */
  .modal-card {
    max-width: 94vw;
    max-height: 90vh;
    overflow-y: auto;
    margin: 0.5rem;
    padding: 1.25rem;
  }

  .setting-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .setting-control {
    width: 100%;
    justify-content: space-between;
  }

  .form-row-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }
}

/* Small Phones (max-width: 480px) */
@media (max-width: 480px) {
  .brand-title {
    font-size: 1rem;
  }

  .brand-subtitle {
    font-size: 0.58rem;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .metric-value {
    font-size: 1.5rem;
  }

  .tab-btn {
    padding: 0.4rem 0.7rem;
    font-size: 0.75rem;
  }

  .mobile-metrics-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   v2.6 — real-time layer + calmer palette
   Appended overrides: keep the layout, dial back neon glows / saturated fills.
   ========================================================================== */

/* ---- LIVE feed status badge ---- */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.22rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  font-family: var(--font-mono);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  background: var(--hair-faint);
  white-space: nowrap;
}
.live-badge .lb-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; flex: none;
}
.live-badge.live   { color: #34d399; border-color: rgba(16, 185, 129, 0.35); }
.live-badge.live .lb-dot { animation: lb-pulse 1.6s ease-in-out infinite; }
.live-badge.rest   { color: #38bdf8; border-color: rgba(56, 189, 248, 0.3); }
.live-badge.stale  { color: var(--accent-amber); border-color: rgba(245, 158, 11, 0.3); }
.live-badge.off    { color: var(--text-subtle); }
@keyframes lb-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

.live-flash { animation: live-flash 0.9s ease-out; }
@keyframes live-flash {
  0%   { background-color: rgba(56, 189, 248, 0.22); }
  100% { background-color: transparent; }
}

/* ---- calmer cards: kill glows, flatten fills, thin the state accents ---- */
.opp-card,
.opp-card:hover,
.metric-card,
.glass-card {
  box-shadow: var(--shadow-card);
}
.opp-card.in-portfolio {
  border: 1px solid var(--border-color);
  border-left: 3px solid rgba(16, 185, 129, 0.5);
  box-shadow: var(--shadow-card);
  background: var(--bg-card);
}
.opp-card.qualified {
  border-left: 3px solid rgba(16, 185, 129, 0.4);
}
.opp-card.pass { border-left: 3px solid var(--border-color); }
.opp-card:hover { border-color: var(--hair-strong); transform: none; }

.opp-card.poly-card,
.opp-card.kalshi-card { border-top: none; }

/* platform + status badges: flat, no glow */
.platform-badge.polymarket {
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.28);
  color: #b9a6f0;
  box-shadow: none;
}
.platform-badge.kalshi {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.28);
  color: #34d399;
  box-shadow: none;
}
.platform-badge.polymarket:hover,
.platform-badge.kalshi:hover {
  box-shadow: none;
  transform: none;
  color: var(--text-main);
}
.active-pos-badge {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  box-shadow: none;
  color: #34d399;
}

/* edge badge: quieter */
.edge-badge {
  box-shadow: none !important;
  font-weight: 700;
}
.edge-badge.buy-yes,
.edge-badge.buy-no {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
}

/* de-glow the generic neon accents on chips/pills */
.city-badge,
.metric-type-badge,
.local-clock-badge,
.tab-badge,
.risk-tag,
.side-badge {
  box-shadow: none !important;
}

/* ==========================================================================
   v2.10 — deeper calm-down: buttons, tabs, chips. Keep identity as text
   accents; drop fills + glows. Minimalistic / modern, same layout.
   ========================================================================== */

/* primary action button — muted, no glow */
.btn-primary {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
  box-shadow: none;
}
.btn-primary:hover {
  background: rgba(16, 185, 129, 0.2);
  filter: none;
  transform: none;
  color: #a7f3d0;
}

/* active tab — subtle tint, not a bright slab */
.tab-btn.active {
  background: var(--hair);
  color: var(--text-main);
  box-shadow: none;
  font-weight: 700;
}
.tab-btn.active .tab-badge { color: var(--accent-cyan); }

/* filter pills — flat */
.filter-pill.active {
  background: var(--hair);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  box-shadow: none;
}
.filter-pill.active .pill-badge { background: var(--hair-strong); color: var(--text-main); }

/* card chips — neutral by default; colour only carries real meaning */
.city-badge { color: var(--text-muted); background: var(--hair); }
.metric-type-badge.high,
.metric-type-badge.low {
  background: var(--hair);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}
.local-clock-badge {
  background: var(--hair) !important;
  border: 1px solid var(--border-color);
  color: var(--text-muted) !important;
}
.local-clock-badge .phase-pill { color: var(--accent-amber); background: transparent; }
.target-date { color: var(--text-subtle); }

/* model-odds text stays cyan/emerald (that's the signal), bars muted */
.prob-track { background: var(--hair); }
.market-fill { background: var(--text-subtle); }
.model-fill  { background: rgba(16, 185, 129, 0.55); }

/* "LIVE ENSEMBLES"-style header dot / misc pulse dots — no glow */
.pulse-indicator, .live-tag .dot { box-shadow: none !important; }

/* ==========================================================================
   v2.13 — "where do I stand" panel on held-position opportunity cards
   ========================================================================== */
.opp-position-panel {
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--text-subtle);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  background: var(--hair-faint);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-family: var(--font-mono);
}
.opp-position-panel.pos-up   { border-left-color: var(--accent-emerald); }
.opp-position-panel.pos-down { border-left-color: var(--accent-rose); }
.opp-pos-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}
.opp-pos-label {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: var(--text-subtle);
  font-weight: 700;
}
.opp-pos-qty { font-size: 0.8rem; font-weight: 700; color: var(--text-main); }
.opp-pos-prices { font-size: 0.82rem; color: var(--text-muted); }
.opp-pos-prices b { color: var(--text-main); font-weight: 700; }
.opp-pos-arrow { color: var(--text-subtle); margin: 0 0.15rem; }
.opp-pos-pnl { font-size: 0.95rem; font-weight: 800; white-space: nowrap; }
.opp-position-panel.pos-up   .opp-pos-pnl { color: #34d399; }
.opp-position-panel.pos-down .opp-pos-pnl { color: #fb7185; }
.opp-position-panel.pos-flat .opp-pos-pnl { color: var(--text-muted); }

/* ==========================================================================
   v2.14 — mobile position card: entry -> mark inline, shares on next line
   ========================================================================== */
.mobile-pos-money {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--hair);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.mobile-pos-money .mpm-row {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--text-muted);
}
.mobile-pos-money .mpm-row b { color: var(--text-strong); font-weight: 700; }
.mobile-pos-money .mpm-arrow { color: var(--text-subtle); }
.mobile-pos-money .mpm-sub {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-subtle);
}

/* ==========================================================================
   v2.16 — simplified opportunity card
   ========================================================================== */
.opp-head-tags {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.opp-card .opp-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}
.opp-phase {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: -0.25rem;
}
.opp-obs { color: var(--text-subtle); }

/* Market vs Model — the core comparison */
.mm-compare {
  background: var(--hair-faint);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.mm-row {
  display: grid;
  grid-template-columns: 3.4rem 1fr auto;
  align-items: center;
  gap: 0.6rem;
}
.mm-lbl {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.mm-bar {
  height: 7px;
  border-radius: 4px;
  background: var(--hair);
  overflow: hidden;
}
.mm-fill { height: 100%; border-radius: 4px; transition: width 0.4s ease; }
.mm-fill.mkt { background: var(--text-subtle); }
.mm-fill.mod { background: var(--accent-cyan); }
.mm-val {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
}
.mm-val.mm-model { color: var(--accent-cyan); }
.mm-note {
  font-size: 0.68rem;
  color: var(--text-subtle);
  text-align: right;
}
.mm-note b { color: var(--text-muted); }

/* Shadow-model comparison strip */
.mm-shadow-strip {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding-top: 0.15rem;
}
.mm-shadow-strip .mm-lbl { color: #34d399; flex: none; }
.mm-chips { display: flex; flex-wrap: wrap; gap: 0.3rem 0.4rem; }
.mm-chip {
  font: 600 0.7rem var(--font-mono, 'JetBrains Mono', monospace);
  color: var(--text-muted);
  background: color-mix(in srgb, #34d399 8%, transparent);
  border: 1px solid color-mix(in srgb, #34d399 22%, transparent);
  border-radius: 5px;
  padding: 0.08rem 0.4rem;
  white-space: nowrap;
}
.mm-chip b { color: #34d399; font-weight: 700; }
.mm-chip-primary {
  background: color-mix(in srgb, #34d399 16%, transparent);
  border-color: color-mix(in srgb, #34d399 45%, transparent);
  color: var(--text-main);
}
.oc-src-line {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.68rem;
  color: var(--text-subtle);
}

.opp-facts {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.opp-facts b { color: var(--text-main); }

.opp-sizing {
  font-size: 0.72rem;
  color: var(--text-subtle);
  font-family: var(--font-mono);
  text-align: right;
}
.opp-sizing b { color: var(--text-muted); }

/* held-position "why" line */
.opp-pos-why {
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--text-muted);
  font-family: var(--font-sans);
  border-top: 1px dashed var(--border-color);
  padding-top: 0.4rem;
  margin-top: 0.15rem;
}

/* ==========================================================================
   v3 — opportunity-card modernization + palette calm-down
   Goal: one restrained accent, green reserved for real P&L, less boxing,
   city+metric+pick on one headline, brand wordmarks, corner "held" tag.
   ========================================================================== */
:root {
  /* single cool accent for anything interactive / "we see an edge" */
  --accent: #7c8cf8;
  --accent-soft: rgba(124, 140, 248, 0.14);
  --accent-line: rgba(124, 140, 248, 0.30);
  /* semantic P&L — the ONLY place green/red should appear */
  --pnl-up: #34d399;
  --pnl-down: #fb7185;
  /* card surface a touch flatter + calmer */
  --oc-surface: rgba(17, 24, 39, 0.72);
  --oc-hair: var(--hair);
  --pick-yes: #8ea2ff;
  --pick-no: #f0b45f;
}

/* softer page wash — drop the cyan/emerald corner glows */
body.dark-theme {
  background-image:
    radial-gradient(circle at 12% 0%, rgba(124, 140, 248, 0.05) 0%, transparent 42%),
    radial-gradient(circle at 100% 100%, rgba(124, 140, 248, 0.035) 0%, transparent 45%);
}

/* ---- shared control recolor: green -> neutral/accent ---- */
.btn-primary {
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: #c7cffb;
}
.btn-primary:hover {
  background: rgba(124, 140, 248, 0.24);
  color: var(--text-strong);
}
.tab-btn.active .tab-badge,
.filter-pill.active .pill-badge { color: var(--accent); }
.prob-track { background: var(--hair); }
.market-fill { background: var(--text-subtle); }
.model-fill  { background: var(--accent); }

/* metric-card badges: neutral by default, green/red only for real P&L sign */
.metric-tag {
  background: var(--hair);
  color: var(--text-muted);
}
.metric-tag.positive { background: rgba(52, 211, 153, 0.12); color: var(--pnl-up) !important; }
.metric-tag.negative { background: rgba(251, 113, 133, 0.12); color: var(--pnl-down) !important; }
.metric-tag.info     { background: var(--accent-soft); color: var(--accent); }
.progress-fill { background: var(--accent); }

/* ======================  the card shell  ====================== */
.opp-card.oc {
  padding: 1.05rem 1.15rem 1rem;
  gap: 0.65rem;
  border: 1px solid var(--oc-hair);
  border-radius: 14px;
  background: var(--oc-surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  position: relative;
  overflow: hidden;
}
.opp-card.oc:hover {
  border-color: var(--hair-strong);
  transform: none;
}
/* state accents: a single hairline on the left, no thick green bars */
.opp-card.oc.oc-edge  { border-left: 2px solid var(--accent-line); }
.opp-card.oc.oc-held  { border-left: 2px solid rgba(124, 140, 248, 0.55); }
.opp-card.oc.oc-pass  { border-left: 2px solid var(--oc-hair); opacity: 0.72; }
.opp-card.oc.oc-pass:hover { opacity: 1; }

/* corner "held" tag — small, angled, top-right, not green */
.opp-card.oc.oc-held::after {
  content: "IN PORTFOLIO";
  position: absolute;
  top: 19px;
  right: -46px;
  width: 152px;
  padding: 3px 0;
  transform: rotate(45deg);
  text-align: center;
  background: var(--accent);
  color: #0b0f19;
  font: 700 0.5rem/1 var(--font-mono);
  letter-spacing: 0.12em;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 2;
}
/* keep the platform wordmark clear of the ribbon */
.opp-card.oc.oc-held .oc-top { padding-right: 46px; }

/* ======================  top row: brand wordmark  ====================== */
.oc-top { display: flex; align-items: center; min-height: 16px; }
.oc-plat {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  text-decoration: none;
  color: var(--text-muted);
  font: 700 0.74rem/1 var(--font-sans);
  letter-spacing: 0.01em;
  transition: color var(--transition-fast);
}
.oc-plat:hover { filter: brightness(1.15); }
.oc-plat:hover .oc-ext { opacity: 0.9; }
.oc-plat-glyph { width: 13px; height: 13px; fill: currentColor; flex: none; }
.oc-plat-name { font-weight: 700; }
.oc-plat.is-poly    { color: #a9b2f5; }
.oc-plat.is-kalshi  { color: #4fd1c5; }   /* Kalshi teal — was near-white grey, read as plain text */
.oc-plat.is-kalshi .oc-plat-name { letter-spacing: 0.02em; }
/* Arrow always visible (dimmed) so the badge reads as a link on touch — no hover there. */
.oc-ext { width: 10px; height: 10px; opacity: 0.5; transition: opacity var(--transition-fast); flex: none; }

/* ======================  headline: CITY — 🔥 High · bracket — PICK  ====================== */
.oc-headline {
  font-family: var(--font-sans);
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.34;
}
.oc-hl-head { white-space: nowrap; }
.oc-hl-tail { white-space: nowrap; }
.oc-city { text-transform: uppercase; letter-spacing: 0.03em; font-size: 0.94rem; }
.oc-bracket { font-weight: 700; }
.oc-dash { color: var(--text-muted); font-weight: 400; margin: 0 0.3rem; }
.oc-mid  { color: var(--text-subtle); font-weight: 400; margin: 0 0.32rem; }
.oc-pick {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.04rem 0.38rem;
  border-radius: 5px;
  border: 1px solid transparent;
  position: relative;
  top: -1px;
}
.oc-pick-yes { color: var(--pick-yes); background: rgba(142, 162, 255, 0.12); border-color: rgba(142, 162, 255, 0.28); }
.oc-pick-no  { color: var(--pick-no);  background: rgba(240, 180, 95, 0.12);  border-color: rgba(240, 180, 95, 0.28); }

/* High (daily max) vs Low (overnight min) contract badge — 2026-09-23. Warm
   amber for High, cool cyan for Low: an intuitive, glanceable pairing so the
   two market types are distinguishable in a scan of many rows, not just by
   reading the word. */
.metric-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.06rem 0.4rem;
  border-radius: 5px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.metric-badge-high { color: var(--accent-amber); background: color-mix(in srgb, var(--accent-amber) 14%, transparent); border-color: color-mix(in srgb, var(--accent-amber) 32%, transparent); }
.metric-badge-low  { color: var(--accent-cyan);  background: color-mix(in srgb, var(--accent-cyan) 14%, transparent);  border-color: color-mix(in srgb, var(--accent-cyan) 32%, transparent); }

/* thin context line: date · local clock · phase · station obs */
.oc-when {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-subtle);
  margin-top: -0.3rem;
}
.oc-when-sep { opacity: 0.45; }

/* ======================  market vs model  ====================== */
.opp-card.oc .mm-compare {
  background: var(--hair-faint);
  border: 1px solid var(--oc-hair);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  gap: 0.45rem;
}
.opp-card.oc .mm-lbl {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  font-weight: 700;
}
.opp-card.oc .mm-fill.mkt { background: var(--text-subtle); }
.opp-card.oc .mm-fill.mod { background: var(--accent); }
.opp-card.oc .mm-val { font-size: 0.8rem; color: var(--text-muted); }
.opp-card.oc .mm-val.mm-model { color: var(--accent); }
.opp-card.oc .mm-note {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-subtle);
}
.opp-card.oc .mm-note b { color: var(--text-muted); }

/* ======================  ensemble + footer  ====================== */
.oc-ensemble {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-subtle);
}
.oc-ensemble b { color: var(--text-muted); font-weight: 700; }

.oc-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--oc-hair);
  padding-top: 0.6rem;
  margin-top: 0.1rem;
}
.oc-edge {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent);
}
.oc-edge b { color: var(--text-main); font-weight: 700; }
.oc-edge.oc-edge-pass { color: var(--text-subtle); }
.oc-note {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-subtle);
  text-align: right;
}
.oc-note b { color: var(--text-muted); }

/* ======================  held-position panel (calmer)  ====================== */
.opp-card.oc .opp-position-panel {
  background: var(--hair-faint);
  border: 1px solid var(--oc-hair);
  border-left: 2px solid var(--text-subtle);
  border-radius: 9px;
  padding: 0.55rem 0.75rem;
}
.opp-card.oc .opp-position-panel.pos-up   { border-left-color: var(--pnl-up); }
.opp-card.oc .opp-position-panel.pos-down { border-left-color: var(--pnl-down); }
.opp-card.oc .opp-pos-label { font-size: 0.58rem; color: var(--text-subtle); }
.opp-card.oc .opp-pos-qty   { font-size: 0.76rem; }
.opp-card.oc .opp-pos-prices { font-size: 0.78rem; }
.opp-card.oc .opp-pos-pnl { font-size: 0.88rem; font-weight: 800; }
.opp-card.oc .opp-position-panel.pos-up   .opp-pos-pnl { color: var(--pnl-up); }
.opp-card.oc .opp-position-panel.pos-down .opp-pos-pnl { color: var(--pnl-down); }
.opp-pos-asof {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  color: var(--text-subtle);
  opacity: 0.8;
}
.opp-pos-asof [data-role="opp-asof"] { color: var(--text-muted); }

/* ======================  clickable metric card + calibration chart ====================== */
.metric-card-link { cursor: pointer; position: relative; transition: border-color var(--transition-fast); }
.metric-card-link:hover { border-color: var(--accent-line); }
.metric-card-cta {
  display: block;
  margin-top: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--accent);
  opacity: 0.75;
  transition: opacity var(--transition-fast);
}
.metric-card-link:hover .metric-card-cta { opacity: 1; }

/* ── System-health metric card ─────────────────────────────────────────── */
#metric-card-health .metric-value {
  font-family: var(--font-mono);   /* match every other card's headline */
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.health-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--text-muted); flex: none;
}
#metric-card-health.h-ok    .health-dot { background: var(--accent-emerald); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-emerald) 20%, transparent); }
#metric-card-health.h-warn  .health-dot { background: var(--accent-amber);   box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-amber) 20%, transparent); }
#metric-card-health.h-bad   .health-dot { background: var(--accent-rose);    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-rose) 20%, transparent); }
#metric-card-health.h-ok   .metric-value { color: var(--accent-emerald); }
#metric-card-health.h-warn .metric-value { color: var(--accent-amber); }
#metric-card-health.h-bad  .metric-value { color: var(--accent-rose); }
#health-tag.h-warn { background: color-mix(in srgb, var(--accent-amber) 15%, transparent); color: var(--accent-amber); }
#health-tag.h-bad  { background: color-mix(in srgb, var(--accent-rose) 15%, transparent); color: var(--accent-rose); }

/* ── Open-book metric card ─────────────────────────────────────────────── */
.book-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: auto;
}
.book-chip {
  font: 600 0.7rem var(--font-mono, 'JetBrains Mono', monospace);
  padding: 0.15rem 0.45rem;
  border-radius: 5px;
  background: var(--hair);
  border: 1px solid var(--hair-strong);
  color: var(--text-muted);
  white-space: nowrap;
}
.book-chip b { color: var(--text-strong); font-weight: 800; }
.book-chip.bc-live { color: var(--accent-emerald); border-color: color-mix(in srgb, var(--accent-emerald) 35%, transparent); }
.book-chip.bc-win  { color: var(--accent-emerald); }
.book-chip.bc-loss { color: var(--accent-rose); }
.book-chip.bc-flip { color: var(--accent-amber); }

.calibration-card { margin-bottom: 1.25rem; }

/* shadow "+ Climo" row on the opportunity card mm-compare block */
.opp-card.oc .mm-row.mm-shadow { opacity: 0.72; }
.opp-card.oc .mm-fill.shadow { background: repeating-linear-gradient(90deg, #34d399 0 4px, transparent 4px 7px); }
.opp-card.oc .mm-shadow .mm-lbl { color: #34d399; }
.mm-shadow-tag {
  font-size: 0.56rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
  border: 1px solid var(--oc-hair);
  border-radius: 3px;
  padding: 0 0.2rem;
  margin-left: 0.2rem;
}
.chart-explainer {
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--text-muted);
  padding: 0 1.4rem 0.7rem;
}
.chart-explainer b { color: var(--text-main); font-weight: 700; }
.chart-explainer i { color: var(--text-secondary, var(--text-main)); font-style: italic; }
.chart-explainer-list {
  margin: 0;
  padding: 0 1.4rem 0.7rem 2.6rem;
  list-style: disc;
}
.chart-explainer-list li { margin: 0.28rem 0; }
.chart-explainer-note {
  border-left: 2px solid var(--oc-hair, var(--border-color));
  margin: 0 1.4rem 0.4rem;
  padding: 0.3rem 0 0.3rem 0.7rem;
  font-size: 0.76rem;
  opacity: 0.9;
}
.chart-body-tall { height: 320px; }

/* ---- "Why this bet?" decision-record expander --------------------------- */
.dr-toggle {
  background: none; border: 1px solid var(--border-color); color: var(--text-muted);
  width: 18px; height: 18px; border-radius: 4px; font-size: 0.7rem; line-height: 1;
  cursor: pointer; padding: 0; margin-right: 0.4rem; flex: 0 0 auto;
}
.dr-toggle:hover, .dr-toggle.open { color: var(--accent-cyan); border-color: var(--accent-cyan); }
.dr-detail-row > td { padding: 0 !important; background: var(--hair-faint); }
.dr-panel { padding: 0.9rem 1.2rem; font-size: 0.78rem; color: var(--text-secondary, #cbd5e1); }
.dr-summary { font-size: 0.82rem; color: var(--text-main); line-height: 1.5; margin-bottom: 0.6rem; }
.dr-outcome { display: inline-block; padding: 0.2rem 0.55rem; border-radius: 6px; margin-bottom: 0.7rem; font-size: 0.76rem; }
.dr-outcome.dr-good { background: rgba(16,185,129,0.14); color: var(--accent-emerald); }
.dr-outcome.dr-bad { background: rgba(244,63,94,0.14); color: var(--accent-rose); }
.dr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.7rem; }
.dr-card { border: 1px solid var(--oc-hair, var(--border-color)); border-radius: 8px; padding: 0.6rem 0.75rem; background: var(--card-bg, rgba(255,255,255,0.02)); }
.dr-card h5 { margin: 0 0 0.4rem; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.dr-kv { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.12rem 0; }
.dr-kv span { color: var(--text-muted); }
.dr-kv b { color: var(--text-main); font-family: var(--font-mono); font-weight: 600; }
.dr-src-line, .dr-note { margin-top: 0.4rem; font-size: 0.72rem; color: var(--text-muted); font-style: italic; line-height: 1.4; }
.dr-sources { margin-top: 0.7rem; }
.dr-sources summary { cursor: pointer; color: var(--accent-cyan); font-size: 0.76rem; }
.dr-table { width: 100%; border-collapse: collapse; margin-top: 0.4rem; font-size: 0.74rem; }
.dr-table th, .dr-table td { text-align: left; padding: 0.2rem 0.5rem; border-bottom: 1px solid var(--hair-faint); }
.dr-ok { color: var(--accent-emerald); }
.dr-off { color: var(--text-subtle); }
.dr-gates, .dr-seen { margin-top: 0.6rem; font-size: 0.7rem; color: var(--text-subtle); line-height: 1.5; }
.dr-reject { margin-top: 0.5rem; font-size: 0.74rem; color: var(--accent-amber); }
.dr-empty { padding: 0.6rem 0; color: var(--text-muted); font-style: italic; }

/* mobile: a full-width "Why this bet?" row under each card */
.dr-toggle-mobile {
  width: 100%; height: auto; margin: 0.6rem 0 0; padding: 0.5rem 0.75rem;
  display: flex; align-items: center; gap: 0.4rem; justify-content: center;
  font-size: 0.78rem; border-radius: 8px; border: 1px dashed var(--border-color);
  background: var(--hair-faint); color: var(--text-secondary, #cbd5e1);
}
.dr-toggle-mobile.open { border-style: solid; color: var(--accent-cyan); border-color: var(--accent-cyan); }
.dr-detail-mobile { margin-top: 0.5rem; border: 1px solid var(--border-color); border-radius: 8px; background: var(--hair-faint); }
.dr-detail-mobile .dr-panel { padding: 0.8rem 0.9rem; }
.dr-detail-mobile .dr-grid { grid-template-columns: 1fr; }

/* ---- trading-freeze banner -------------------------------------------- */
.freeze-banner {
  background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.4);
  color: var(--accent-amber); border-radius: 10px; padding: 0.7rem 1rem;
  margin: 0 0 1rem; font-size: 0.85rem; display: flex; align-items: center; gap: 0.5rem;
}
.freeze-banner b { color: var(--text-main); }

/* ======================  "was the early exit right?" — hold-to-close compare ====================== */
.hold-compare {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.4;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--oc-hair);
  background: var(--hair-faint);
  color: var(--text-muted);
}
.hold-compare b { color: var(--text-main); font-weight: 700; }
.hold-compare.hc-good { border-left: 2px solid var(--pnl-up); }
.hold-compare.hc-bad  { border-left: 2px solid var(--accent-amber); }
.hold-compare.hc-flat { border-left: 2px solid var(--text-subtle); }

/* Permanent link to the NWS Daily Climate Report a trade settled against. */
.cli-report-link {
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
  color: inherit;
}
.cli-report-link:hover { color: var(--accent-cyan); border-bottom-color: var(--accent-cyan); }
.cli-report-link .cli-ext {
  font-size: 0.7em;
  vertical-align: super;
  margin-left: 1px;
  opacity: 0.7;
}
.hc-inline {
  font-size: 0.66rem;
  margin-top: 0.15rem;
  color: var(--text-subtle);
}
.hc-inline.hc-good { color: var(--pnl-up); }
.hc-inline.hc-bad  { color: var(--accent-amber); }

/* Trade Ledger table & Positions table — tidy Settles / City / Hold-to-Close columns */
.custom-table .td-date {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-subtle);
}
.custom-table .td-city {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.custom-table .tt-contract { font-weight: 700; }

.hc-cell { display: flex; flex-direction: column; gap: 0.1rem; line-height: 1.35; }
.hc-held { font-size: 0.72rem; color: var(--text-muted); }
.hc-verdict { font-size: 0.72rem; font-weight: 700; }
.hc-verdict.hc-good { color: var(--pnl-up); }
.hc-verdict.hc-bad  { color: var(--accent-amber); }
.hc-verdict.hc-flat { color: var(--text-subtle); }

/* ======================  Positions + Trade-Ledger mobile cards — same calm treatment ====================== */
.mobile-pos-card,
.mobile-trade-card {
  background: var(--oc-surface);
  border: 1px solid var(--oc-hair);
  border-left: 2px solid var(--oc-hair);
  border-radius: 14px;
  gap: 0.7rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.mobile-pos-card.in-profit,
.mobile-trade-card.win-card  { border-left-color: var(--pnl-up);   background: var(--oc-surface); }
.mobile-pos-card.in-loss,
.mobile-trade-card.loss-card { border-left-color: var(--pnl-down); background: var(--oc-surface); }
.mobile-pos-card.in-neutral,
.mobile-trade-card.flat-card { border-left-color: var(--hair-strong); background: var(--oc-surface); }
.mobile-trade-card.flat-card .mobile-pnl-banner .pnl-val { color: var(--text-muted); }
.mobile-pos-card .oc-top,
.mobile-trade-card .oc-top { min-height: 14px; align-items: center; }
/* "if it wins +$X" chip — top-right of a mobile position card */
.mobile-pos-card .oc-top { justify-content: space-between; gap: 0.5rem; }
.oc-winmax {
  font-size: 0.72rem; color: var(--text-muted); white-space: nowrap;
  letter-spacing: 0.01em;
}
.oc-winmax b { color: var(--accent-emerald); font-family: var(--font-mono); font-weight: 600; }
.mobile-pos-card .oc-when,
.mobile-trade-card .oc-when { margin-top: -0.25rem; }

/* ======================  responsive  ====================== */
@media (max-width: 768px) {
  .opp-card.oc { padding: 1rem 1rem 0.95rem; gap: 0.7rem; }
  .oc-hl { font-size: 0.95rem; }
  .oc-city { font-size: 0.86rem; }
  .oc-headline { gap: 0.35rem; }
  .oc-foot { flex-direction: column; align-items: stretch; gap: 0.45rem; }
  .oc-note { text-align: left; }
  .opp-card.oc.oc-held::after { font-size: 0.48rem; right: -38px; }
}

/* ==========================================================================
   v4 — nav redesign + light theme
   ========================================================================== */

/* ---------- LIGHT THEME ---------- */
:root[data-theme="light"] {
  --bg-main: #f3f5fa;
  --bg-card: #ffffff;
  --bg-card-hover: #f7f9fc;
  --bg-subtle: #eef1f7;

  --text-main: #101623;
  --text-strong: #0b0f19;
  --text-muted: #4b5563;
  --text-subtle: #8a93a3;

  --hair-faint: rgba(15, 23, 42, 0.045);
  --hair: rgba(15, 23, 42, 0.09);
  --hair-strong: rgba(15, 23, 42, 0.16);
  --border-color: var(--hair-strong);

  --navbar-bg: rgba(255, 255, 255, 0.9);
  --panel-bg: #eef1f7;

  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);

  /* v3 tokens */
  --accent: #5b62e6;
  --accent-soft: rgba(91, 98, 230, 0.10);
  --accent-line: rgba(91, 98, 230, 0.30);
  --pnl-up: #0f9d63;
  --pnl-down: #e0475f;
  --oc-surface: #ffffff;
  --oc-hair: rgba(15, 23, 42, 0.10);
  --pick-yes: #4f57d6;
  --pick-no: #b26a12;
  --accent-cyan: #0e8fa8;
  --accent-emerald: #0f9d63;
  --accent-rose: #e0475f;
  --accent-amber: #c07d15;
}

:root[data-theme="light"] body.dark-theme {
  background-color: var(--bg-main);
  color: var(--text-main);
  background-image:
    radial-gradient(circle at 12% 0%, rgba(91, 98, 230, 0.05) 0%, transparent 45%),
    radial-gradient(circle at 100% 100%, rgba(91, 98, 230, 0.04) 0%, transparent 48%);
}
:root[data-theme="light"] .glass-card,
:root[data-theme="light"] .navbar { backdrop-filter: none; }
/* white text that must stay white sits on coloured buttons */
:root[data-theme="light"] .btn-primary,
:root[data-theme="light"] .btn-danger,
:root[data-theme="light"] .tab-btn.active,
:root[data-theme="light"] .opp-card.oc.oc-held::after { color: #fff; }
:root[data-theme="light"] .metric-value,
:root[data-theme="light"] .section-title,
:root[data-theme="light"] h1, :root[data-theme="light"] h2, :root[data-theme="light"] h3 { color: var(--text-main); }
:root[data-theme="light"] .empty-spinner { border-top-color: var(--accent); }

/* light-theme buttons: solid fills, real contrast */
:root[data-theme="light"] .btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
:root[data-theme="light"] .btn-primary:hover { background: #4a52d8; color: #fff; }
:root[data-theme="light"] .btn-outline {
  background: #fff;
  border-color: var(--hair-strong);
  color: var(--text-main);
}
:root[data-theme="light"] .btn-outline:hover { background: var(--bg-subtle); }
:root[data-theme="light"] .btn-icon {
  background: #fff;
  border: 1px solid var(--hair-strong);
  color: var(--text-muted);
}
:root[data-theme="light"] .btn-icon:hover { color: var(--text-main); background: var(--bg-subtle); }
:root[data-theme="light"] .btn-danger { background: var(--accent-rose); color: #fff; border-color: var(--accent-rose); }
:root[data-theme="light"] .filter-pill { background: #fff; border: 1px solid var(--hair-strong); }
:root[data-theme="light"] .filter-pill.active { background: var(--bg-subtle); border-color: var(--accent-line); }
:root[data-theme="light"] .custom-select,
:root[data-theme="light"] .custom-input { background: #fff; border: 1px solid var(--hair-strong); color: var(--text-main); }
:root[data-theme="light"] .modal-overlay { background: rgba(15, 23, 42, 0.45); }
:root[data-theme="light"] .exit-badge,
:root[data-theme="light"] .status-badge.win  { background: rgba(15, 157, 99, 0.12); color: #0b7a4d; border: 1px solid rgba(15,157,99,0.25); }
:root[data-theme="light"] .status-badge.loss { background: rgba(224, 71, 95, 0.12); color: #c02a44; border: 1px solid rgba(224,71,95,0.25); }
:root[data-theme="light"] .live-badge { background: #fff; border-color: var(--hair-strong); }
:root[data-theme="light"] .live-badge.live  { color: #0b7a4d; background: rgba(15, 157, 99, 0.08); border-color: rgba(15,157,99,0.3); }
:root[data-theme="light"] .live-badge.rest  { color: #0e7490; background: rgba(14, 143, 168, 0.08); }
:root[data-theme="light"] .live-badge.stale { color: #b45309; }
:root[data-theme="light"] .live-badge.off   { color: var(--text-subtle); }
:root[data-theme="light"] .status-badge.win  { color: #0b7a4d; }
:root[data-theme="light"] .status-badge.loss { color: #c02a44; }
:root[data-theme="light"] .side-badge.no  { color: var(--pick-no); background: rgba(178,106,18,0.1); }
:root[data-theme="light"] .side-badge.yes { color: var(--pick-yes); background: rgba(79,87,214,0.1); }

/* ---------- NAVBAR ---------- */
.navbar {
  padding: 0.7rem 1.5rem;
  background: var(--navbar-bg);
  gap: 1.25rem;
}
.nav-left { gap: 0.8rem; flex: 0 0 auto; }
.nav-center { flex: 1 1 auto; display: flex; justify-content: center; min-width: 0; }
.nav-right { flex: 0 0 auto; gap: 0.5rem; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text-main);
}
.brand-mark { width: 30px; height: 30px; color: var(--accent); flex: none; }
.brand-name {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
@media (max-width: 1180px) { .brand-name { display: none; } }

.nav-tabs {
  background: var(--panel-bg);
  padding: 0.2rem;
  border: 1px solid var(--hair);
  border-radius: 11px;
  gap: 0.15rem;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tabs .tab-btn {
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 8px;
  white-space: nowrap;
  color: var(--text-muted);
}
.nav-tabs .tab-btn svg { display: none; }        /* icons gone — labels only */
.nav-tabs .tab-btn:hover { background: var(--hair); color: var(--text-main); }
.nav-tabs .tab-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: none;
  font-weight: 700;
}
.nav-tabs .tab-btn.active .tab-badge { color: #fff; background: rgba(255, 255, 255, 0.22); }
.nav-tabs .tab-badge {
  background: var(--hair-strong);
  color: var(--text-subtle);
  font-size: 0.68rem;
  padding: 0.05rem 0.35rem;
}

.navbar .btn-primary {
  padding: 0.45rem 0.9rem;
  font-size: 0.82rem;
}
.navbar .btn-icon { width: 34px; height: 34px; }

@media (max-width: 640px) {
  .navbar { padding: 0.6rem 0.8rem; gap: 0.6rem; flex-wrap: wrap; }
  .nav-center { order: 3; width: 100%; justify-content: flex-start; }
  .navbar .btn-primary span { display: none; }
  .navbar .btn-primary { padding: 0.45rem 0.6rem; }
}

/* ---------- THEME TOGGLE (Settings) ---------- */
.theme-toggle {
  display: inline-flex;
  background: var(--panel-bg);
  border: 1px solid var(--hair);
  border-radius: 9px;
  padding: 0.15rem;
  gap: 0.15rem;
}
.theme-toggle button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: 600 0.8rem var(--font-sans);
  padding: 0.35rem 0.9rem;
  border-radius: 7px;
  cursor: pointer;
  transition: var(--transition-fast);
}
.theme-toggle button:hover { color: var(--text-main); }
.theme-toggle button.active {
  background: var(--accent);
  color: #fff;
}

.setting-separator-danger span { color: var(--accent-rose); }

/* light-theme: kill leftover dark-navy backgrounds that slip through specificity */
:root[data-theme="light"] .opp-card.pass,
:root[data-theme="light"] .opp-card.oc.oc-pass { background: var(--oc-surface); }
:root[data-theme="light"] .mobile-observed-row,
:root[data-theme="light"] .mm-compare,
:root[data-theme="light"] .opp-card.oc .mm-compare { background: var(--bg-subtle); border-color: var(--hair); }
:root[data-theme="light"] .opp-position-panel,
:root[data-theme="light"] .opp-card.oc .opp-position-panel { background: var(--bg-subtle); }
:root[data-theme="light"] .mobile-pos-money { background: var(--bg-subtle); border-color: var(--hair); }
:root[data-theme="light"] .setting-item { border-color: var(--hair); }
:root[data-theme="light"] .tab-badge { background: var(--hair-strong); color: var(--text-muted); }
:root[data-theme="light"] .stats-summary-box .stat-item { border-color: var(--hair); }
:root[data-theme="light"] .whatsapp-setup-tip { background: var(--bg-subtle); }
:root[data-theme="light"] code { background: var(--hair-strong); color: var(--text-main); }

/* ── "Why skipped" sub-filter + per-card Re-eval ──────────────────────── */
.skip-subfilter {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 0.15rem 0 1rem;
  padding: 0.55rem 0.7rem;
  background: var(--panel-bg);
  border: 1px solid var(--hair);
  border-radius: 10px;
}
.skip-subfilter[hidden] { display: none; }
.skip-subfilter-label {
  font: 600 0.72rem var(--font-sans);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.skip-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.skip-chip {
  border: 1px solid var(--hair-strong);
  background: transparent;
  color: var(--text-muted);
  font: 600 0.78rem var(--font-sans);
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  transition: var(--transition-fast);
}
.skip-chip:hover { color: var(--text-main); border-color: var(--accent); }
.skip-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.skip-chip-n { opacity: 0.7; font-weight: 700; }
.skip-chip.active .skip-chip-n { opacity: 0.85; }

.oc-reeval {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--hair-faint);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.btn-xs {
  font: 600 0.75rem var(--font-sans);
  padding: 0.3rem 0.7rem;
  border-radius: 7px;
  cursor: pointer;
  align-self: flex-start;
}
.reeval-box:empty { display: none; }
.reeval-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  font: 500 0.8rem var(--font-sans);
  color: var(--text-muted);
}
.reeval-verdict {
  font-weight: 700;
  padding: 0.12rem 0.5rem;
  border-radius: 6px;
}
.rv-good { background: rgba(16,185,129,0.16); color: var(--accent-emerald); }
.rv-bad  { background: var(--hair-strong); color: var(--text-muted); }
.rv-flat { background: rgba(148,163,184,0.18); color: var(--text-main); }
.reeval-reason { flex: 1 1 100%; color: var(--text-main); }
.reeval-meta { font-size: 0.74rem; opacity: 0.8; }
.reeval-dismiss {
  margin-left: auto;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
}
.reeval-dismiss:hover { color: var(--text-main); }

.btn-reeval:disabled { opacity: 0.5; cursor: default; }

/* card fades out once its bet is placed — it drops off on the next state refresh.
   Uses filter:opacity() not the opacity property: the card's entrance keyframe
   pins `opacity:1` and would otherwise win. */
.opp-card.oc-card--done {
  filter: grayscale(0.35) opacity(0.62) !important;
  border-color: var(--accent-emerald) !important;
}
.opp-card.oc-card--done .btn-reeval { display: none; }

/* ── Thin-market mark flag ─────────────────────────────────────────────
   A position whose live mark sits on a near-empty order book: the
   unrealized P&L reprices on a single stale order and means nothing until
   settlement. Grey it out and label it. */
.mark-thin,
[data-role="pnl"].mark-thin,
[data-role="pnl"].mark-thin strong,
.pnl-val.mark-thin,
.opp-pos-pnl.mark-thin {
  color: var(--text-muted) !important;
  opacity: 0.75;
}
.mobile-pnl-banner.mark-thin { border-color: var(--hair-strong); }
td[data-role="mark"].mark-thin { color: var(--text-muted); opacity: 0.7; }

.thin-flag {
  display: inline-block;
  font: 600 0.64rem var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-amber);
  background: color-mix(in srgb, var(--accent-amber) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-amber) 35%, transparent);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  margin-left: 0.4rem;
  vertical-align: 1px;
  cursor: help;
}
.opp-position-panel .thin-flag {
  display: block;
  margin: 0.35rem 0 0;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}

/* ── Projection flag ──────────────────────────────────────────────────
   A past/decided-day position that has NOT settled yet. Its mark is a
   projection from the preliminary observation; the real settlement is the
   next-morning official NWS Climate Report. Never a booked result. */
[data-role="pnl"].mark-projected,
[data-role="pnl"].mark-projected strong,
.pnl-val.mark-projected,
td[data-role="mark"].mark-projected {
  color: var(--text-muted) !important;
  opacity: 0.9;
}
.mobile-pnl-banner.mark-projected { border-color: var(--hair-strong); }

.proj-flag {
  display: inline-block;
  font: 600 0.64rem var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  margin-left: 0.4rem;
  vertical-align: 1px;
  cursor: help;
}
.proj-flag.proj-win {
  color: var(--accent-emerald);
  background: color-mix(in srgb, var(--accent-emerald) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-emerald) 35%, transparent);
}
.proj-flag.proj-loss {
  color: var(--accent-rose);
  background: color-mix(in srgb, var(--accent-rose) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-rose) 35%, transparent);
}
.proj-flag.proj-tbd {
  color: var(--accent-amber);
  background: color-mix(in srgb, var(--accent-amber) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-amber) 35%, transparent);
}
.opp-position-panel .proj-flag {
  display: block;
  margin: 0.35rem 0 0;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}

/* ── Awaiting-settlement (no venue book to trade) ─────────────────────── */
/* Desktop "Win Prob" cell: two quiet lines, no badge chrome. */
.settle-status {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  align-items: flex-start;
}
.settle-sub {
  font-weight: 700;
  font-size: 0.86rem;
}
.settle-ctx {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.settle-status.settle-win .settle-sub { color: var(--accent-emerald); }
.settle-status.settle-loss .settle-sub { color: var(--accent-rose); }
.settle-status.settle-tbd .settle-sub { color: var(--accent-amber); }
.settle-ts {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.05rem;
}

/* Desktop "Action" cell: just a lock glyph. */
.pos-locked {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  font-size: 0.85rem;
  color: var(--text-muted);
  opacity: 0.7;
  cursor: default;
}

/* ── Mobile position card — one compact skeleton, live + settling ────── */
.mobile-pos-card.mpc {
  gap: 0.6rem;
  padding: 1.1rem;
}
.mobile-pos-card.mpc.mpc-locked { border-left: 1px solid var(--border-color); background: var(--bg-card); }
.mobile-pos-card.mpc.mpc-live { border-left: 4px solid var(--accent-line); background: var(--bg-card); }
.mobile-pos-card.mpc.mpc-live.prob-safe     { border-left-color: var(--accent-emerald); }
.mobile-pos-card.mpc.mpc-live.prob-moderate { border-left-color: var(--accent-amber); }
.mobile-pos-card.mpc.mpc-live.prob-danger   { border-left-color: var(--accent-rose); }

.mpc-status {
  font: 700 0.95rem var(--font-sans, 'Plus Jakarta Sans', sans-serif);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.mpc-locked.settle-win .mpc-status  { color: var(--accent-emerald); }
.mpc-locked.settle-loss .mpc-status { color: var(--accent-rose); }
.mpc-locked.settle-tbd .mpc-status  { color: var(--accent-amber); }

.mpc-status-live { color: var(--text-strong); font-weight: 600; font-size: 0.88rem; }
.mpc-status-live strong { font-weight: 800; }
.mpc-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-emerald) 22%, transparent);
}
.mpc-status-live.prob-moderate .mpc-dot { background: var(--accent-amber); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-amber) 22%, transparent); }
.mpc-status-live.prob-danger .mpc-dot   { background: var(--accent-rose);  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-rose) 22%, transparent); }
.mpc-status-live.prob-safe     { color: var(--accent-emerald); }
.mpc-status-live.prob-moderate { color: var(--accent-amber); }
.mpc-status-live.prob-danger   { color: var(--accent-rose); }

.mpc-outcome {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  background: var(--hair);
  border: 1px solid var(--hair-strong);
}
.mpc-outcome-label {
  font: 600 0.62rem var(--font-mono, 'JetBrains Mono', monospace);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}
.mpc-outcome-val {
  font: 800 1.1rem var(--font-mono, 'JetBrains Mono', monospace);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.mpc-outcome-val .pnl-range { font-size: 0.98rem; }
.mpc-outcome-val .mpc-pct { font-size: 0.78rem; font-weight: 600; opacity: 0.8; }
.mpc-outcome-val .positive { color: var(--accent-emerald); }
.mpc-outcome-val .negative { color: var(--accent-rose); }

.mpc-foot {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.mpc-foot b { color: var(--text-strong); font-weight: 700; }

.mobile-pos-card.mpc .mobile-btn-sell { margin-top: 0.1rem; }

/* ── Coin-flip position: unrealized P&L is a range, not a number ──────── */
.pnl-range, .metric-range {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pnl-range .rng-sep {
  font-size: 0.72em;
  font-weight: 600;
  text-transform: lowercase;
  color: var(--text-muted);
  padding: 0 0.15em;
}
/* Range headline matches every other card's big number; only the "to" separator
   is shrunk. Scales down a touch on narrow cards so it never overflows. */
.metric-value.metric-range {
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  letter-spacing: -0.01em;
}
.metric-value.metric-range .rng-sep {
  font-size: 0.62em;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0 0.2em;
}
td[data-role="pnl"].pnl-neutral,
.mobile-pnl-banner.pnl-neutral,
.mobile-pnl-banner.pnl-neutral .pnl-val,
.pnl-val.pnl-neutral { color: var(--text-muted) !important; }
.metric-value.metric-range.neutral { color: var(--text-muted); }
.metric-value.metric-range.positive { color: var(--accent-emerald); }
.metric-value.metric-range.negative { color: var(--accent-rose); }

.proj-tag {
  font: 600 0.58rem var(--font-mono, 'JetBrains Mono', monospace);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border: 1px solid var(--hair-strong);
  border-radius: 3px;
  padding: 0 0.25rem;
  vertical-align: 1px;
}
.mark-cf {
  font: 600 0.72rem var(--font-mono, 'JetBrains Mono', monospace);
  color: var(--accent-amber);
}

.contract-title-cell {
  min-width: 140px;
  line-height: 1.3;
}
.td-city { min-width: 70px; }
.td-date { min-width: 60px; }
.hc-cell { min-width: 110px; }

.td-fee { font-size: 0.68rem; color: var(--text-subtle); font-family: var(--font-mono); }
.pnl-winmax { font-size: 0.68rem; color: var(--text-muted); font-family: var(--font-mono); font-weight: 500; }
.pnl-range-hint { font-size: 0.68rem; color: var(--text-subtle); font-family: var(--font-mono); font-weight: 500; white-space: nowrap; }

/* Positions table: 11 columns — keep it inside the viewport, no horizontal scroll.
   Scoped to #positions-table so the Ledger table is untouched. */
#positions-table th,
#positions-table td {
  padding: 0.7rem 0.5rem;
  font-size: 0.8rem;
}
#positions-table th:first-child,
#positions-table td:first-child { padding-left: 0.9rem; }
#positions-table th:last-child,
#positions-table td:last-child { padding-right: 0.9rem; }
#positions-table .contract-title-cell { min-width: 118px; }
/* City rides next to the platform badge on the first line (Deniz 2026-09-24) —
   no separate City column anymore. */
#positions-table .tt-city-inline {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}
/* The HIGH/LOW target pill ALWAYS sits on the second line — never inline on
   line 1 on wide rows and wrapped on narrow ones. Consistent two-line rows. */
#positions-table .tt-contract { flex-basis: 100%; }
/* The Live-Forecast / Win-Prob column is the widest — cap it and clip the status text */
#positions-table .live-win-prob-cell { max-width: 190px; }
#positions-table .live-fc-status,
#positions-table .settle-ctx {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}
#positions-table .btn-sell-pos { padding: 0.4rem 0.55rem; white-space: nowrap; }

/* Let exit-badge wrap if needed */
.exit-badge {
  white-space: normal;
  display: inline-block;
  line-height: 1.2;
  text-align: center;
}
