:root {
  --bg: #f3f6fa;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --text: #111827;
  --muted: #667085;
  --line: #d8dee8;
  --navy: #17243a;
  --blue: #2563eb;
  --green: #168a54;
  --orange: #c46a16;
  --red: #ba3b37;
  --watch: #8a5a00;
  --shadow: 0 18px 45px rgba(17, 24, 39, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

button,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px;
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 850;
}

.brand h1,
.topbar h2,
.section-heading h3,
.pick-card h4,
.history-card h4,
.method-card h3 {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.15;
}

.brand p,
.scope-note {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  line-height: 1.35;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-link {
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: rgba(255, 255, 255, 0.76);
  text-align: left;
  padding: 12px 14px;
  cursor: pointer;
}

.nav-link:hover,
.nav-link.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.scope-note {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot,
.pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #31c48d;
  flex: none;
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 24px;
}

.topbar h2 {
  font-size: 28px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 850;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sync-meta {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.primary-action,
.secondary-action,
.ghost-action {
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 800;
}

.primary-action {
  border: 0;
  background: var(--navy);
  color: #fff;
  padding: 11px 16px;
}

.secondary-action,
.ghost-action {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 9px 12px;
}

.primary-action:disabled {
  opacity: 0.65;
  cursor: wait;
}

.view {
  display: none;
}

.view.is-visible {
  display: grid;
  gap: 22px;
}

.content-section,
.decision-banner,
.notice,
.error-panel,
.chart-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.content-section {
  padding: 22px;
  display: grid;
  gap: 16px;
}

.decision-banner {
  padding: 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 520px);
  gap: 18px;
  align-items: center;
}

.decision-status {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.decision-status strong {
  font-size: 28px;
  line-height: 1.1;
}

.decision-status span:last-child {
  color: var(--muted);
}

.decision-status.is-error .pulse-dot {
  background: var(--red);
}

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

.compact-metric {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.compact-metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.compact-metric strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.section-copy,
.fine-print {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 26px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 850;
}

.badge.best {
  color: #07613a;
  background: #dff5eb;
}

.badge.value {
  color: #174ea6;
  background: #e2ebff;
}

.badge.safe {
  color: #8a4708;
  background: #fff0dc;
}

.badge.watch {
  color: #6f3b00;
  background: #fff3d6;
}

.badge.neutral {
  color: #475467;
  background: #edf1f5;
}

.badge.negative {
  color: #8a1f1c;
  background: #fde7e6;
}

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

.featured-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 430px));
}

.pick-card,
.metric-card,
.history-card,
.method-card,
.split-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.pick-card {
  min-width: 0;
  padding: 18px;
  display: grid;
  gap: 13px;
}

.official-card {
  border-top: 5px solid var(--blue);
}

.watchlist-card {
  border-color: #f0c36d;
  border-top: 5px solid #d08b11;
  background: #fffdf8;
}

.card-topline {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}

.time-pill {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.pick-card h4 {
  font-size: 19px;
  line-height: 1.24;
  overflow-wrap: anywhere;
}

.card-sub {
  color: var(--muted);
  font-size: 13px;
}

.pick-focus {
  display: grid;
  grid-template-columns: minmax(82px, 1fr) minmax(92px, 1.15fr) minmax(76px, 0.75fr);
  gap: 10px;
}

.pick-focus div,
.reason-box,
.confidence-strip,
.detail-item {
  background: var(--surface-soft);
  border-radius: var(--radius);
  padding: 10px;
}

.pick-focus span,
.reason-box span,
.confidence-strip span,
.detail-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.pick-focus strong,
.reason-box strong,
.confidence-strip strong,
.detail-item strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}

.odds-box {
  background: var(--navy) !important;
  color: #fff;
}

.odds-box span {
  color: rgba(255, 255, 255, 0.72);
}

.odds-box strong {
  font-size: 20px;
}

.watch-proximity {
  border: 1px solid #f0c36d;
  border-radius: var(--radius);
  background: #fff8e8;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.watch-proximity span,
.reason-box small {
  color: var(--muted);
  font-size: 13px;
}

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

.metric-card {
  padding: 18px;
}

.metric-card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.metric-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 850;
}

.metric-value {
  margin: 0;
  font-size: 25px;
  font-weight: 850;
}

.metric-sub {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.progress-block {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.progress-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.progress-track {
  height: 12px;
  border-radius: 999px;
  background: #e1e7ef;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--blue);
}

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

.milestone {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.milestone.is-done {
  color: #07613a;
  border-color: #94d7b8;
  background: #ecfbf4;
}

.system-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.system-row {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.system-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.system-row strong {
  display: block;
  margin-top: 4px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

select {
  min-width: 150px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
}

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

.history-card {
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 14px;
  align-items: center;
}

.history-card h4 {
  margin-top: 8px;
  font-size: 17px;
}

.history-card p {
  margin: 6px 0 0;
  color: var(--muted);
}

.history-result {
  display: grid;
  justify-items: end;
  gap: 4px;
  text-align: right;
}

.history-result strong {
  font-size: 18px;
}

.history-result span,
.history-result small {
  color: var(--muted);
}

.chart-panel {
  padding: 18px;
}

.chart-panel svg {
  display: block;
  width: 100%;
  height: 260px;
}

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

.split-card,
.method-card {
  padding: 16px;
}

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

.split-card span:not(.badge) {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.method-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.empty-state {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 22px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.62);
}

.empty-state-rich {
  display: grid;
  gap: 7px;
}

.empty-state-rich strong {
  color: var(--text);
  font-size: 16px;
}

.empty-state-rich p {
  margin: 0;
}

.notice,
.error-panel {
  padding: 12px 14px;
  margin-bottom: 18px;
}

.notice {
  color: #174ea6;
}

.error-panel {
  color: #8a1f1c;
  background: #fff7f7;
}

.pick-dialog {
  border: 0;
  border-radius: var(--radius);
  max-width: 620px;
  width: calc(100% - 32px);
  padding: 0;
  box-shadow: 0 24px 80px rgba(17, 24, 39, 0.24);
}

.pick-dialog::backdrop {
  background: rgba(17, 24, 39, 0.42);
}

.dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-soft);
  cursor: pointer;
  font-size: 18px;
}

#dialog-content {
  padding: 26px;
}

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

.detail-item.wide {
  grid-column: 1 / -1;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 18px;
  }

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

  .nav-link {
    text-align: center;
  }

  .scope-note {
    margin-top: 0;
  }

  .decision-banner,
  .model-grid,
  .metric-grid,
  .system-panel,
  .pick-grid,
  .split-grid,
  .method-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .main {
    padding: 16px;
  }

  .topbar,
  .topbar-actions,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .sync-meta {
    text-align: left;
  }

  .nav,
  .decision-banner,
  .decision-metrics,
  .model-grid,
  .metric-grid,
  .system-panel,
  .pick-grid,
  .pick-focus,
  .split-grid,
  .method-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

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

  .history-result {
    justify-items: start;
    text-align: left;
  }

  .filter-row,
  .filter-row select,
  .primary-action,
  .secondary-action {
    width: 100%;
  }

  .decision-status strong {
    font-size: 24px;
  }
}

@media (max-width: 700px) {
  .pick-card {
    min-width: 0;
  }
}
