/* ------------------------------------------------------------------ */
/* Reset & Base                                                        */
/* ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Dark theme (default) */
[data-theme="dark"] {
  --bg:        #0f1117;
  --surface:   #1a1d27;
  --surface2:  #242733;
  --border:    #2e3140;
  --text:      #e1e4ed;
  --text-dim:  #8b8fa3;
  --green:     #22c55e;
  --green-bg:  rgba(34,197,94,.12);
  --yellow:    #eab308;
  --yellow-bg: rgba(234,179,8,.12);
  --red:       #ef4444;
  --red-bg:    rgba(239,68,68,.12);
  --blue:      #3b82f6;
  --blue-bg:   rgba(59,130,246,.12);
  --purple:    #a855f7;
  --orange:    #f97316;
  --orange-bg: rgba(249,115,22,.12);
  --overlay-bg: rgba(15,17,23,.7);
  --modal-bg:   rgba(15,17,23,.75);
}

/* Light theme */
[data-theme="light"] {
  --bg:        #f5f6fa;
  --surface:   #ffffff;
  --surface2:  #f0f1f5;
  --border:    #dcdee5;
  --text:      #1a1d27;
  --text-dim:  #6b7085;
  --green:     #16a34a;
  --green-bg:  rgba(22,163,74,.1);
  --yellow:    #ca8a04;
  --yellow-bg: rgba(202,138,4,.1);
  --red:       #dc2626;
  --red-bg:    rgba(220,38,38,.08);
  --blue:      #2563eb;
  --blue-bg:   rgba(37,99,235,.1);
  --purple:    #9333ea;
  --orange:    #ea580c;
  --orange-bg: rgba(234,88,12,.08);
  --overlay-bg: rgba(245,246,250,.7);
  --modal-bg:   rgba(245,246,250,.75);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ------------------------------------------------------------------ */
/* Layout                                                              */
/* ------------------------------------------------------------------ */
.container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px 20px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

header h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.3px;
}
header h1 span { color: var(--blue); }

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

#lastUpdated {
  font-size: 13px;
  color: var(--text-dim);
}

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface2); border-color: var(--blue); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: #2563eb; }
.btn-stop { background: var(--red); border-color: var(--red); color: #fff; }
.btn-stop:hover { background: #dc2626; }

/* ------------------------------------------------------------------ */
/* Summary Cards                                                       */
/* ------------------------------------------------------------------ */
.summary-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}

.card-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.card-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.5px;
}

.card-value.green  { color: var(--green); }
.card-value.yellow { color: var(--yellow); }
.card-value.red    { color: var(--red); }
.card-value.blue   { color: var(--blue); }

/* ------------------------------------------------------------------ */
/* Filter & Search Bar                                                 */
/* ------------------------------------------------------------------ */
.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  align-items: center;
}

.search-box {
  flex: 1;
  min-width: 200px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}
.search-box::placeholder { color: var(--text-dim); }
.search-box:focus { border-color: var(--blue); }

.filter-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.filter-btn:hover { border-color: var(--text-dim); color: var(--text); }
.filter-btn.active { background: var(--blue-bg); border-color: var(--blue); color: var(--blue); }

/* ------------------------------------------------------------------ */
/* Table                                                               */
/* ------------------------------------------------------------------ */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-dim);
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
thead th:hover { color: var(--text); }
thead th .sort-arrow { font-size: 10px; margin-left: 4px; }

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }
tbody tr.expanded-parent { background: var(--surface2); }

td {
  padding: 12px 16px;
  font-size: 13px;
  vertical-align: middle;
}

/* Status badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .3px;
}
.badge .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.badge-healthy  { background: var(--green-bg);  color: var(--green); }
.badge-healthy .dot  { background: var(--green); }
.badge-degraded { background: var(--yellow-bg); color: var(--yellow); }
.badge-degraded .dot { background: var(--yellow); }
.badge-down     { background: var(--red-bg);    color: var(--red); }
.badge-down .dot     { background: var(--red); }

/* P1 tag */
.p1-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  background: var(--purple);
  color: #fff;
  margin-left: 6px;
  vertical-align: middle;
}

/* Progress bar (missing %) */
.pct-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pct-bar {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--surface2);
  overflow: hidden;
  max-width: 120px;
}
.pct-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .4s ease;
}
.pct-bar-fill.green  { background: var(--green); }
.pct-bar-fill.yellow { background: var(--yellow); }
.pct-bar-fill.red    { background: var(--red); }

.pct-text {
  font-weight: 600;
  font-size: 13px;
  min-width: 50px;
}

/* Expand / detail row */
.expand-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color .15s, background .15s;
}
.expand-btn:hover { color: var(--text); background: var(--surface2); }

.detail-row td {
  padding: 0 16px 14px 56px;
  background: var(--surface2);
}
.detail-row.hidden { display: none; }

.sport-group { margin-bottom: 8px; }
.sport-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 4px;
}
.league-tag {
  display: inline-block;
  padding: 2px 8px;
  margin: 2px 4px 2px 0;
  border-radius: 4px;
  font-size: 11px;
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid rgba(239,68,68,.2);
}
.league-tag .tag-reason {
  opacity: .7;
  font-weight: 400;
}
.league-tag .tag-context {
  opacity: .55;
  font-size: 10px;
  font-weight: 400;
}
.live-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--red);
  margin-right: 3px;
  animation: pulse-live 1.5s ease-in-out infinite;
  vertical-align: middle;
}
@keyframes pulse-live { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

.detail-legend {
  margin-top: 10px;
  display: flex;
  gap: 16px;
  font-size: 11px;
  color: var(--text-dim);
}
.detail-legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend-swatch {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 2px;
}
.legend-swatch.swatch-red { background: var(--red); }

/* ------------------------------------------------------------------ */
/* Loading / Empty States                                              */
/* ------------------------------------------------------------------ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}
.loading-overlay.hidden { display: none; }

.spinner {
  width: 40px; height: 40px;
  margin: 0 auto;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
  color: var(--text-dim);
  font-size: 14px;
  margin-top: 14px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}
.empty-state p { margin-top: 8px; font-size: 14px; }

.warning-banner {
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--yellow-bg);
  border: 1px solid rgba(234,179,8,.3);
  color: var(--yellow);
  font-size: 13px;
  margin-bottom: 18px;
}
.warning-banner.hidden { display: none; }

/* ------------------------------------------------------------------ */
/* API-error league tag (orange instead of red)                        */
/* ------------------------------------------------------------------ */
.league-tag.tag-api-error {
  background: var(--orange-bg);
  color: var(--orange);
  border-color: rgba(249,115,22,.25);
}

/* ------------------------------------------------------------------ */
/* Seen-timestamp severity colors                                      */
/* ------------------------------------------------------------------ */
.seen-green  { color: var(--green); }
.seen-yellow { color: var(--yellow); }
.seen-red    { color: var(--red); }

/* ------------------------------------------------------------------ */
/* Legend extras                                                        */
/* ------------------------------------------------------------------ */
.legend-swatch.swatch-orange { background: var(--orange); }
.legend-muted { font-style: italic; opacity: .7; }

/* ------------------------------------------------------------------ */
/* Sparkline (history dots)                                            */
/* ------------------------------------------------------------------ */
.sparkline {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.sparkline-empty { color: var(--text-dim); font-size: 12px; }
.spark-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
}
.spark-healthy  { background: var(--green); }
.spark-degraded { background: var(--yellow); }
.spark-down     { background: var(--red); }
.spark-unknown  { background: var(--border); }

/* ------------------------------------------------------------------ */
/* Auto-refresh select                                                 */
/* ------------------------------------------------------------------ */
.auto-refresh-select {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  outline: none;
}
.auto-refresh-select:focus { border-color: var(--blue); }

/* ------------------------------------------------------------------ */
/* Collapsible sport groups                                            */
/* ------------------------------------------------------------------ */
.sport-header {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}
.sport-header:hover .sport-name { color: var(--text); }
.sport-toggle {
  font-size: 10px;
  color: var(--text-dim);
  transition: transform .15s;
}
.sport-toggle.collapsed { transform: rotate(-90deg); }
.sport-leagues.collapsed { display: none; }

/* ------------------------------------------------------------------ */
/* Matrix / Grid view                                                  */
/* ------------------------------------------------------------------ */
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-left: auto;
}
.view-toggle-btn {
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
}
.view-toggle-btn:hover { color: var(--text); }
.view-toggle-btn.active { background: var(--blue-bg); color: var(--blue); }

#matrixView { display: none; }
#matrixView.active { display: block; }

.matrix-toolbar {
  margin-bottom: 10px;
}
.matrix-toolbar .search-box {
  max-width: 320px;
}

.matrix-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto;
  margin-top: 18px;
}
.matrix-wrap table { border-collapse: collapse; width: auto; min-width: 100%; }
.matrix-wrap th,
.matrix-wrap td {
  padding: 6px 10px;
  font-size: 11px;
  white-space: nowrap;
  border: 1px solid var(--border);
  text-align: center;
}
.matrix-wrap thead th {
  background: var(--surface2);
  position: sticky;
  top: 0;
  z-index: 1;
}
.matrix-wrap tbody th {
  text-align: left;
  background: var(--surface2);
  font-weight: 600;
  position: sticky;
  left: 0;
  z-index: 1;
}
.matrix-cell {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 3px;
}
.matrix-cell.m-ok      { background: var(--green); }
.matrix-cell.m-no-odds { background: var(--red); }
.matrix-cell.m-error   { background: var(--orange); }
.matrix-cell.m-na      { background: var(--border); }

/* ------------------------------------------------------------------ */
/* Progress bar (loading overlay)  (#8)                                */
/* ------------------------------------------------------------------ */
.progress-bar-wrap {
  margin-top: 14px;
  width: 260px;
}
.progress-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--surface2);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--blue);
  transition: width .4s ease;
}
.progress-detail {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 6px;
}

/* ------------------------------------------------------------------ */
/* Platform outage banner (#14)                                        */
/* ------------------------------------------------------------------ */
.platform-banner {
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--orange-bg);
  border: 1px solid rgba(249,115,22,.3);
  color: var(--orange);
  font-size: 13px;
  margin-bottom: 18px;
  line-height: 1.7;
}
.platform-banner.hidden { display: none; }

.platform-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  background: var(--orange-bg);
  color: var(--orange);
  border: 1px solid rgba(249,115,22,.25);
  margin-left: 4px;
  vertical-align: middle;
}

/* ------------------------------------------------------------------ */
/* No-games hint (#1, #2)                                              */
/* ------------------------------------------------------------------ */
.no-games-hint {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 400;
}

.no-games-label {
  color: var(--text-dim) !important;
  font-style: italic;
}

.league-tag.tag-no-games {
  background: rgba(139,143,163,.1);
  color: var(--text-dim);
  border-color: rgba(139,143,163,.2);
}

/* ------------------------------------------------------------------ */
/* Staleness badge (#7)                                                */
/* ------------------------------------------------------------------ */
.stale-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 600;
  background: var(--yellow-bg);
  color: var(--yellow);
  border: 1px solid rgba(234,179,8,.25);
  margin-left: 4px;
  vertical-align: middle;
}

/* ------------------------------------------------------------------ */
/* Detail search (#12)                                                 */
/* ------------------------------------------------------------------ */
.detail-search-wrap {
  margin-bottom: 10px;
}
.detail-search {
  width: 100%;
  max-width: 300px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  outline: none;
}
.detail-search::placeholder { color: var(--text-dim); }
.detail-search:focus { border-color: var(--blue); }

/* ------------------------------------------------------------------ */
/* Modal (#9, #10)                                                     */
/* ------------------------------------------------------------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(2px);
}
.modal-overlay.hidden { display: none; }

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 90%;
  max-width: 700px;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 {
  font-size: 16px;
  font-weight: 600;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.modal-close:hover { color: var(--text); background: var(--surface2); }
.modal-body {
  padding: 16px 20px;
  font-size: 13px;
}
.modal-body h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-dim);
  margin: 16px 0 8px;
}
.modal-body h3:first-child { margin-top: 0; }

/* Exclusion tags */
.exclusion-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.exclusion-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  background: var(--surface2);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.exclusion-section {
  margin-bottom: 10px;
}
.exclusion-sport {
  margin-left: 12px;
  margin-top: 4px;
}

/* Comparison table */
.compare-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text-dim);
}
.compare-no-changes {
  color: var(--green);
  font-weight: 500;
}
.compare-table {
  width: 100%;
  border-collapse: collapse;
}
.compare-table th,
.compare-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.compare-table th {
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
}

/* Small buttons */
.btn-small {
  padding: 5px 10px;
  font-size: 11px;
}

/* Sentry link */
.sentry-link {
  text-decoration: none;
  font-size: 12px;
  opacity: 0.5;
  transition: opacity 0.15s;
  margin-left: 4px;
  vertical-align: middle;
}
.sentry-link:hover {
  opacity: 1;
}

/* ------------------------------------------------------------------ */
/* Last-check bar (#7) — always visible                                */
/* ------------------------------------------------------------------ */
.last-check-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 18px;
}
.last-check-bar.has-data {
  border-left: 3px solid var(--blue);
}
.last-check-age { font-weight: 600; }
.last-check-age.fresh { color: var(--green); }
.last-check-age.stale { color: var(--yellow); }
.last-check-age.old   { color: var(--red); }

/* ------------------------------------------------------------------ */
/* Error banner (#3) — persistent, dismissible                         */
/* ------------------------------------------------------------------ */
.error-banner {
  position: relative;
  padding: 12px 40px 12px 16px;
  border-radius: 8px;
  background: var(--red-bg);
  border: 1px solid rgba(239,68,68,.3);
  color: var(--red);
  font-size: 13px;
  margin-bottom: 18px;
}
.error-banner.hidden { display: none; }
.error-detail {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--surface2);
  color: var(--text);
  font-size: 12px;
  font-family: monospace;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
}
.error-dismiss {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  color: var(--red);
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}
.error-dismiss:hover { background: var(--red-bg); }

/* ------------------------------------------------------------------ */
/* Warnings banner (#4)                                                */
/* ------------------------------------------------------------------ */
.warnings-banner {
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--yellow-bg);
  border: 1px solid rgba(234,179,8,.3);
  color: var(--yellow);
  font-size: 13px;
  margin-bottom: 18px;
}
.warnings-banner.hidden { display: none; }
.warnings-banner ul {
  margin: 6px 0 0 18px;
  list-style: disc;
  font-size: 12px;
}

/* ------------------------------------------------------------------ */
/* Theme toggle button (#8)                                            */
/* ------------------------------------------------------------------ */
.btn-icon {
  padding: 6px 10px;
  font-size: 16px;
  line-height: 1;
  min-width: unset;
}

/* ------------------------------------------------------------------ */
/* Clear filters button (#10)                                          */
/* ------------------------------------------------------------------ */
.btn-clear-filters {
  background: var(--red-bg);
  border-color: rgba(239,68,68,.3);
  color: var(--red);
  font-weight: 600;
}
.btn-clear-filters:hover {
  background: rgba(239,68,68,.2);
  border-color: var(--red);
}
.btn-clear-filters.hidden { display: none; }

/* ------------------------------------------------------------------ */
/* Pagination (#5)                                                     */
/* ------------------------------------------------------------------ */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  margin-top: 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
}
.pagination-bar.hidden { display: none; }
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.page-indicator {
  font-weight: 600;
  color: var(--text);
  min-width: 80px;
  text-align: center;
}
.pagination-info {
  font-weight: 500;
}

/* ------------------------------------------------------------------ */
/* Sparkline tooltip (#9)                                              */
/* ------------------------------------------------------------------ */
.spark-clickable { cursor: pointer; transition: transform .1s; }
.spark-clickable:hover { transform: scale(1.8); }

.spark-tooltip {
  position: absolute;
  z-index: 300;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text);
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
  min-width: 160px;
  pointer-events: auto;
}
.spark-tooltip.hidden { display: none; }
.spark-tip-header {
  font-weight: 600;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}
.spark-tip-row {
  margin-top: 4px;
}

/* ------------------------------------------------------------------ */
/* Legend extras (swatch-gray)                                          */
/* ------------------------------------------------------------------ */
.legend-swatch.swatch-gray { background: var(--text-dim); }

/* ------------------------------------------------------------------ */
/* Coverage comparison page                                            */
/* ------------------------------------------------------------------ */
.card-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.cov-gap-banner {
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--orange-bg);
  border: 1px solid rgba(249,115,22,.3);
  color: var(--orange);
  font-size: 13px;
  margin-bottom: 18px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Horizontal bar chart */
.cov-chart {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.cov-chart-legend {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  font-size: 13px;
}

.cov-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
}

.cov-legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.cov-chart-row {
  display: flex;
  align-items: flex-start;
  margin-bottom: 14px;
  gap: 16px;
}

.cov-chart-label {
  min-width: 160px;
  max-width: 160px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding-top: 2px;
}

.cov-chart-total {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-dim);
}

.cov-chart-bars {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cov-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 18px;
}

.cov-bar {
  height: 14px;
  border-radius: 4px;
  min-width: 2px;
  transition: width .4s ease;
}

.cov-bar-val {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  min-width: 40px;
}

/* Coverage boolean badges */
.cov-yes {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: var(--green-bg);
  color: var(--green);
}

.cov-no {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: var(--red-bg);
  color: var(--red);
}

/* Provider tags in gaps table */
.cov-provider-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-right: 4px;
}

.cov-tag-lsports {
  background: var(--yellow-bg);
  color: var(--yellow);
}

.cov-tag-oddsmarket {
  background: var(--red-bg);
  color: var(--red);
}

.text-dim { color: var(--text-dim); font-size: 12px; }

/* ------------------------------------------------------------------ */
/* Login page                                                          */
/* ------------------------------------------------------------------ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 40px;
  width: 100%;
  max-width: 400px;
}

.login-header {
  margin-bottom: 28px;
  text-align: center;
}

.login-header h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.3px;
  margin-bottom: 6px;
}
.login-header h1 span { color: var(--blue); }

.login-subtitle {
  font-size: 13px;
  color: var(--text-dim);
}

.login-error {
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--red-bg);
  border: 1px solid rgba(239,68,68,.3);
  color: var(--red);
  font-size: 13px;
  margin-bottom: 20px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.login-input {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
  width: 100%;
}
.login-input::placeholder { color: var(--text-dim); }
.login-input:focus { border-color: var(--blue); }

.login-submit {
  width: 100%;
  justify-content: center;
  padding: 10px 16px;
  font-size: 14px;
  margin-top: 4px;
}

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */
@media (max-width: 768px) {
  .summary-row { grid-template-columns: repeat(2, 1fr); }
  td, th { padding: 10px 10px; font-size: 12px; }
  .modal-content { width: 95%; }
  .pagination-bar { flex-direction: column; gap: 8px; }
  .last-check-bar { flex-direction: column; gap: 4px; }
}
