:root {
  color-scheme: light;
  --bg: #f7f8f5;
  --ink: #18201c;
  --muted: #627066;
  --panel: #ffffff;
  --line: #dfe5dc;
  --line-strong: #c5d0c3;
  --green: #167a5b;
  --green-soft: #dcefe6;
  --red: #b33b3b;
  --red-soft: #f5dddd;
  --amber: #b46b12;
  --amber-soft: #f6ead8;
  --blue: #2e6478;
  --blue-soft: #dfedf1;
  --shadow: 0 18px 45px rgba(24, 32, 28, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 14px clamp(18px, 4vw, 52px);
  border-bottom: 1px solid rgba(197, 208, 195, 0.75);
  background: rgba(247, 248, 245, 0.92);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  min-width: 220px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  object-fit: cover;
  box-shadow: 0 8px 20px rgba(24, 32, 28, 0.08);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.topnav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.topnav a {
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

.topnav a:hover,
.topnav a:focus-visible {
  background: var(--panel);
  color: var(--ink);
  outline: none;
}

main {
  width: min(1220px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 34px 0 72px;
  min-width: 0;
}

.dashboard-head {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 28px;
  align-items: stretch;
  min-height: 310px;
}

.headline {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(22px, 4vw, 42px) 0;
  min-width: 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin-bottom: 18px;
  font-size: 84px;
  line-height: 0.96;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

h2 {
  margin-bottom: 0;
  font-size: 38px;
  line-height: 1.05;
  letter-spacing: 0;
}

h3 {
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0;
}

.dek,
.section-copy {
  max-width: 720px;
  color: var(--muted);
  font-size: 17px;
  overflow-wrap: anywhere;
}

.market-visual {
  position: relative;
  overflow: hidden;
  min-height: 300px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(22, 122, 91, 0.12), rgba(46, 100, 120, 0.08)),
    var(--panel);
  box-shadow: var(--shadow);
}

.pulse-grid {
  position: absolute;
  inset: 18px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 10px;
}

.pulse-grid span {
  border: 1px solid rgba(24, 32, 28, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

.pulse-grid span:nth-child(2),
.pulse-grid span:nth-child(7),
.pulse-grid span:nth-child(9) {
  background: var(--green-soft);
  border-color: rgba(22, 122, 91, 0.28);
}

.pulse-grid span:nth-child(4),
.pulse-grid span:nth-child(11) {
  background: var(--amber-soft);
  border-color: rgba(180, 107, 18, 0.3);
}

.pulse-grid span:nth-child(6) {
  background: var(--red-soft);
  border-color: rgba(179, 59, 59, 0.24);
}

.visual-copy {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 28px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid rgba(197, 208, 195, 0.8);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.visual-copy strong {
  font-size: 58px;
  line-height: 0.9;
}

.visual-copy span {
  max-width: 150px;
  color: var(--muted);
  font-size: 14px;
  text-align: right;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 16px 0 18px;
}

.metric {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin: 6px 0;
  font-size: 38px;
  line-height: 1;
}

.notice {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 0 0 24px;
  padding: 14px 16px;
  border: 1px solid rgba(180, 107, 18, 0.28);
  border-radius: 8px;
  background: var(--amber-soft);
  color: #4a3214;
}

.section-band {
  margin-top: 26px;
  padding: clamp(22px, 4vw, 32px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  min-width: 0;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.section-heading > p,
#dataTimestamp {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  text-align: right;
}

.split {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1.28fr);
  gap: 26px;
}

.recommendation-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.rec-card {
  display: grid;
  gap: 16px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.rec-card header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.ticker {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 4px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.side {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 28px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.side.yes {
  background: var(--green-soft);
  color: var(--green);
}

.side.no {
  background: var(--red-soft);
  color: var(--red);
}

.rec-card h3 {
  margin-bottom: 0;
}

.pick-banner {
  display: grid;
  gap: 4px;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
}

.pick-banner.yes {
  border-color: rgba(22, 122, 91, 0.28);
  background: var(--green-soft);
}

.pick-banner.no {
  border-color: rgba(179, 59, 59, 0.24);
  background: var(--red-soft);
}

.pick-kicker,
.history-result span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.pick-banner strong {
  font-size: 34px;
  line-height: 1;
}

.pick-banner small {
  color: var(--muted);
  font-size: 14px;
}

.pick-copy,
.history-copy,
.history-threshold {
  margin: 0;
  color: #344038;
  font-size: 15px;
}

.history-threshold {
  color: var(--blue);
  font-weight: 800;
}

.rec-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.rec-meta div,
.details-grid div,
.threshold-panel div,
.history-result,
.perf-list div {
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
  background: #f4f6f2;
}

.rec-meta span,
.details-grid span,
.threshold-panel span,
.perf-list dt {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.rec-meta strong,
.details-grid strong,
.threshold-panel strong,
.perf-list dd {
  margin: 2px 0 0;
  font-weight: 800;
}

.threshold-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.rationale {
  margin: 0;
  color: #344038;
}

.risk-list,
.source-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.risk-list li {
  padding-left: 12px;
  border-left: 3px solid var(--amber);
  color: #4f4538;
}

.source-list a {
  color: var(--blue);
  overflow-wrap: anywhere;
}

.rec-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rec-actions a,
.rec-actions button,
.history-controls button,
.dialog-close {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.rec-actions a.primary {
  border-color: var(--ink);
  background: var(--ink);
  color: #ffffff;
}

.rec-actions button:hover,
.history-controls button:hover,
.dialog-close:hover,
.rec-actions a:hover {
  border-color: var(--ink);
}

.rec-actions button.secondary {
  color: var(--blue);
}

.detail-body {
  display: grid;
  gap: 16px;
  padding-top: 10px;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.detail-section {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.detail-section h4 {
  margin: 0;
  font-size: 15px;
}

.detail-section p,
.detail-note {
  margin: 0;
  color: #344038;
  overflow-wrap: anywhere;
}

.detail-note {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.history-list {
  display: grid;
  gap: 12px;
}

.history-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.history-main {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.history-title {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.history-title h3 {
  margin: 0;
  font-size: 18px;
}

.history-title p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.history-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.history-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.history-controls span {
  color: var(--muted);
  font-size: 13px;
}

.details-dialog {
  width: min(860px, calc(100vw - 28px));
  height: min(86dvh, 920px);
  max-height: min(86dvh, 920px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 28px 80px rgba(24, 32, 28, 0.26);
}

.details-dialog::backdrop {
  background: rgba(24, 32, 28, 0.48);
}

.dialog-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  margin: 10px 0 6px;
  font-size: 28px;
}

.dialog-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.dialog-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
}

.bet-id {
  display: inline-grid;
  gap: 4px;
}

.bet-id span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.bet-id code {
  display: inline-flex;
  max-width: 100%;
  padding: 4px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.search,
.select {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.search input,
.select select {
  height: 38px;
  min-width: 170px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 10px;
}

.search input {
  min-width: min(320px, 72vw);
}

.table-shell {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  background: #ffffff;
}

th,
td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #f8faf6;
}

.table-title {
  display: grid;
  gap: 5px;
}

.table-title strong {
  max-width: 480px;
}

.table-title small,
.muted {
  color: var(--muted);
}

.status {
  display: inline-flex;
  align-items: center;
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status.open {
  background: var(--blue-soft);
  color: var(--blue);
}

.status.won {
  background: var(--green-soft);
  color: var(--green);
}

.status.lost {
  background: var(--red-soft);
  color: var(--red);
}

.status.error {
  background: #ece7df;
  color: #6b5740;
}

.money-positive {
  color: var(--green);
}

.money-negative {
  color: var(--red);
}

.empty-state {
  margin: 18px 0 0;
  color: var(--muted);
}

.performance-panel {
  display: grid;
  gap: 16px;
}

.result-bars {
  display: grid;
  grid-template-columns: var(--wins, 1fr) var(--losses, 1fr) var(--open, 1fr);
  min-height: 52px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f6f2;
}

.result-bars span {
  display: grid;
  place-items: center;
  min-width: 54px;
  padding: 10px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.result-bars .wins {
  background: var(--green);
}

.result-bars .losses {
  background: var(--red);
}

.result-bars .open {
  background: var(--blue);
}

.perf-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.text-stack {
  display: grid;
  gap: 14px;
}

.text-stack p {
  margin: 0;
  color: #344038;
}

code {
  padding: 2px 5px;
  border-radius: 5px;
  background: #eef1ed;
  color: #24342c;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.94em;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  width: min(1220px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 42px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 920px) {
  .topbar,
  .section-heading,
  .notice,
  .history-main,
  .footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .topnav,
  .history-badges,
  .toolbar {
    justify-content: flex-start;
    width: 100%;
  }

  .dashboard-head,
  .split,
  .recommendation-list {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-heading > p,
  #dataTimestamp {
    text-align: left;
  }
}

@media (max-width: 620px) {
  main {
    width: min(calc(100vw - 24px), 1220px);
    padding-top: 20px;
  }

  .dashboard-head {
    min-height: auto;
  }

  .headline {
    padding: 14px 0 18px;
  }

  h1 {
    font-size: 40px;
    line-height: 1;
  }

  h2 {
    font-size: 30px;
  }

  .metric strong {
    font-size: 32px;
  }

  .topnav {
    gap: 2px;
  }

  .topnav a {
    padding: 7px 8px;
    font-size: 13px;
  }

  .market-visual {
    display: none;
  }

  .pulse-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(6, 1fr);
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric {
    padding: 14px;
  }

  .rec-meta,
  .details-grid,
  .threshold-panel,
  .perf-list {
    grid-template-columns: 1fr;
  }

  .dialog-head {
    flex-direction: column;
  }

  .visual-copy {
    align-items: start;
    flex-direction: column;
  }

  .visual-copy span {
    max-width: none;
    text-align: left;
  }
}
