* {
  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;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #484f58 #161b22;
}
.sidebar::-webkit-scrollbar {
  width: 8px;
}
.sidebar::-webkit-scrollbar-track {
  background: #161b22;
}
.sidebar::-webkit-scrollbar-thumb {
  background: #484f58;
  border-radius: 4px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: #6e7681;
}

.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: 2px solid #ffffff;
  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;
}

.bt-disclaimer {
  color: #6e7681;
  font-size: 11px;
  font-style: italic;
  line-height: 1.4;
  margin: 6px 0 0;
}

.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-htf-warning {
  background: rgba(255, 204, 0, 0.1);
  border: 1px solid #ffcc00;
  color: #ffcc00;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  margin: 8px 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;
}

/* A6-MM1 — owner-operated manual macro workflow. */
.manual-macro-owner-panel {
  border-color: #2f81f7;
}

.manual-macro-local-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  border: 1px solid #2f81f7;
  border-radius: 999px;
  color: #58a6ff;
  font-size: 10px;
  vertical-align: middle;
}

.manual-macro-summary,
.manual-macro-preview,
.manual-macro-status {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #0d1117;
  color: #c9d1d9;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.manual-macro-textarea {
  box-sizing: border-box;
  width: 100%;
  margin: 5px 0 10px;
  padding: 10px;
  resize: vertical;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #0d1117;
  color: #e6edf3;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.manual-macro-prompt-workflow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
}

.manual-macro-check {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin: 8px 0;
  color: #c9d1d9;
  font-size: 13px;
  line-height: 1.45;
}

.manual-macro-check input {
  margin-top: 3px;
}

.manual-macro-preview-summary {
  margin: 0 0 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #c9d1d9;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.manual-macro-event-list {
  display: grid;
  gap: 8px;
}

.manual-macro-event-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #0d1117;
}

.manual-macro-event-main,
.manual-macro-event-side {
  display: flex;
  gap: 6px;
}

.manual-macro-event-main {
  min-width: 0;
  flex-direction: column;
}

.manual-macro-event-side {
  align-items: flex-end;
  flex-direction: column;
  text-align: right;
}

.manual-macro-event-title {
  color: #e6edf3;
  overflow-wrap: anywhere;
}

.manual-macro-event-stored-time,
.manual-macro-event-temporal,
.manual-macro-event-empty {
  color: #8b949e;
  font-size: 12px;
}

.manual-macro-event-source {
  color: #58a6ff;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.manual-macro-event-empty {
  padding: 12px;
  border: 1px dashed #30363d;
  border-radius: 8px;
}

.manual-macro-event-upcoming .manual-macro-event-temporal {
  color: #58a6ff;
}

.manual-macro-impact {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  background: #21262d;
  color: #c9d1d9;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.manual-macro-impact-high { color: #ff7b72; }
.manual-macro-impact-medium { color: #d29922; }
.manual-macro-impact-low { color: #3fb950; }

.manual-macro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

.manual-macro-actions button {
  width: auto;
}

.manual-macro-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.manual-macro-grid > div {
  padding: 12px;
  border: 1px solid #30363d;
  border-radius: 8px;
}

.manual-macro-danger {
  border-color: #f85149 !important;
  color: #ff7b72 !important;
}

.manual-macro-status:empty {
  display: none;
}

@media (max-width: 800px) {
  .manual-macro-grid {
    grid-template-columns: 1fr;
  }

  .manual-macro-prompt-workflow,
  .manual-macro-event-row {
    grid-template-columns: 1fr;
  }

  .manual-macro-event-side {
    align-items: flex-start;
    text-align: left;
  }
}

/* ===== 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: 2px solid #ffffff;
  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;
}

/* W8 §9 footer links */
.footer-links {
  margin-top: 8px;
  font-size: 12.5px;
  line-height: 1.9;
}
.footer-links a {
  color: #8b949e;
  text-decoration: underline;
}
.footer-links a:hover {
  color: #e6edf3;
}

/* W8 §10 signed-out hero */
.hero-panel {
  border: 1px solid #238636;
}
.hero-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.hero-title {
  margin: 0;
  color: #e6edf3;
}
.hero-badge {
  background: #238636;
  color: #fff;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
}
.hero-text {
  margin: 10px 0 12px;
  color: #c9d1d9;
  line-height: 1.6;
}
.hero-signin {
  min-height: 44px;
}
.hero-risk a,
.about-faq a {
  color: #58a6ff;
}
.about-faq {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.6;
}
.about-faq p {
  margin: 0 0 10px;
}

/* W8 §12 sidebar menu toggle: hidden on desktop (menu always open) */
.sidebar-menu > summary {
  display: none;
}
.sidebar-menu > summary::-webkit-details-marker {
  display: none;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    padding: 12px 15px;
  }
  .sidebar .logo p {
    margin-bottom: 8px;
  }
  /* W8 rev2 (F-5): sidebar logo already shows the brand on small
     screens — hide the duplicate header brand. */
  header .brand {
    display: none;
  }
  /* W8 M-1: the link list sits behind a Menu toggle on small screens */
  .sidebar-menu > summary {
    display: block;
    list-style: none;
    cursor: pointer;
    text-align: center;
    padding: 10px 12px;
    border: 1px solid #30363d;
    border-radius: 8px;
    color: #e6edf3;
    font-weight: 600;
  }
  .sidebar-menu > summary:focus-visible {
    outline: 2px solid #58a6ff;
    outline-offset: 2px;
  }
  .sidebar-menu[open] > nav {
    margin-top: 12px;
  }

  .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: 2px solid #ffffff;
  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;
}

/* This row has THREE panels (Test my signal, Strategy Builder,
   Strategy Backtest) inside a fixed 2-column grid — the third one was
   landing alone in row 2 with an empty cell beside it, which is what
   actually showed up as "blank space on the right." Since it's alone
   in its row anyway, spanning the full width uses that space properly
   instead of leaving it empty. */
#backtestPanel {
  grid-column: 1 / -1;
}

.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);
}

.sb-score-box.sb-marginal {
  border-color: #ff9f40;
  color: #ff9f40;
  background: rgba(255, 159, 64, 0.08);
}

/* Backtest metrics reuse .sb-score-box's border/bg but lay out as a grid
   of stat pairs instead of one centered line. */
#btMetricsBox {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px 18px;
  text-align: left;
  font-weight: 400;
  font-size: 14px;
}
#btMetricsBox strong {
  display: block;
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 2px;
}

.mq-state-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  border: 1px solid #30363d;
  background: #21262d;
  color: #8b949e;
}
.mq-state-badge.status-good {
  border-color: #00d084;
  color: #00d084;
  background: rgba(0, 208, 132, 0.08);
}
.mq-state-badge.status-warning {
  border-color: #ffcc00;
  color: #ffcc00;
  background: rgba(255, 204, 0, 0.08);
}
.mq-state-badge.status-danger {
  border-color: #ff4d4d;
  color: #ff4d4d;
  background: rgba(255, 77, 77, 0.08);
}

/* Phase 2: Decision Intelligence (Reasons For/Against, Trade
   Readiness, What Changed) — sits under the AI Signal Scorecard on
   Manual Analyze. */
.decision-intelligence-panel {
  border: 2px solid #ffffff;
  border-radius: 10px;
  padding: 14px 16px;
  background: #161b22;
}
.di-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 700px) {
  .di-grid { grid-template-columns: 1fr; }
}
.di-subhead {
  font-size: 12px;
  font-weight: 700;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin: 0 0 6px;
}
.di-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.5;
}
.di-list.di-for li { color: #00d084; }
.di-list.di-against li { color: #ff4d4d; }
.di-list.di-changed-list li { color: #c9d1d9; }
.di-readiness {
  display: grid;
  gap: 4px;
}
.di-readiness-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 12px;
  padding: 3px 0;
  border-bottom: 1px solid #21262d;
}
.di-readiness-label {
  min-width: 120px;
  color: #e6edf3;
  font-weight: 600;
}
.di-readiness-detail {
  color: #8b949e;
}

@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;
  /* Overrides equal-height-grid's align-items:stretch specifically for
     this row — "Upcoming High-Impact Event" was being force-stretched
     to match "Last & Next"'s height even when it had almost nothing
     to show ("No high-impact event..."). Each panel now sizes to its
     own content: short when quiet, taller when there's a real event
     or a longer event list. The other two rows using equal-height-grid
     (Daily Top/Scalp Setup, Strategy Builder/Backtest) keep the
     original stretch behavior, which is what those actually want. */
  align-items: start;
}

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

.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; }
}

/* Phase 5: Learning section */
.learning-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  margin-top: 12px;
}
@media (max-width: 800px) {
  .learning-layout { grid-template-columns: 1fr; }
}
.learning-sidebar {
  border-right: 1px solid #21262d;
  padding-right: 16px;
  height: 480px;
  max-height: 480px;
  min-height: 0;
  align-self: start;
  overflow-y: scroll;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #484f58 #0d1117;
}
.learning-sidebar::-webkit-scrollbar {
  width: 10px;
}
.learning-sidebar::-webkit-scrollbar-track {
  background: #0d1117;
}
.learning-sidebar::-webkit-scrollbar-thumb {
  background: #484f58;
  border-radius: 5px;
  border: 2px solid #0d1117;
}
.learning-sidebar::-webkit-scrollbar-thumb:hover {
  background: #6e7681;
}
@media (max-width: 800px) {
  .learning-sidebar { border-right: none; border-bottom: 1px solid #21262d; padding-right: 0; padding-bottom: 12px; height: 200px; max-height: 200px; }
}
.learning-lesson-link {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: #c9d1d9;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1.4;
}
.learning-lesson-link:hover {
  background: #21262d;
}
.learning-lesson-link.active {
  background: rgba(0, 208, 132, 0.1);
  color: #00d084;
  font-weight: 600;
}
.learning-content {
  min-width: 0;
}

/* Phase 6: ZAIN Academy rebuild — diagrams, mini challenges, related
   tools, idea callout, and the AI Mentor banner. */
.learning-diagram {
  width: 100%;
  max-width: 380px;
  display: block;
  margin: 8px auto 14px;
}

.learning-idea {
  font-size: 14px;
  font-weight: 600;
  color: #e6edf3;
  background: #161b22;
  border-left: 3px solid #3fb1ff;
  padding: 8px 12px;
  border-radius: 4px;
  margin: 0 0 12px;
}

.learning-challenge {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 10px 12px;
}

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

.learning-tool-link {
  background: #21262d;
  border: 1px solid #30363d;
  color: #3fb1ff;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}
.learning-tool-link:hover {
  background: #30363d;
}

.ai-mentor-banner {
  position: sticky;
  top: 0;
  z-index: 998;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  background: linear-gradient(90deg, #1a2417, #0d1117 50%, #1a2417);
  border-bottom: 2px solid #ffcc00;
  padding: 12px 20px;
  font-size: 13px;
  color: #e6edf3;
}
.ai-mentor-banner button {
  background: #21262d;
  border: 1px solid #ffcc00;
  color: #ffcc00;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
}
#aiMentorDismissBtn {
  border-color: #8b949e;
  color: #8b949e;
}

/* Phase 6.1: Visual-first lesson upgrade — teaching blocks, icons,
   comparisons, choice challenges, ZAIN usage box, next-lesson button. */
.learning-teach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 10px 0 14px;
}
.learning-teach-block {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}
.learning-icon {
  width: 40px;
  height: 36px;
  display: block;
  margin: 0 auto 6px;
}
.learning-teach-text {
  font-size: 12px;
  line-height: 1.45;
  color: #c9d1d9;
  margin: 0;
}

.learning-comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 600px) {
  .learning-comparison-grid { grid-template-columns: 1fr; }
}
.learning-comparison-card {
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  border: 1px solid #30363d;
  background: #161b22;
}
.learning-comparison-card.good { border-color: #00d084; }
.learning-comparison-card.bad { border-color: #ff4d4d; }
.learning-comparison-card.neutral { border-color: #3fb1ff; }
.learning-comparison-badge {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 6px;
}
.learning-comparison-card.good .learning-comparison-badge { color: #00d084; }
.learning-comparison-card.bad .learning-comparison-badge { color: #ff4d4d; }
.learning-comparison-badge.neutral { color: #3fb1ff; }
.learning-comparison-card p {
  font-size: 12px;
  color: #c9d1d9;
  margin: 6px 0 0;
  line-height: 1.4;
}

.learning-mini-badge {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}
.learning-mini-badge.good { background: rgba(0,208,132,0.12); color: #00d084; }
.learning-mini-badge.bad { background: rgba(255,77,77,0.12); color: #ff4d4d; }

.learning-choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.learning-choice-btn {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  text-align: center;
  flex: 1;
  min-width: 130px;
}
.learning-choice-btn:hover {
  border-color: #3fb1ff;
}
.learning-choice-label {
  display: block;
  font-size: 11px;
  color: #8b949e;
  margin-bottom: 4px;
}

.learning-zain-usage {
  background: rgba(63, 177, 255, 0.06);
  border: 1px solid #3fb1ff;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
}
.learning-zain-usage p { margin: 0 0 6px; }

.learning-next-row {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #21262d;
}
.learning-next-btn {
  border-color: #00d084;
  color: #00d084;
}

/* Phase 6.2: Visual Excellence Pass — cause-effect flow diagrams and
   the live scorecard mockup. */
.learning-flow-scroll {
  overflow-x: auto;
  padding-bottom: 4px;
}
.learning-flow-diagram {
  max-width: none;
  height: 60px;
  width: auto;
  display: block;
  margin: 0;
}
.learning-cause-effect {
  margin: 4px 0 14px;
}

.learning-scorecard-mockup {
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 4px;
}
.learning-mockup-title {
  font-size: 10px;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin: 0 0 6px;
}
.learning-mockup-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 12px;
  padding: 3px 0;
  border-bottom: 1px solid #161b22;
}
.learning-mockup-row:last-child { border-bottom: none; }
.learning-mockup-label {
  min-width: 110px;
  color: #e6edf3;
  font-weight: 600;
}
.learning-mockup-detail {
  color: #8b949e;
}

/* Academy final audit fix: inline code styling for backtick-wrapped
   function names in zainUsage text (previously rendered as literal
   backtick characters — genuine display bug, not a content change). */
.learning-inline-code {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 3px;
  padding: 1px 5px;
  font-family: "Courier New", monospace;
  font-size: 11px;
  color: #3fb1ff;
}

/* Phase 6: Workspaces tab bar */
.workspace-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 25px 0;
  position: sticky;
  top: 0;
  z-index: 50;
  background: #0d1117;
}
.workspace-tab {
  background: #161b22;
  border: 1px solid #30363d;
  color: #8b949e;
  border-radius: 8px 8px 0 0;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.workspace-tab:hover {
  background: #21262d;
  color: #e6edf3;
}
.workspace-tab.active {
  background: #0d1117;
  border-color: #00d084;
  border-bottom-color: #0d1117;
  color: #00d084;
}
@media (max-width: 700px) {
  .workspace-tabs { padding: 10px 12px 0; }
  .workspace-tab { padding: 8px 12px; font-size: 12px; }
}

/* Phase 6: generic per-panel expand button + full-screen modal */
.panel {
  position: relative;
}
.panel-expand-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(33, 38, 45, 0.85);
  border: 1px solid #30363d;
  color: #6e7681;
  border-radius: 5px;
  width: 22px;
  height: 22px;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  z-index: 5;
}
.panel-expand-btn:hover {
  border-color: #00d084;
  color: #00d084;
}
.panel-expand-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 999;
  display: none;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 30px 20px;
}
.panel-expand-overlay.open {
  display: flex;
}
.panel-expand-box {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  max-width: 1100px;
  width: 100%;
  padding: 24px 28px;
  position: relative;
}
.panel-expand-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: #21262d;
  border: 1px solid #30363d;
  color: #e6edf3;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  font-size: 16px;
  cursor: pointer;
}
.panel-expand-close:hover {
  border-color: #ff4d4d;
  color: #ff4d4d;
}

/* ===== Phase 3: entitlement lock overlay + Owner panel ===== */
.entitlement-locked {
  position: relative;
  min-height: 120px;
  overflow: hidden;
}
.entitlement-locked > *:not(.entitlement-lock-overlay) {
  filter: blur(3px);
  pointer-events: none;
  user-select: none;
}
/* W8 §6 / §4.0 labels */
.hypothetical-badge {
  display: inline-block;
  margin: 0 0 8px;
  padding: 3px 8px;
  border: 1px solid #d29922;
  border-radius: 6px;
  color: #d29922;
  font-size: 12px;
  font-weight: 600;
}
.agreement-label {
  margin: 0 0 6px !important;
  font-style: italic;
}

/* W8 W-1: uniform muted look for controls inside a locked panel and
   for the locked header Analyze entry point. */
.entitlement-muted,
.entitlement-muted:hover {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.6);
}
.entitlement-lock-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 16px;
  background: rgba(13, 17, 23, 0.72);
  border-radius: 10px;
}
.entitlement-lock-icon {
  font-size: 26px;
}
.entitlement-lock-title {
  font-weight: 600;
  color: #e6edf3;
  font-size: 15px;
}
.entitlement-lock-sub {
  color: #8b949e;
  font-size: 12.5px;
  max-width: 320px;
}
.entitlement-lock-cta {
  background: #238636;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
}
.entitlement-lock-cta:hover {
  background: #2ea043;
}

#ownerUserListContainer .owner-user-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  border-bottom: 1px solid #21262d;
  font-size: 12.5px;
}
#ownerUserListContainer .owner-user-row button {
  background: #21262d;
  border: 1px solid #30363d;
  color: #e6edf3;
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 11.5px;
  cursor: pointer;
}
#ownerUserListContainer .owner-user-row button:hover {
  border-color: #58a6ff;
}
.owner-role-badge {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #21262d;
  border: 1px solid #30363d;
}
.owner-role-badge.role-owner { color: #d29922; border-color: #d29922; }
.owner-role-badge.role-subscriber { color: #2ea043; border-color: #2ea043; }
.owner-role-badge.role-free { color: #8b949e; }
