:root {
  --bg: #0a0e14;
  --bg-elevated: #131923;
  --bg-card: #1a2130;
  --border: #2a3140;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #4a9eff;
  --accent-hover: #6ab0ff;
  --success: #3fb950;
  --danger: #f85149;
  --warning: #d29922;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

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

html, body { max-width: 100%; overflow-x: hidden; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
}

/* Menu toggle button (mobile only) */
.menu-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-sans);
}

/* Sidebar */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
}

.sidebar-header {
  padding: 0 12px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.sidebar-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.sidebar-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.nav-section {
  margin-bottom: 24px;
}

.nav-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0 12px 8px;
}

.nav a {
  display: block;
  padding: 8px 12px;
  color: var(--text);
  text-decoration: none;
  border-radius: 6px;
  font-size: 14px;
  transition: background 0.15s;
}

.nav a:hover { background: var(--bg-card); }
.nav a.active { background: var(--bg-card); color: var(--accent); font-weight: 500; }

/* Main content */
.main {
  flex: 1;
  min-width: 0;
  padding: 32px 48px;
  max-width: 100%;
  overflow-x: hidden;
}

.page-header {
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 14px;
}

/* Dashboard stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}

.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

.stat-value.positive { color: var(--success); }
.stat-value.negative { color: var(--danger); }
.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Section titles */
.section-title {
  font-size: 18px;
  font-weight: 600;
  margin: 32px 0 16px;
  color: var(--text);
}

/* Report list */
.report-list {
  display: grid;
  gap: 12px;
}

.report-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: border-color 0.15s;
  gap: 12px;
  flex-wrap: wrap;
}

.report-item:hover { border-color: var(--accent); }

.report-date { font-weight: 600; }
.report-day { color: var(--text-muted); font-size: 13px; margin-left: 8px; }

.report-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
}

.report-link:hover { color: var(--accent-hover); }

/* Report content */
.report-content {
  max-width: 900px;
  font-size: 15px;
  line-height: 1.75;
}

.report-content h1 { font-size: 26px; margin: 32px 0 16px; letter-spacing: -0.02em; }
.report-content h2 { font-size: 22px; margin: 32px 0 12px; padding-top: 24px; border-top: 1px solid var(--border); }
.report-content h3 { font-size: 18px; margin: 24px 0 10px; color: var(--accent); }
.report-content h4 { font-size: 15px; margin: 16px 0 8px; }

.report-content p { margin-bottom: 14px; }
.report-content strong { color: var(--text); font-weight: 600; }
.report-content em { color: var(--text-muted); }
.report-content ul, .report-content ol { margin: 12px 0 14px 24px; }
.report-content li { margin-bottom: 6px; }

.report-content code {
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 13px;
}

/* Scroll wrapper for markdown tables — scrolls only when needed */
.report-table-wrap {
  width: 100%;
  margin: 16px 0;
}

.report-content table {
  border-collapse: collapse;
  font-size: 14px;
  width: 100%;
}

.report-content table th {
  background: var(--bg-elevated);
  padding: 8px 10px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  white-space: nowrap;
}

.report-content table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  vertical-align: top;
}

/* Section 2 (10-col schedule table): allow the Pick column (5th) to wrap to 2 lines */
.report-content table tr > td:nth-child(5):nth-last-child(6) {
  white-space: normal;
  max-width: 260px;
  min-width: 180px;
  line-height: 1.35;
}
.report-content table tr > th:nth-child(5):nth-last-child(6) {
  white-space: normal;
}

.report-content table tr:hover td { background: var(--bg-card); }

.report-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

.report-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 8px 16px;
  color: var(--text-muted);
  margin: 16px 0;
  background: var(--bg-card);
  border-radius: 0 6px 6px 0;
}

.report-content a { color: var(--accent); text-decoration: none; }
.report-content a:hover { text-decoration: underline; }

/* Standalone tables (history, statistics) */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 12px 0 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
}

.table-scroll table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 500px;
}

.table-scroll th {
  background: var(--bg-elevated);
  padding: 10px 12px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  white-space: nowrap;
}

.table-scroll td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table-scroll tr:last-child td { border-bottom: none; }
.table-scroll tr:hover td { background: var(--bg-elevated); }

/* Stats table (label + value pairs) */
.stats-table {
  width: 100%;
}

.stats-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.stats-table tr:last-child td { border-bottom: none; }

.stats-table .label {
  color: var(--text-muted);
  font-size: 14px;
}

.stats-table .value {
  font-family: var(--font-mono);
  font-weight: 600;
  text-align: right;
  font-size: 15px;
}

.stats-table .value.positive { color: var(--success); }
.stats-table .value.negative { color: var(--danger); }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.badge-win { background: rgba(63, 185, 80, 0.15); color: var(--success); }
.badge-loss { background: rgba(248, 81, 73, 0.15); color: var(--danger); }
.badge-push { background: rgba(210, 153, 34, 0.15); color: var(--warning); }

/* Footer */
.footer {
  margin-top: 60px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

/* Mobile */
@media (max-width: 768px) {
  body {
    flex-direction: column;
    overflow-x: hidden;
  }

  .menu-toggle {
    display: block;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 90;
    max-height: 100vh;
    overflow-y: auto;
    transform: translateY(-100%);
    transition: transform 0.2s ease;
    padding-top: 60px;
  }

  .sidebar.open {
    transform: translateY(0);
  }

  .main {
    padding: 60px 12px 20px;
    width: 100%;
    max-width: 100vw;
  }

  .page-header { margin-bottom: 20px; padding-bottom: 12px; }
  .page-title { font-size: 22px; }
  .page-subtitle { font-size: 13px; }
  .stat-value { font-size: 22px; }
  .stat-card { padding: 14px; }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 24px;
  }

  .section-title { font-size: 16px; margin: 24px 0 12px; }

  .report-content { font-size: 14px; line-height: 1.65; }
  .report-content h1 { font-size: 20px; }
  .report-content h2 { font-size: 18px; }
  .report-content h3 { font-size: 16px; }

  .report-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .table-scroll table { min-width: 100%; font-size: 13px; }
  .table-scroll th, .table-scroll td { padding: 6px 8px; }

  .stats-table td { padding: 8px 10px; font-size: 13px; }
  .stats-table .value { font-size: 13px; }

  /* Report tables on mobile: compact fonts, scroll via wrapper */
  .report-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .report-content table {
    font-size: 11px;
    width: auto;
    min-width: 100%;
  }
  .report-content table th,
  .report-content table td {
    padding: 5px 7px;
  }
  .report-content pre {
    overflow-x: auto;
    max-width: 100%;
  }
  .report-content code {
    word-break: break-all;
    white-space: pre-wrap;
  }
}

@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr; }
}
