* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: #0d1117;
  color: white;
  font-family: Poppins, sans-serif;
}

.app {
  display: flex;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 240px;
  background: #161b22;
  padding: 25px 15px;
  position: fixed;
  height: 100vh;
}

.sidebar h2 {
  text-align: center;
  color: #00d084;
  margin-bottom: 10px;
}

.logo p {
  margin: 5px 0 20px;
  font-size: 12px;
  color: #8b949e;
  text-align: center;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.sidebar a {
  color: white;
  text-decoration: none;
  padding: 12px;
  border-radius: 8px;
  transition: 0.3s;
}

.sidebar a:hover {
  background: #00d084;
  color: #000;
}

/* ===== Main layout ===== */
.main {
  margin-left: 240px;
  width: calc(100% - 240px);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: #161b22;
  border-bottom: 1px solid #30363d;
  gap: 20px;
  flex-wrap: wrap;
}

.auth-area {
  display: flex;
  align-items: center;
}

.signed-in-info {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #c9d1d9;
  font-size: 14px;
}

.brand h1 {
  margin: 0;
  font-size: 28px;
  color: #00d084;
}

.brand p {
  margin: 5px 0 0;
  color: #8b949e;
  font-size: 14px;
}

.search input {
  padding: 13px 16px;
  width: 240px;
  font-size: 15px;
  border-radius: 8px;
  border: 1px solid #30363d;
  background: #0d1117;
  color: white;
}

.search button {
  padding: 13px 26px;
  font-size: 15px;
}

button {
  padding: 10px 20px;
  background: #00d084;
  border: none;
  cursor: pointer;
  border-radius: 8px;
  font-weight: 600;
}

button:hover {
  opacity: 0.85;
}

.container {
  padding: 25px;
}

/* Guarantees consistent spacing between every top-level section,
   instead of relying on individual sections remembering their own
   margin-top (which a few had missed, breaking visual symmetry). */
.container > section {
  margin-top: 25px;
}

.container > section:first-child {
  margin-top: 0;
}

/* ===== Selected Coin / Manual Analysis (standalone panel, matches the
   width/spacing of other full-width panels for consistent symmetry) ===== */
.manual-analysis-panel {
  background: #161b22;
  padding: 25px;
  border-radius: 15px;
  border: 1px solid #30363d;
  margin-top: 25px;
}

.manual-analysis-panel h3 {
  color: #00d084;
  font-size: 16px;
  margin: 0 0 15px;
}

.manual-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
}

.metric-label {
  display: block;
  font-size: 12px;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric p {
  font-size: 20px;
  font-weight: 600;
  margin: 8px 0;
  word-break: break-word;
}

.metric span:not(.metric-label) {
  color: #00d084;
  font-size: 12px;
}

/* Spot & Long-Term Investment reads, within the same Manual Analysis
   panel as everything else about the analyzed coin. */
.spot-longterm-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #30363d;
}

.spot-longterm-item {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 14px 16px;
}

.spot-longterm-item .metric-label {
  color: #00d084;
  font-size: 13px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
}

.spot-longterm-text {
  font-size: 13px;
  font-weight: 400;
  color: #c9d1d9;
  margin: 8px 0 0;
  line-height: 1.5;
  word-break: break-word;
}

/* Fear & Greed, now living inside the Macro Markets 4-column row
   instead of as a separate orphaned card — matches macro-panel sizing. */
.sentiment-macro-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.sentiment-value {
  font-size: 24px;
  font-weight: 600;
  margin: 10px 0;
}

/* ===== Economic Event Headline ===== */
.event-headline-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(255, 77, 77, 0.15), rgba(255, 204, 0, 0.08));
  border: 1px solid #ff4d4d;
  border-radius: 15px;
  padding: 20px 25px;
  margin-bottom: 20px;
}

.event-headline-main {
  flex: 1 1 300px;
}

.event-headline-tag {
  display: inline-block;
  background: #ff4d4d;
  color: white;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.event-headline-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
}

.event-headline-note {
  color: #c9d1d9;
  font-size: 14px;
}

.event-headline-countdown {
  font-size: 28px;
  font-weight: 700;
  color: #ff4d4d;
  white-space: nowrap;
}

.recent-events-panel {
  margin-bottom: 20px;
}

/* ===== Macro Markets (BTC, Gold, Oil & Sentiment) ===== */
.macro-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
}

.macro-panel h3 {
  margin: 0 0 12px;
  color: #00d084;
  font-size: 15px;
}

.macro-panel .tradingview-widget-container {
  margin-bottom: 10px;
}

/* ===== AI Recommended Trade ===== */
.reco-panel {
  border-left: 4px solid #8b949e;
  transition: border-color 0.3s;
}

.reco-panel.reco-bullish { border-left-color: #00d084; }
.reco-panel.reco-bearish { border-left-color: #ff4d4d; }
.reco-panel.reco-neutral { border-left-color: #ffcc00; }

.reco-sub {
  color: #8b949e;
  font-size: 13px;
  margin: -5px 0 15px;
}

.reco-main {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.reco-left {
  flex: 1 1 320px;
  min-width: 260px;
}

.reco-right {
  flex: 0 0 220px;
  min-width: 200px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 16px;
}

.reco-level-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #21262d;
  font-size: 14px;
}

.reco-level-row:last-child {
  border-bottom: none;
}

.reco-level-row span {
  color: #8b949e;
}

.reco-level-row strong {
  color: white;
}

.reco-level-empty {
  color: #8b949e;
  font-size: 13px;
}

.runner-up-link {
  display: inline-block;
  background: #21262d;
  border: 1px solid #30363d;
  color: #c9d1d9;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 6px;
  margin: 4px 6px 4px 0;
  cursor: pointer;
}

.runner-up-link:hover {
  border-color: #00d084;
  color: #00d084;
}

.reco-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  background: #21262d;
  border: 1px solid #30363d;
  color: #00d084;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.reco-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
}

.reco-symbol {
  font-size: 24px;
  font-weight: 600;
}

.reco-direction {
  font-size: 15px;
  color: #00d084;
  font-weight: 600;
}

.reco-price {
  color: #8b949e;
  margin: 8px 0;
}

.reco-reasoning {
  margin: 10px 0 15px;
  padding-left: 20px;
}

.reco-reasoning li {
  margin: 4px 0;
}

.reco-view-btn {
  border-radius: 8px;
}

.reco-runnerups {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #30363d;
}

.reco-runnerups h4 {
  margin: 0 0 8px;
  color: #8b949e;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}

#recoRunnerUps {
  color: #c9d1d9;
  font-size: 14px;
}

#rescanBtn {
  padding: 8px 14px;
  font-size: 13px;
}

.small-refresh-btn {
  padding: 8px 14px;
  font-size: 13px;
}

/* ===== Pump/Dump Watch ===== */
.pump-dump-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: #8b949e;
  font-size: 14px;
}

.pump-dump-tag {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid;
}

.pump-dump-tag.pump {
  background: rgba(0, 208, 132, 0.12);
  border-color: #00d084;
  color: #00d084;
}

.pump-dump-tag.dump {
  background: rgba(255, 77, 77, 0.12);
  border-color: #ff4d4d;
  color: #ff4d4d;
}

.pump-dump-tag.watch {
  background: rgba(139, 148, 158, 0.12);
  border-color: #8b949e;
  color: #8b949e;
}

.pump-dump-note {
  width: 100%;
  font-size: 13px;
  color: #8b949e;
  margin-bottom: 2px;
}

#topSetupsScalpGrid {
  align-items: start;
}

#pumpDumpSection {
  align-items: start;
  grid-template-columns: 0.85fr 1.15fr; /* Funding & OI usually has more tags to show */
}

#pumpDumpSection > .panel {
  align-self: start;
  height: auto;
}

#pumpDumpSection .panel {
  padding: 18px 20px;
}

#pumpDumpSection .section-title {
  margin-bottom: 10px;
}

/* ===== Chart + AI Recommended Trade row ===== */
.chart-reco-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
  margin-top: 25px;
}

.chart {
  background: #161b22;
  padding: 25px;
  border-radius: 15px;
  border: 1px solid #30363d;
  min-height: 364px;
  display: flex;
  flex-direction: column;
}

.chart-reco-grid .chart-panel {
  margin-top: 0;
}

.chart-reco-grid .reco-panel {
  margin-top: 0;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.section-title span {
  color: #8b949e;
  font-size: 14px;
}

#tvchart {
  flex: 1;
  min-height: 301px;
  background: #0d1117;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #8b949e;
  border: 1px solid #30363d;
}

.tradingview-widget-container {
  width: 100%;
  height: 100%;
}

/* ===== News / Macro / TA / Trade plan panels ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 25px;
}

/* Daily Top Setups + Scalp Setup: force both panels to the same height
   in their row (grid already stretches by default, but this makes it
   explicit and keeps each panel's own scroll-list contained inside a
   fixed-height card rather than growing the whole row). */
.equal-height-grid {
  align-items: stretch;
}

.equal-height-grid > .panel {
  display: flex;
  flex-direction: column;
}

/* Capped-height, scrollable lists — used for anything that can grow
   long over time (persisted history, live setup lists) so one long
   list doesn't blow out the whole panel's height. */
.scroll-list {
  max-height: 340px;
  overflow-y: auto;
  padding-right: 4px;
}

.scroll-list-short {
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}

.scroll-list::-webkit-scrollbar,
.scroll-list-short::-webkit-scrollbar {
  width: 8px;
}

.scroll-list::-webkit-scrollbar-thumb,
.scroll-list-short::-webkit-scrollbar-thumb {
  background: #30363d;
  border-radius: 8px;
}

.scroll-list::-webkit-scrollbar-track,
.scroll-list-short::-webkit-scrollbar-track {
  background: transparent;
}

.panel {
  background: #161b22;
  padding: 25px;
  border-radius: 15px;
  border: 1px solid #30363d;
  overflow: hidden;
}

.panel h2 {
  margin-top: 0;
  color: #00d084;
}

.panel table {
  width: 100%;
  border-collapse: collapse;
}

.panel th {
  text-align: left;
  padding: 12px;
  color: #8b949e;
  border-bottom: 1px solid #30363d;
}

.panel td {
  padding: 12px;
  border-bottom: 1px solid #21262d;
}

.panel td:first-child {
  color: #8b949e;
  font-weight: 500;
}

.panel td:last-child {
  font-weight: 600;
}

.panel td a {
  color: #c9d1d9;
  text-decoration: underline;
  text-decoration-color: #30363d;
}

.panel td a:hover {
  color: #00d084;
}

.panel td a:visited {
  color: #8b949e;
}

.panel tr:hover {
  background: #21262d;
}

/* ===== Status colors (for future use in signals) ===== */
.status-good {
  color: #00d084;
  font-weight: 600;
}

.status-warning {
  color: #ffcc00;
  font-weight: 600;
}

.status-danger {
  color: #ff4d4d;
  font-weight: 600;
}

/* ===== Signal Log (track record) ===== */
.signal-log-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.signal-log-col h4 {
  margin: 0 0 10px;
  color: #8b949e;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}

.signal-log-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #8b949e;
  font-size: 13px;
}

.signal-row {
  background: #0d1117;
  border: 1px solid #30363d;
  border-left: 3px solid #8b949e;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: #c9d1d9;
}

.signal-row .signal-row-title {
  font-weight: 600;
  color: white;
}

.signal-row.signal-active { border-left-color: #ffcc00; }
.signal-row.signal-win { border-left-color: #00d084; }
.signal-row.signal-loss { border-left-color: #ff4d4d; }
.signal-row.signal-reversed { border-left-color: #8b949e; }
.signal-row.signal-row-reversal-pending { border-left-color: #ff4d4d; }

.reading-line {
  margin-top: 4px;
  font-size: 13px;
}

.reading-label {
  color: #8b949e;
  font-weight: 600;
}

.reading-note {
  color: #8b949e;
  font-size: 12px;
}

.reading-conclusion {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #21262d;
  font-size: 13px;
  font-weight: 600;
  color: #c9d1d9;
}

/* ===== Scrollable panels: cap visible rows, scroll for the rest ===== */
/* Funding & OI Watch entries run ~110-130px tall each (title + 2
   reading lines + conclusion) — capped at roughly 3 visible. */
#fundingOIWatchList {
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
}

/* Signal Log rows run ~70-80px each — capped at roughly 10 visible. */
#activeSignalsList,
#closedSignalsList {
  max-height: 720px;
  overflow-y: auto;
  padding-right: 4px;
}

/* Slim, dark-themed scrollbar for all of the above (WebKit browsers;
   Firefox falls back to its own default thin scrollbar). */
#fundingOIWatchList::-webkit-scrollbar,
#activeSignalsList::-webkit-scrollbar,
#closedSignalsList::-webkit-scrollbar,
.table-scroll-wrapper::-webkit-scrollbar {
  width: 8px;
}
#fundingOIWatchList::-webkit-scrollbar-track,
#activeSignalsList::-webkit-scrollbar-track,
#closedSignalsList::-webkit-scrollbar-track,
.table-scroll-wrapper::-webkit-scrollbar-track {
  background: #0d1117;
}
#fundingOIWatchList::-webkit-scrollbar-thumb,
#activeSignalsList::-webkit-scrollbar-thumb,
#closedSignalsList::-webkit-scrollbar-thumb,
.table-scroll-wrapper::-webkit-scrollbar-thumb {
  background: #30363d;
  border-radius: 4px;
}

/* Macro Calendar / Crypto News tables — capped at roughly 6 visible rows. */
.table-scroll-wrapper {
  max-height: 320px;
  overflow-y: auto;
}
.table-scroll-wrapper table {
  width: 100%;
}
.table-scroll-wrapper thead th {
  position: sticky;
  top: 0;
  background: #161b22;
  z-index: 1;
}

.reversal-alert {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(255, 77, 77, 0.12);
  border: 1px solid #ff4d4d;
  border-radius: 8px;
  color: #ffb3b3;
  font-size: 13px;
}

.reversal-btn {
  display: block;
  margin-top: 8px;
  background: #ff4d4d;
  color: white;
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 6px;
}

.reversal-btn:hover {
  opacity: 0.85;
}

.close-trade-btn {
  display: block;
  margin-top: 10px;
  background: #21262d;
  border: 1px solid #30363d;
  color: #c9d1d9;
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 6px;
}

.close-trade-btn:hover {
  border-color: #8b949e;
  opacity: 0.9;
}

#signalRatio {
  color: #00d084;
  font-weight: 600;
}

.signal-log-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.recent-trend-row {
  margin: 15px 0;
}

.trend-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  color: #8b949e;
  font-size: 13px;
}

.trend-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  cursor: default;
}

.trend-dot-win { background: #00d084; }
.trend-dot-loss { background: #ff4d4d; }
.trend-dot-reversed { background: #8b949e; }

/* ===== My Open Trades + Risk Calculator row ===== */
.trade-and-calc-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-top: 25px;
}

.open-trades-panel,
.calculator-panel {
  margin-top: 0; /* the grid supplies the top margin now */
}

#openTradesWalletDisplay {
  color: #00d084;
  font-size: 13px;
  font-weight: 600;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: #00d084;
  text-decoration: underline;
  font-weight: 600;
  font-size: inherit;
  cursor: pointer;
}

.link-btn:hover {
  opacity: 0.8;
}

/* ===== Taken-trade checkbox ===== */
.taken-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #30363d;
  font-size: 14px;
  color: #c9d1d9;
  cursor: pointer;
}

.taken-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #00d084;
  cursor: pointer;
}

.taken-checkbox-disabled {
  color: #8b949e;
  cursor: not-allowed;
}

.taken-checkbox-disabled input[type="checkbox"] {
  cursor: not-allowed;
}

/* ===== Reversal toast ===== */
.reversal-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  left: 20px;
  max-width: 420px;
  margin-left: auto;
  background: #2a1414;
  border: 1px solid #ff4d4d;
  border-radius: 10px;
  padding: 14px 16px;
  color: #ffd6d6;
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  z-index: 2000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.reversal-toast span {
  flex: 1;
}

.reversal-toast button {
  background: transparent;
  border: none;
  color: #ffd6d6;
  font-size: 16px;
  padding: 0 4px;
  cursor: pointer;
  line-height: 1;
}

/* ===== Trade modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-box {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 15px;
  padding: 25px;
  width: 90%;
  max-width: 360px;
}

.modal-box h3 {
  margin: 0 0 15px;
  color: #00d084;
}

.modal-label {
  display: block;
  font-size: 12px;
  color: #8b949e;
  margin: 12px 0 6px;
}

.modal-box input {
  width: 100%;
  padding: 10px;
  background: #0d1117;
  border: 1px solid #30363d;
  color: white;
  border-radius: 8px;
}

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

.modal-actions button {
  border-radius: 8px;
}

#modalCancelBtn {
  background: #21262d;
  color: white;
}

/* ===== Risk calculator (redesigned: direction + entry/SL/leverage/RR) ===== */
.calc-direction-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.calc-dir-btn {
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid #30363d;
  background: #0d1117;
  color: #8b949e;
  font-weight: 600;
}

.calc-dir-btn.active {
  border-color: #00d084;
  color: #00d084;
  background: rgba(0, 208, 132, 0.1);
}

.calc-inputs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 15px;
}

.calc-inputs-grid input {
  width: 100%;
}

.calc-btn-full {
  width: 100%;
  border-radius: 8px;
}

.calc-result-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #30363d;
}

.calc-result-cols p {
  margin: 4px 0 0;
  font-size: 15px;
  font-weight: 600;
  color: #00d084;
}

.calc-warning {
  margin-top: 15px;
  padding: 10px 12px;
  background: rgba(255, 77, 77, 0.12);
  border: 1px solid #ff4d4d;
  border-radius: 8px;
  color: #ff4d4d;
  font-size: 13px;
  font-weight: 600;
}

.calc-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 15px;
  flex-wrap: wrap;
  border-bottom: 1px solid #30363d;
  padding-bottom: 12px;
}

.calc-tab-btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #30363d;
  background: #0d1117;
  color: #8b949e;
  font-weight: 600;
  font-size: 13px;
}

.calc-tab-btn.active {
  border-color: #00d084;
  color: #0d1117;
  background: #00d084;
}

.scalp-alert-banner {
  position: sticky;
  top: 0;
  z-index: 999;
  background: linear-gradient(90deg, #1a2f1a, #0d1117 50%, #2f1a1a);
  border-bottom: 2px solid #00d084;
  padding: 14px 25px;
  animation: scalpPulse 1.5s ease-in-out 2;
}

@keyframes scalpPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(0, 208, 132, 0); }
  50% { box-shadow: 0 0 20px rgba(0, 208, 132, 0.6); }
}

.scalp-alert-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
}

.scalp-alert-title {
  font-weight: 700;
  font-size: 15px;
  color: white;
}

.scalp-alert-detail {
  font-size: 13px;
  color: #c9d1d9;
}

.scalp-alert-reasoning {
  font-size: 12px;
  color: #8b949e;
  width: 100%;
}

.scalp-settings {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 15px 18px;
  margin-bottom: 18px;
}

.scalp-settings-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
  color: #c9d1d9;
}

.scalp-settings-row:last-child {
  margin-bottom: 0;
}

.scalp-settings-row label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.scalp-settings-row input[type="number"] {
  background: #161b22;
  border: 1px solid #30363d;
  color: white;
  border-radius: 6px;
  padding: 4px 8px;
}

.scalp-settings-row select {
  background: #161b22;
  border: 1px solid #30363d;
  color: white;
  border-radius: 6px;
  padding: 4px 8px;
}

.scalp-subheading {
  font-size: 14px;
  color: #8b949e;
  margin: 18px 0 8px;
}

.calc-inputs {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}



.calc-inputs input {
  padding: 12px;
  background: #0d1117;
  border: 1px solid #30363d;
  color: white;
  border-radius: 8px;
}

.calc-inputs button {
  border-radius: 8px;
}

.result-box {
  margin-top: 20px;
  padding: 15px;
  background: #0d1117;
  border-radius: 10px;
  font-size: 18px;
}

.position-size-line {
  margin: 10px 0 0;
  font-size: 14px;
  color: #00d084;
}

.position-size-line:empty {
  margin: 0;
}

/* ===== Footer ===== */
footer {
  text-align: center;
  padding: 20px;
  margin-top: 20px;
  background: #161b22;
  color: #8b949e;
  border-top: 1px solid #30363d;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
  }

  .app {
    display: block;
  }

  .main {
    margin-left: 0;
    width: 100%;
  }

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

  .spot-longterm-row {
    grid-template-columns: 1fr;
  }

  .signal-log-grid {
    grid-template-columns: 1fr;
  }

  .trade-and-calc-grid {
    grid-template-columns: 1fr;
  }

  .calc-inputs-grid {
    grid-template-columns: 1fr;
  }

  .calc-result-cols {
    grid-template-columns: 1fr;
  }

  .chart-reco-grid {
    grid-template-columns: 1fr;
  }

  .reco-right {
    width: 100%;
    flex: 1 1 100%;
  }

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

  .macro-grid {
    grid-template-columns: 1fr;
  }

  .reco-top {
    flex-direction: column;
    align-items: flex-start;
  }

  header {
    flex-direction: column;
    gap: 15px;
  }

  .chart {
    height: 400px;
  }

  .calc-inputs {
    flex-direction: column;
  }
}

/* ===== Unified panel borders (same color everywhere) ===== */
.panel,
section.grid > .panel,
section > .panel,
.manual-analysis-panel,
.reco-panel,
.chart-panel,
.catalyst-panel {
  border: 1px solid #30363d;
  box-shadow: none;
}

/* ===== Catalyst Watch — scan | saved brief side by side; Grok tools bottom ===== */
.catalyst-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.catalyst-top-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: stretch;
}

.catalyst-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 12px;
  background: #0d1117;
}

.catalyst-block-title {
  font-size: 13px;
  font-weight: 600;
  color: #00d084;
  margin: 0 0 8px;
  flex-shrink: 0;
}

.catalyst-col-actions {
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

/* ~3 news cards visible, rest scrolls */
#catalystResults {
  height: 280px;
  min-height: 280px;
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 10px;
  margin: 0;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #e6edf3;
  font-size: 13px;
  line-height: 1.45;
}

/* Scan cards in two columns inside the results box */
#catalystResults.catalyst-results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  align-content: start;
}

#catalystResults .signal-log-item {
  color: #e6edf3;
  padding: 8px 10px;
  border: 1px solid #21262d;
  border-radius: 8px;
  background: #0d1117;
  margin: 0;
}

#catalystResults .reco-sub {
  color: #8b949e;
}

/* Saved brief — same height as scan; white text like scan results */
#catalystSavedBrief,
.catalyst-saved-brief {
  display: block;
  height: 280px;
  min-height: 280px;
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 14px;
  margin: 0;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #e6edf3;
  font-size: 13px;
  line-height: 1.55;
  font-weight: 500;
  white-space: normal;
  word-break: break-word;
}

#catalystSavedBrief .catalyst-brief-meta {
  color: #00d084;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
  display: block;
}

#catalystSavedBrief .catalyst-brief-heading {
  color: #00d084;
  font-weight: 700;
  font-size: 15px;
  margin: 14px 0 8px;
  letter-spacing: 0.02em;
}

#catalystSavedBrief .catalyst-brief-bullet {
  color: #e6edf3;
  padding: 3px 0 3px 2px;
  line-height: 1.5;
  font-size: 13px;
}

#catalystSavedBrief .catalyst-brief-bullet::before {
  content: "• ";
  color: #00d084;
}

#catalystSavedBrief .catalyst-brief-line {
  color: #e6edf3;
  margin: 4px 0;
  line-height: 1.5;
  font-size: 13px;
}

#catalystSavedBrief strong {
  color: #ffffff;
  font-weight: 700;
}

/* Grok X brief tools — doubled height */
.catalyst-bottom-row {
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 14px;
  background: #0d1117;
}

.catalyst-bottom-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.catalyst-textarea {
  width: 100%;
  box-sizing: border-box;
  background: #161b22;
  color: #e6edf3;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  font-family: "Cascadia Code", "Segoe UI", Poppins, sans-serif;
  resize: vertical;
  min-height: 104px;
  max-height: 200px;
  height: 120px;
}

.catalyst-textarea::placeholder {
  color: #6e7681;
}

#catalystGrokPrompt {
  color: #8b949e;
  overflow-y: auto;
}

#catalystGrokPaste {
  color: #e6edf3;
  overflow-y: auto;
}

#catalystResults::-webkit-scrollbar,
#catalystSavedBrief::-webkit-scrollbar,
.catalyst-textarea::-webkit-scrollbar {
  width: 8px;
}

#catalystResults::-webkit-scrollbar-thumb,
#catalystSavedBrief::-webkit-scrollbar-thumb,
.catalyst-textarea::-webkit-scrollbar-thumb {
  background: #484f58;
  border-radius: 4px;
}

@media (max-width: 900px) {
  .catalyst-top-row,
  .catalyst-bottom-inputs,
  #catalystResults.catalyst-results-grid {
    grid-template-columns: 1fr;
  }
  #catalystResults,
  #catalystSavedBrief {
    height: 220px;
    min-height: 220px;
    max-height: 220px;
  }
}

/* Catalyst legend — plain-language guide for subscribers */
.catalyst-legend {
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 12px 14px;
  background: #0d1117;
  margin-bottom: 4px;
}

.catalyst-legend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 14px;
  font-size: 12px;
  color: #e6edf3;
  line-height: 1.45;
}

.catalyst-legend-grid strong {
  color: #00d084;
  font-weight: 700;
}

@media (max-width: 900px) {
  .catalyst-legend-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Strategy Builder (beside Test my signal) ===== */
.strategy-tms-row {
  align-items: stretch;
}

.sb-select {
  width: 100%;
  box-sizing: border-box;
  background: #0d1117;
  color: #e6edf3;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
}

.sb-check-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  margin-top: 4px;
}

.sb-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #e6edf3;
  cursor: pointer;
  user-select: none;
  padding: 4px 6px;
  border-radius: 6px;
}

.sb-check:hover {
  background: #21262d;
}

.sb-check input {
  accent-color: #00d084;
  width: 15px;
  height: 15px;
}

.sb-score-box {
  padding: 14px 18px;
  border-radius: 10px;
  border: 1px solid #30363d;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  background: #21262d;
  color: #e6edf3;
}

.sb-score-box.sb-good {
  border-color: #00d084;
  color: #00d084;
  background: rgba(0, 208, 132, 0.08);
}

.sb-score-box.sb-mid {
  border-color: #ffcc00;
  color: #ffcc00;
  background: rgba(255, 204, 0, 0.08);
}

.sb-score-box.sb-bad {
  border-color: #ff4d4d;
  color: #ff4d4d;
  background: rgba(255, 77, 77, 0.08);
}

@media (max-width: 900px) {
  .strategy-tms-row {
    grid-template-columns: 1fr;
  }
  .sb-check-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ===== Permanent field labels (visible even when inputs have values) ===== */
.field-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #8b949e;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.field-label-inline {
  display: inline-block;
  margin-right: 6px;
  text-transform: none;
  font-size: 12px;
  color: #8b949e;
  vertical-align: middle;
}

.calc-inputs-grid .field-wrap input,
.calc-inputs-grid .field-wrap select {
  width: 100%;
}

/* Macro events two-column row */
.macro-events-row {
  margin-bottom: 16px;
}

.event-headline-banner-inline {
  display: flex !important;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  background: transparent;
  border: none;
  min-height: 80px;
}

.event-headline-panel .event-headline-title {
  font-size: 15px;
  font-weight: 600;
  color: #e6edf3;
}

.event-headline-panel .event-headline-note {
  font-size: 13px;
  color: #8b949e;
  line-height: 1.45;
}

.event-headline-panel .event-headline-tag {
  color: #ffcc00;
  font-size: 12px;
  font-weight: 700;
}

.event-headline-panel .event-headline-countdown {
  font-size: 20px;
  font-weight: 700;
  color: #00d084;
  margin-top: 6px;
}

/* Chart pattern overlay (text markers — TV embed cannot draw custom shapes) */
.chart-pattern-overlay {
  margin: 0 0 8px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #30363d;
  background: #0d1117;
  color: #e6edf3;
  font-size: 13px;
  line-height: 1.45;
}

.chart-pattern-overlay strong {
  color: #00d084;
}

.chart-pattern-overlay .cpo-tag {
  display: inline-block;
  margin: 2px 6px 2px 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: #21262d;
  border: 1px solid #30363d;
  font-size: 12px;
  color: #79c0ff;
}

/* ===== Multi-TF strip + invalidation ===== */
.multi-tf-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 10px;
}
.multi-tf-chip {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #30363d;
  font-size: 12px;
  background: #0d1117;
  color: #c9d1d9;
}
.multi-tf-chip.bull { border-color: #00d084; color: #00d084; }
.multi-tf-chip.bear { border-color: #ff4d4d; color: #ff4d4d; }
.multi-tf-chip.neutral { border-color: #8b949e; color: #8b949e; }

.invalidation-box {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #30363d;
  background: #161b22;
  font-size: 13px;
  color: #e6edf3;
  line-height: 1.45;
}
.invalidation-box strong { color: #ffcc00; }

/* Performance grid */
.perf-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.perf-stat-card {
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 12px;
  background: #0d1117;
}
.perf-stat-card .perf-val {
  font-size: 22px;
  font-weight: 700;
  color: #00d084;
}
.perf-stat-card .perf-lbl {
  font-size: 11px;
  color: #8b949e;
  text-transform: uppercase;
  margin-top: 4px;
}
@media (max-width: 900px) {
  .perf-stats-grid { grid-template-columns: 1fr 1fr; }
}
