@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("./fonts/Manrope-300.ttf") format("truetype");
}

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./fonts/Manrope-400.ttf") format("truetype");
}

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("./fonts/Manrope-600.ttf") format("truetype");
}

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./fonts/Manrope-700.ttf") format("truetype");
}

@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./fonts/Newsreader-400.woff2") format("woff2");
}

@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("./fonts/Newsreader-600.woff2") format("woff2");
}

@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./fonts/Newsreader-700.woff2") format("woff2");
}

:root {
  --font-body: "Manrope", "Segoe UI", sans-serif;
  --font-display: "Newsreader", "Manrope", serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --page-max-width: 1400px;
  --card-pad-y: 28px;
  --card-pad-x: 30px;
  --panel-pad-y: 22px;
  --panel-pad-x: 24px;
  --layout-gap: 32px;
  --grid-gap: 24px;
  --control-height: 28px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 28px;
  --space-7: 36px;
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --shadow-1: 0 12px 32px rgba(15, 23, 42, 0.08);
  --shadow-2: 0 24px 60px rgba(15, 23, 42, 0.14);
  --shadow-3: 0 40px 80px rgba(15, 23, 42, 0.18);
  --transition-fast: 160ms ease;
}

* {
  box-sizing: border-box;
}

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

body {
  overflow-y: auto;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: #0b0f18;
}

h2,
h3,
h4,
h5 {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

.section-card h3,
.section-card h4,
.section-card h5,
.panel-card h3,
.panel-card h4,
.panel-card h5 {
  color: var(--card-accent, var(--accent));
}

.theme-light {
  --canvas: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #e7edf6;
  --text: #0f172a;
  --muted: #5b6475;
  --muted-strong: #384152;
  --border: #d6dde8;
  --border-strong: #c1ccda;
  --accent: #1d4ed8;
  --accent-strong: #1e40af;
  --accent-2: #f97316;
  --accent-3: #10b981;
  --accent-4: #a855f7;
  --accent-5: #e11d48;
  --accent-6: #facc15;
  --accent-7: #06b6d4;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --accent-contrast: #ffffff;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #0ea5e9;
  --table-row: #f8fafc;
  --chip-bg: rgba(37, 99, 235, 0.1);
  --chip-text: #1e3a8a;
  --shadow-color: rgba(15, 23, 42, 0.08);
}

.theme-dark {
  --canvas: #0b0f18;
  --surface: #121826;
  --surface-2: #171f2e;
  --surface-3: #1f2937;
  --text: #f8fafc;
  --muted: #a6b0bf;
  --muted-strong: #d2d7df;
  --border: #233044;
  --border-strong: #334155;
  --accent: #6c8cff;
  --accent-strong: #4f6be8;
  --accent-2: #fb923c;
  --accent-3: #34d399;
  --accent-4: #c084fc;
  --accent-5: #fb7185;
  --accent-6: #fde047;
  --accent-7: #22d3ee;
  --accent-soft: rgba(108, 140, 255, 0.18);
  --accent-contrast: #0b0f18;
  --success: #22c55e;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: #38bdf8;
  --table-row: #141c2c;
  --chip-bg: rgba(108, 140, 255, 0.2);
  --chip-text: #dbe4ff;
  --shadow-color: rgba(8, 10, 14, 0.45);
}

.theme-light,
.theme-dark {
  background: var(--canvas);
  color: var(--text);
}

#app-container {
  min-height: 100vh;
  padding: clamp(16px, 2vw, 28px) clamp(16px, 4vw, 56px);
  max-width: none;
  margin: 0;
  position: relative;
  overflow-x: hidden;
}

#app-container::before,
#app-container::after {
  content: "";
  position: absolute;
  inset: auto;
  z-index: 0;
  pointer-events: none;
}

#app-container::before {
  width: 420px;
  height: 420px;
  top: -120px;
  right: -140px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.12), transparent 68%);
  filter: blur(2px);
}

#app-container::after {
  width: 380px;
  height: 380px;
  bottom: -160px;
  left: -140px;
  background: radial-gradient(circle, rgba(15, 23, 42, 0.12), transparent 70%);
  filter: blur(1px);
}

.app-shell {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  position: relative;
  z-index: 1;
  max-width: var(--page-max-width);
  width: 100%;
  margin: 0 auto;
}

.app-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  text-align: center;
  width: 100%;
  margin-bottom: var(--space-2);
}

.app-logo {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  position: relative;
  box-shadow: 0 16px 32px var(--shadow-color);
  border: 1px solid rgba(255, 255, 255, 0.65);
}

.theme-dark .app-logo {
  border-color: rgba(255, 255, 255, 0.2);
}

.app-logo::after {
  content: "";
  position: absolute;
  inset: 14px;
  background: #ffffff;
  -webkit-mask: url("/assets/brand-mark.svg") center/contain no-repeat;
  mask: url("/assets/brand-mark.svg") center/contain no-repeat;
}

.app-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.app-nav {
  width: 100%;
  margin-top: var(--space-2);
  margin-bottom: var(--space-6);
}

.page-shell {
  display: flex;
  flex-direction: column;
  gap: var(--layout-gap);
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

.page-title-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.page-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  color: var(--muted);
}

.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(22px, 2.4vw, 32px);
}

.page-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.page-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.card,
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--card-pad-y) var(--card-pad-x);
  box-shadow: var(--shadow-1);
  border-left: 6px solid var(--card-accent, var(--accent));
}

.panel,
.panel-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--panel-pad-y) var(--panel-pad-x);
  box-shadow: none;
}

.section-title {
  margin-top: var(--space-4);
}

.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-3) 0;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.grid-two,
.grid-three,
.grid-four {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--grid-gap);
}

.home-grid,
.backfill-grid,
.analytics-grid,
.tickets-grid,
.backtest-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--layout-gap);
}

.home-results-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--grid-gap);
}

.filter-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.filter-input-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 220px;
}

.filter-input-wrap .field {
  padding-right: 34px;
}

.filter-clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: var(--surface-3);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-size: 14px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.filter-clear-btn:hover {
  color: var(--text);
  background: var(--surface);
}

.filter-clear-icon {
  display: inline-block;
  font-weight: 700;
  transform: translateY(-1px);
}

.filter-input-wrap input:not(:placeholder-shown) + .filter-clear-btn {
  opacity: 1;
  pointer-events: auto;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 200px;
}

.field-group > label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-strong);
  letter-spacing: 0.01em;
}

.field-group > p {
  margin: 0;
}

.field-label {
  display: block;
  margin-bottom: var(--space-1);
}

.field {
  min-width: 200px;
}

.field input,
.field .Select-control,
input.field,
textarea.field {
  background: var(--surface-2) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
  border-radius: var(--radius-sm) !important;
  padding: 3px 12px;
  box-shadow: inset 0 0 0 1px transparent;
}

.field input,
input.field,
textarea.field {
  height: var(--control-height);
  line-height: var(--control-height);
}

.field .Select-control {
  min-height: var(--control-height);
  height: var(--control-height);
  padding-top: 0;
  padding-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  position: relative;
  padding-right: 28px;
}

.field .Select-placeholder,
.field .Select-value-label,
.field .Select-input {
  line-height: var(--control-height);
}

.field .Select-value {
  line-height: var(--control-height);
}

.field .Select-input {
  height: var(--control-height);
  margin-top: 0;
}

.field .Select-input > input {
  height: var(--control-height);
  line-height: var(--control-height);
  padding: 0;
  border: none;
  background: transparent;
  outline: none;
  box-shadow: none;
}

.field .Select-multi-value-wrapper,
.field .Select-value,
.field .Select-placeholder,
.field .Select-input {
  display: flex;
  align-items: center;
  height: 100%;
}

.field .Select-multi-value-wrapper {
  flex: 0 1 auto;
  min-width: 0;
}

.field .Select-value-label {
  line-height: 1.1;
  display: inline-flex;
  align-items: center;
}

.field .Select-arrow-zone {
  display: none;
}

.field .Select-clear-zone {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 0;
  display: inline-flex;
  align-items: center;
}

#tickets-status .Select-clear-zone {
  display: none !important;
}

.field .Select-input > input:focus {
  outline: none;
  box-shadow: none;
}

.field input:focus,
input.field:focus,
textarea.field:focus,
.Select-control:focus-within {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.Select-menu-outer {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm);
  margin-top: 4px;
}

.Select-option {
  color: var(--text) !important;
}

.Select-option.is-focused {
  background: var(--accent-soft) !important;
}

.actions-row {
  display: flex;
  gap: var(--space-5);
  row-gap: var(--space-3);
  flex-wrap: wrap;
  align-items: center;
  margin-top: var(--space-3);
}

.actions-row.align-right {
  justify-content: flex-end;
}

.actions-row.actions-row-split {
  justify-content: space-between;
  width: 100%;
}

.actions-group {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.home-actions {
  margin-top: var(--space-2);
}

.row-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 600;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border var(--transition-fast);
  box-shadow: 0 8px 18px var(--shadow-color);
}

a.btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px var(--shadow-color);
}

.btn.primary {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent-strong);
}

.btn.secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.btn.icon-only {
  padding: 6px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}

.btn.danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: var(--danger);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 2px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--chip-bg);
  color: var(--chip-text);
  font-size: 12px;
  font-weight: 600;
}

.chip-coverage-low {
  background: rgba(239, 68, 68, 0.14);
  color: #b91c1c;
}

.chip-coverage-medium {
  background: rgba(245, 158, 11, 0.14);
  color: #92400e;
}

.chip-coverage-high {
  background: rgba(34, 197, 94, 0.12);
  color: #166534;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.result-chips {
  margin-bottom: var(--space-2);
}

.status-box {
  min-height: 42px;
  padding: var(--space-3);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  font-size: 12px;
  color: var(--muted);
}

#home-odds-status {
  margin-top: var(--space-3);
}

.status-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.status-panel-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.status-panel-body {
  font-size: 13px;
  color: var(--text);
  min-height: 18px;
}

.status-log {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

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

.chart {
  height: 320px;
}

.section-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-4);
  align-items: start;
}

.table-scroll {
  max-height: 420px;
  overflow: auto;
}

.table-scroll table {
  width: 100%;
}

.checklist-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
}

.checklist {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.checklist-stack label {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.backtest-markets label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.backtest-markets input:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.backtest-market-label {
  color: var(--text);
}

.backtest-market-disabled {
  color: var(--muted);
  opacity: 0.65;
}

.tab {
  border: 1px solid var(--border) !important;
  background: var(--tab-color, var(--surface-2)) !important;
  color: var(--accent-contrast) !important;
  border-radius: var(--radius-pill) !important;
  padding: 8px 16px !important;
  margin-right: 8px;
  font-weight: 600;
  box-shadow: none;
}

.tab--selected {
  border-color: var(--tab-color, var(--accent)) !important;
  color: var(--accent-contrast) !important;
  background: var(--tab-color, var(--accent)) !important;
  box-shadow: none;
}

.tab-parent {
  background: transparent !important;
  width: 100%;
  padding: 0;
  display: block;
}

.tab-parent .tab {
  display: inline-flex;
  align-items: center;
  margin-bottom: var(--space-2);
}

.tab-parent .tab-content,
.tab-parent .tab-content > div {
  width: 100%;
  height: auto;
  overflow: visible;
}

.tab-content,
.tab-content--selected {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

.tab-content-wrap {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  margin-top: var(--space-4);
}

.tab-parent,
.tab-parent .tab-content,
.tab-parent .tab-content > div,
.dash-tabs,
.dash-tab-content,
.dash-tab-content > div,
.page-shell,
#_dash-app-content,
#_dash-app-content > div,
#react-entry-point,
#react-entry-point > div {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

.tab-parent > .tab:nth-child(1) {
  --tab-color: var(--accent);
  --tab-soft: rgba(29, 78, 216, 0.12);
}

.tab-parent > .tab:nth-child(2) {
  --tab-color: var(--accent-2);
  --tab-soft: rgba(249, 115, 22, 0.15);
}

.tab-parent > .tab:nth-child(3) {
  --tab-color: var(--accent-3);
  --tab-soft: rgba(16, 185, 129, 0.14);
}

.tab-parent > .tab:nth-child(4) {
  --tab-color: var(--accent-4);
  --tab-soft: rgba(168, 85, 247, 0.14);
}

.tab-parent > .tab:nth-child(5) {
  --tab-color: var(--accent-5);
  --tab-soft: rgba(225, 29, 72, 0.14);
}

.tab-parent > .tab:nth-child(6) {
  --tab-color: var(--accent-6);
  --tab-soft: rgba(250, 204, 21, 0.18);
}

.tab-parent > .tab:nth-child(7) {
  --tab-color: var(--accent-7);
  --tab-soft: rgba(6, 182, 212, 0.18);
}

.tab-parent > .tab:nth-child(8) {
  --tab-color: #6b7280;
  --tab-soft: rgba(107, 114, 128, 0.2);
}

.tab-parent > .tab:nth-child(8).tab--disabled {
  background: #94a3b8 !important;
  border-color: #94a3b8 !important;
  color: #ffffff !important;
  opacity: 0.9 !important;
}
