:root {
  color-scheme: dark;
  --bg: #0b1020;
  --panel: #121a2d;
  --panel-2: #18223a;
  --line: #26334f;
  --text: #e9eefc;
  --muted: #8fa0bf;
  --accent: #5aa9ff;
  --green: #37d39a;
  --yellow: #f2c14e;
  --red: #ff6b6b;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(11,16,32,.95);
  backdrop-filter: blur(14px);
}
.brand {
  color: white;
  font-weight: 900;
  letter-spacing: .12em;
  font-size: 18px;
}
nav { display: flex; gap: 8px; }
nav a {
  padding: 8px 11px;
  border-radius: 8px;
  color: var(--muted);
}
nav a.active, nav a:hover {
  color: white;
  background: var(--panel-2);
  text-decoration: none;
}
.refresh-note { margin-left: auto; color: var(--muted); font-size: 12px; }
.container { max-width: 1600px; margin: 0 auto; padding: 28px 24px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; }
h1 { margin: 0; font-size: 28px; }
h2 { margin: 0; font-size: 17px; }
p { color: var(--muted); margin: 6px 0 0; }
.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.card, .panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(0,0,0,.14);
}
.card { padding: 18px; }
.card span, .definition-grid span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.card strong { font-size: 24px; }
.card strong.small { font-size: 14px; overflow-wrap: anywhere; }
.panel { margin-bottom: 16px; overflow: hidden; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px,1fr));
  gap: 10px;
  padding: 16px;
}
.status-count {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  padding: 12px;
  border-radius: 10px;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 960px; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
tbody tr:hover { background: rgba(255,255,255,.025); }
.empty { text-align: center; color: var(--muted); padding: 28px; }
.positive { color: var(--green); font-weight: 700; }
.negative { color: var(--red); }
.pill {
  display: inline-flex;
  align-items: center;
  max-width: 250px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #26334f;
  color: #d8e3fa;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .025em;
}
.pill.conservative_shadow_bet, .pill.won, .pill.success { background: rgba(55,211,154,.16); color: var(--green); }
.pill.conservative_shadow_watch, .pill.pending { background: rgba(242,193,78,.16); color: var(--yellow); }
.pill.longshot_research, .pill.research_small_sample { background: rgba(90,169,255,.16); color: var(--accent); }
.pill.lost, .pill.failed, .pill.blocked_negative_holdout, .pill.blocked_oversure { background: rgba(255,107,107,.16); color: var(--red); }
.filters { display: flex; gap: 12px; align-items: end; padding: 16px; flex-wrap: wrap; }
.filters label { color: var(--muted); font-size: 12px; }
select, button, .button {
  display: inline-flex;
  min-height: 38px;
  margin-top: 6px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
}
button, .button { cursor: pointer; background: #255fa5; border-color: #367bc8; }
.button.secondary { background: var(--panel-2); }
.definition-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px,1fr));
  gap: 1px;
  background: var(--line);
}
.definition-grid > div { padding: 16px; background: var(--panel); }
.definition-grid strong { overflow-wrap: anywhere; }
.error-cell { color: var(--red); white-space: normal; max-width: 420px; }
.error-panel { padding: 20px; }
pre { white-space: pre-wrap; color: var(--red); }
@media (max-width: 980px) {
  .cards, .status-grid { grid-template-columns: repeat(2, minmax(160px,1fr)); }
  .topbar { flex-wrap: wrap; }
  .refresh-note { display: none; }
}
@media (max-width: 620px) {
  .cards, .status-grid, .definition-grid { grid-template-columns: 1fr; }
  .container { padding: 18px 12px 40px; }
  .topbar { padding: 12px; gap: 12px; }
  nav { width: 100%; overflow-x: auto; }
}
.version {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}
.cards.five { grid-template-columns: repeat(5, minmax(150px, 1fr)); }
.freshness { margin-top: 8px; font-size: 11px; font-weight: 700; }
.freshness-good { color: var(--green); }
.freshness-warn { color: var(--yellow); }
.freshness-bad { color: var(--red); }
input[type="number"] {
  display: block;
  min-height: 38px;
  min-width: 150px;
  margin-top: 6px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
}
.check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 9px 0;
}
.check-label input { margin: 0; }
.quota-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  padding: 16px;
}
.quota-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  padding: 14px;
}
.quota-card span, .quota-card small { display: block; color: var(--muted); }
.quota-card strong { display: block; margin: 6px 0; font-size: 24px; }
@media (max-width: 1100px) {
  .cards.five { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
}
@media (max-width: 980px) {
  .quota-grid { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
}
@media (max-width: 620px) {
  .cards.five, .quota-grid { grid-template-columns: 1fr; }
}

.status-caption {
  margin-top: 7px;
  max-width: 310px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}
.legend-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 10px;
  padding: 16px;
}
.legend-item {
  min-height: 110px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
}
.legend-item p {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.4;
}
.pill {
  white-space: normal;
  text-align: center;
  line-height: 1.2;
}
@media (max-width: 1100px) {
  .legend-grid { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
}
@media (max-width: 620px) {
  .legend-grid { grid-template-columns: 1fr; }
}

.action-rule {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 15px 18px;
}
.action-rule > span:last-child { color: var(--muted); }
.bookmaker-help {
  max-width: 760px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  white-space: normal;
}
.filter-errors {
  margin: 0 16px 16px;
  padding: 10px 12px;
  border: 1px solid rgba(255,107,107,.45);
  border-radius: 8px;
  background: rgba(255,107,107,.08);
  color: var(--red);
}
.filters select { min-width: 220px; }
@media (max-width: 980px) {
  .bookmaker-help { text-align: left; }
}


.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top, #163054 0, transparent 45%),
    var(--bg);
}

.auth-shell {
  width: min(440px, calc(100% - 28px));
}

.auth-card {
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 18px 60px rgba(0,0,0,.32);
}

.auth-brand {
  margin-bottom: 24px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: .18em;
}

.auth-form {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.auth-form label {
  color: var(--muted);
  font-size: 12px;
}

.auth-form input,
.admin-actions input,
.filters input[type="text"],
.filters input[type="email"],
.filters input[type="password"] {
  display: block;
  width: 100%;
  min-height: 38px;
  margin-top: 6px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-left: auto;
  font-size: 12px;
}

.user-menu form {
  margin: 0;
}

.logout-button {
  min-height: 30px;
  margin: 0;
  padding: 5px 9px;
  background: var(--panel-2);
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-actions form {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.admin-actions input {
  width: 170px;
  margin: 0;
}

@media (max-width: 980px) {
  .user-menu {
    width: 100%;
    margin-left: 0;
  }

  .admin-actions {
    align-items: stretch;
    flex-direction: column;
  }
}


/* BETLAB_ALL_EVENTS_CSS_BEGIN */
.coverage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.coverage-card {
  background: var(--panel, #ffffff);
  border: 1px solid rgba(120, 130, 150, 0.22);
  border-radius: 12px;
  padding: 14px 16px;
}

.coverage-card span {
  display: block;
  font-size: 0.82rem;
  opacity: 0.72;
  margin-bottom: 7px;
}

.coverage-card strong {
  display: block;
  font-size: 1.55rem;
}

.odds-line {
  white-space: nowrap;
}

.odds-line span {
  display: inline-block;
  margin-right: 8px;
}

.muted {
  opacity: 0.55;
}

.pill.model_data_incomplete {
  background: #6b5b2a;
  color: #fff5cb;
}

.pill.awaiting_external_match {
  background: #4b5563;
  color: #f3f4f6;
}

.pill.market_monitoring {
  background: #174e63;
  color: #d9f4ff;
}

.pill.no_current_odds {
  background: #5c2e35;
  color: #ffe2e5;
}

.all-events-table td:nth-child(4) {
  min-width: 220px;
}
/* BETLAB_ALL_EVENTS_CSS_END */

/* BETLAB_COMPACT_EVENTS_TABLE_BEGIN */

.coverage-explanation {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  line-height: 1.45;
}

.compact-events-wrap {
  overflow-x: visible;
}

.compact-events-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.compact-events-table th,
.compact-events-table td {
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
}

.compact-events-table .col-time {
  width: 11%;
}

.compact-events-table .col-sport {
  width: 15%;
}

.compact-events-table .col-event {
  width: 25%;
}

.compact-events-table .col-odds {
  width: 13%;
}

.compact-events-table .col-analysis {
  width: 17%;
}

.compact-events-table .col-status {
  width: 19%;
}

.event-time {
  white-space: nowrap !important;
}

.sport-name {
  font-weight: 700;
  margin-bottom: 4px;
}

.league-name {
  font-size: 0.82rem;
  opacity: 0.72;
  line-height: 1.3;
}

.event-name {
  font-weight: 600;
  line-height: 1.35;
}

.selected-outcome {
  margin-top: 7px;
  font-size: 0.8rem;
  opacity: 0.75;
}

.odds-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.odds-compact span {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  white-space: nowrap;
  padding: 4px 7px;
  border: 1px solid rgba(130, 145, 180, 0.22);
  border-radius: 6px;
}

.analysis-compact {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.analysis-compact span {
  min-width: 0;
}

.analysis-compact small {
  display: block;
  font-size: 0.7rem;
  opacity: 0.65;
  margin-bottom: 2px;
}

.analysis-compact strong {
  display: block;
  font-size: 0.86rem;
}

.status-cell .pill {
  max-width: 100%;
  white-space: normal;
  text-align: center;
  line-height: 1.25;
}

@media (max-width: 1150px) {
  .compact-events-table .col-time {
    width: 12%;
  }

  .compact-events-table .col-sport {
    width: 14%;
  }

  .compact-events-table .col-event {
    width: 24%;
  }

  .compact-events-table .col-odds {
    width: 14%;
  }

  .compact-events-table .col-analysis {
    width: 17%;
  }

  .compact-events-table .col-status {
    width: 19%;
  }

  .compact-events-table th,
  .compact-events-table td {
    padding-left: 8px;
    padding-right: 8px;
  }
}

/* BETLAB_COMPACT_EVENTS_TABLE_END */


/* BETLAB_HORIZON_SWITCH_BEGIN */

.horizon-filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.horizon-title {
  font-size: 0.82rem;
  font-weight: 600;
}

.horizon-switch {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid rgba(130, 145, 180, 0.28);
  border-radius: 8px;
  overflow: hidden;
}

.horizon-switch label {
  margin: 0;
  cursor: pointer;
}

.horizon-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.horizon-switch span {
  display: block;
  padding: 9px 13px;
  white-space: nowrap;
  font-size: 0.84rem;
  border-right: 1px solid rgba(130, 145, 180, 0.22);
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.horizon-switch label:last-child span {
  border-right: 0;
}

.horizon-switch input:checked + span {
  background: #315d9b;
  color: #ffffff;
  font-weight: 700;
}

.horizon-switch span:hover {
  background: rgba(75, 105, 155, 0.14);
}

.horizon-switch input:checked + span:hover {
  background: #315d9b;
}

/* BETLAB_HORIZON_SWITCH_END */
