:root {
  --bg: #09131d;
  --panel: rgba(14, 28, 41, 0.88);
  --panel-muted: rgba(22, 38, 55, 0.72);
  --line: rgba(129, 161, 193, 0.22);
  --text: #ebf3fb;
  --muted: #9bb0c8;
  --accent: #6be3c2;
  --accent-strong: #40c8a3;
  --warn: #f08d7f;
  --good: #89f0b8;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #071018 0%, #0d1e2d 48%, #09131d 100%);
  min-height: 100vh;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 64px;
}

.hero {
  margin-bottom: 18px;
}

.eyebrow,
.panel-label {
  margin: 0 0 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
}

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

h1 {
  font-size: clamp(2.45rem, 5vw, 4.2rem);
  margin-bottom: 8px;
}

h2 {
  font-size: 1.1rem;
  margin-bottom: 14px;
}

.hero-copy {
  max-width: 650px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.panel,
.card {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(12px);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-accent {
  background:
    radial-gradient(circle at top right, rgba(107, 227, 194, 0.12), transparent 40%),
    var(--panel);
}

.panel {
  padding: 18px;
  margin-bottom: 18px;
}

.muted {
  background: var(--panel-muted);
  color: var(--muted);
}

.loading-panel {
  background:
    linear-gradient(135deg, rgba(107, 227, 194, 0.08), rgba(65, 154, 245, 0.08)),
    var(--panel);
}

.loading-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.loading-text {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
}

.loading-percent {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 1.6rem;
  font-weight: 700;
}

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 3px solid rgba(155, 176, 200, 0.22);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
  flex: 0 0 auto;
}

.good {
  color: var(--good);
}

.bad {
  color: var(--warn);
}

.update-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  width: min(390px, calc(100vw - 36px));
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: start;
  padding: 14px 14px 14px 16px;
  border: 1px solid rgba(107, 227, 194, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(107, 227, 194, 0.15), rgba(143, 183, 255, 0.08)),
    rgba(8, 20, 31, 0.96);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.36);
  color: var(--text);
}

.update-toast[hidden] {
  display: none;
}

.update-toast strong {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
}

.update-toast p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.toast-close {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 14, 22, 0.42);
  color: var(--text);
  line-height: 1;
}

.controls .control-row {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 190px;
  gap: 14px;
  align-items: end;
}

.auth-bar,
.auth-actions,
.advanced-grid,
.advanced-actions {
  display: grid;
  gap: 14px;
}

.auth-bar {
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: 18px;
}

.auth-actions {
  grid-auto-flow: column;
}

.advanced-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

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

.field.wide {
  grid-column: 1 / -1;
}

.token-panel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid rgba(107, 227, 194, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(107, 227, 194, 0.08), rgba(143, 183, 255, 0.06)),
    rgba(5, 14, 22, 0.42);
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(520px, 620px);
  gap: 18px;
  align-items: stretch;
}

.token-panel h2 {
  margin-bottom: 8px;
}

.token-panel p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.token-steps {
  height: 100%;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(5, 14, 22, 0.36);
  color: var(--muted);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

.token-steps strong {
  margin-top: auto;
  color: var(--text);
}

.token-steps ol {
  margin: 8px 0 0;
  padding-left: 20px;
}

.token-steps li {
  margin: 4px 0;
}

.token-steps span {
  color: var(--accent);
  font-weight: 700;
}

.token-image {
  margin: 0;
  width: 100%;
  max-width: 620px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(5, 14, 22, 0.36);
  overflow: hidden;
  display: flex;
  align-items: center;
}

.token-image img {
  width: 100%;
  height: auto;
  display: block;
}

.token-entry {
  display: grid;
  gap: 12px;
  align-content: stretch;
}

.token-field textarea {
  min-height: 120px;
  resize: vertical;
}

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

input,
select,
textarea,
button {
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 12px 14px;
  font: inherit;
}

input,
select,
textarea {
  background: rgba(4, 10, 17, 0.55);
  color: var(--text);
}

select:focus,
input:focus,
textarea:focus {
  outline: none;
  border-color: rgba(107, 227, 194, 0.38);
  box-shadow: 0 0 0 2px rgba(107, 227, 194, 0.08);
}

select option {
  background: #08141f;
  color: var(--text);
}

select option:checked {
  background: #1f6fd1;
  color: #ffffff;
}

button {
  cursor: pointer;
  color: #06231b;
  background: linear-gradient(135deg, var(--accent), #90f4de);
  font-weight: 700;
  text-decoration: none;
}

button.secondary {
  background: transparent;
  color: var(--text);
}

button.secondary.active {
  border-color: rgba(107, 227, 194, 0.45);
  background: rgba(107, 227, 194, 0.12);
  color: var(--accent);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 12px 14px;
  color: #06231b;
  background: linear-gradient(135deg, var(--accent), #90f4de);
  font-weight: 700;
  text-decoration: none;
}

.session-box {
  margin-top: 16px;
  color: var(--muted);
}

.session-box summary {
  cursor: pointer;
  color: var(--text);
  margin-bottom: 10px;
}

.status-grid,
.cards,
.grid,
.insight-grid {
  display: grid;
  gap: 18px;
}

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

.cards {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 18px;
}

.overview-disclaimer {
  margin: -4px 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(5, 14, 22, 0.42);
  color: var(--muted);
  line-height: 1.55;
}

.overview-disclaimer strong {
  color: var(--text);
}

.report-filter-bar {
  position: sticky;
  top: 10px;
  z-index: 18;
  margin: 0 0 18px;
  padding: 8px 10px 8px 12px;
  max-height: 72px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(7, 18, 28, 0.86);
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.26);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  opacity: 1;
  transform: translateY(0);
  transition:
    max-height 0.22s ease,
    margin 0.22s ease,
    padding 0.22s ease,
    opacity 0.18s ease,
    transform 0.22s ease,
    border-color 0.22s ease;
}

.report-filter-bar.is-collapsed {
  max-height: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-color: transparent;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-16px);
  overflow: visible;
}

.report-filter-bar.is-collapsed .filter-copy,
.report-filter-bar.is-collapsed .filter-chip-row {
  opacity: 0;
}

.filter-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.filter-copy span {
  display: block;
  max-width: 260px;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-chip-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-chip {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 5px 4px 10px;
  border: 1px solid rgba(129, 161, 193, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.filter-chip span {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0;
}

.filter-chip select,
.filter-chip input {
  width: auto;
  max-width: 150px;
  min-height: 26px;
  border: 0;
  border-radius: 999px;
  padding: 3px 8px;
  background: transparent;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 700;
}

.filter-chip input {
  width: 84px;
}

.filter-chip select:focus,
.filter-chip input:focus {
  box-shadow: none;
  border-color: transparent;
}

.filter-chip:focus-within {
  border-color: rgba(107, 227, 194, 0.3);
  background: rgba(255, 255, 255, 0.05);
}

.toolbar-tab {
  width: 40px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 18, 28, 0.92);
  color: var(--muted);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease;
}

.chevron {
  width: 8px;
  height: 8px;
  display: block;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
}

.chevron-up {
  transform: translateY(2px) rotate(45deg);
}

.chevron-down {
  transform: translateY(-2px) rotate(225deg);
}

.toolbar-tab:hover,
.toolbar-tab:focus-visible {
  border-color: rgba(107, 227, 194, 0.42);
  color: var(--accent);
  outline: none;
}

.toolbar-tab-collapse {
  position: absolute;
  left: 50%;
  bottom: -17px;
  border-radius: 0 0 999px 999px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-8px);
}

.report-filter-bar.is-stuck .toolbar-tab-collapse {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.toolbar-tab-expand {
  position: sticky;
  top: 10px;
  z-index: 18;
  display: flex;
  margin: -2px auto 18px;
  border-radius: 999px 999px 0 0;
  backdrop-filter: blur(16px);
}

.grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  margin-bottom: 18px;
}

.grid > .panel {
  height: 100%;
  margin-bottom: 0;
}

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

.card {
  min-height: 156px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.card-value {
  font-size: 1.9rem;
  line-height: 1.15;
  font-weight: 700;
  margin: 0;
  overflow-wrap: anywhere;
}

.card-detail {
  min-height: 22px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}

.stat-link {
  margin-top: auto;
  padding: 7px 10px;
  font-size: 0.86rem;
}

.status-pill {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
}

.status-pill.good {
  color: var(--good);
}

.status-pill.bad {
  color: var(--warn);
}

.status-pill.neutral {
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
}

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

.history-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.section-search {
  min-width: 190px;
  min-height: 42px;
  padding: 9px 12px;
}

.history-filter-label {
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(107, 227, 194, 0.08);
  font-size: 0.88rem;
}

.history-disclaimer {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(5, 14, 22, 0.38);
  line-height: 1.5;
}

.history-header h2 {
  margin-bottom: 0;
}

.chart-wrap {
  min-height: 260px;
  display: grid;
  gap: 12px;
}

.graph-controls {
  min-height: 0;
  margin: 14px 0 18px;
}

.graph-grid {
  align-items: start;
}

.graph-grid article h2 {
  margin-bottom: 12px;
}

.chart-period {
  display: grid;
  grid-template-columns: minmax(140px, 1.25fr) repeat(2, minmax(130px, 1fr));
  gap: 10px;
  align-items: end;
}

.chart-period label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.chart-period span {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.chart-period input,
.chart-period select {
  min-height: 38px;
  padding: 8px 10px;
}

.chart-shell {
  display: grid;
  gap: 12px;
}

.chart-hover {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(5, 14, 22, 0.45);
}

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

.chart-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 10px;
  background: rgba(5, 14, 22, 0.35);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.chart-toggle.active {
  color: var(--text);
  border-color: color-mix(in srgb, var(--series-color) 65%, var(--line));
  background: rgba(255, 255, 255, 0.05);
}

.chart-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--series-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--series-color) 18%, transparent);
  flex: 0 0 auto;
}

.chart-hover-value {
  margin: 0;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 700;
}

.chart-hover-label {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.chart {
  width: 100%;
  height: 240px;
}

.chart svg {
  width: 100%;
  height: 240px;
  display: block;
}

.chart-caption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.chart-line {
  fill: none;
  stroke: var(--series-color, var(--accent));
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-point {
  fill: var(--series-color, var(--accent));
  cursor: pointer;
  transition: transform 0.15s ease, fill 0.15s ease;
}

.chart-point:hover,
.chart-point:focus {
  fill: #ffffff;
  outline: none;
}

.chart-area {
  fill: rgba(107, 227, 194, 0.14);
}

.chart-axis,
.chart-grid {
  stroke: rgba(155, 176, 200, 0.18);
  stroke-width: 1;
}

.chart-label {
  fill: var(--muted);
  font-size: 11px;
}

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

th,
td {
  text-align: left;
  padding: 11px 10px;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}

.grid .table-wrap th,
.grid .table-wrap td {
  padding-left: 8px;
  padding-right: 8px;
  font-size: 0.9rem;
}

.grid .table-wrap .th-button {
  gap: 4px;
}

thead th {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-top: 0;
}

th.sortable {
  cursor: pointer;
}

.th-button {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.sort-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  color: var(--muted);
  font-size: 11px;
}

.sort-icon.active {
  color: var(--accent);
}

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

.meta-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.meta-note,
.empty {
  color: var(--muted);
  line-height: 1.6;
}

.meta-note strong {
  color: var(--text);
}

.coverage-note {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(5, 14, 22, 0.42);
  color: var(--muted);
  line-height: 1.55;
}

.coverage-note strong {
  color: var(--text);
}

.coverage-note p {
  margin: 8px 0 0;
}

.insight-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(5, 14, 22, 0.45);
}

.insight-card h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.insight-list {
  display: grid;
  gap: 10px;
}

.insight-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.insight-line strong {
  color: var(--text);
}

.insight-button {
  padding: 8px 12px;
  font-size: 0.88rem;
}

.insight-more-button {
  width: 100%;
  margin-top: 12px;
  padding: 9px 12px;
  color: var(--accent);
  border-color: rgba(107, 227, 194, 0.28);
  background: rgba(107, 227, 194, 0.07);
  font-size: 0.9rem;
}

.insight-more-button:hover,
.insight-more-button:focus-visible {
  border-color: rgba(107, 227, 194, 0.48);
  background: rgba(107, 227, 194, 0.12);
  outline: none;
}

.result {
  font-weight: 700;
}

.result.win {
  color: var(--good);
}

.result.loss {
  color: var(--warn);
}

.result.draw {
  color: #f0c46a;
}

a {
  color: var(--accent);
}

.scroll-top-button {
  position: fixed;
  left: 22px;
  bottom: 22px;
  z-index: 21;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 999px;
  border-color: rgba(107, 227, 194, 0.4);
  background: rgba(14, 28, 41, 0.94);
  color: var(--text);
  box-shadow: var(--shadow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1100px) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .controls .control-row,
  .status-grid,
  .cards,
  .grid,
  .meta-grid,
  .advanced-grid,
  .advanced-actions,
  .auth-bar {
    grid-template-columns: 1fr;
  }

  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 24px;
  }

  .auth-actions {
    grid-auto-flow: row;
  }

  .token-panel {
    grid-template-columns: 1fr;
  }

  .report-filter-bar {
    top: 8px;
    align-items: stretch;
    border-radius: 8px;
    flex-direction: column;
  }

  .filter-chip-row {
    justify-content: stretch;
  }

  .filter-chip,
  .filter-chip select,
  .filter-chip input {
    width: 100%;
    max-width: none;
  }

  .history-header {
    align-items: stretch;
    flex-direction: column;
  }

  .history-actions {
    justify-content: stretch;
  }

  .section-search,
  .history-actions button {
    width: 100%;
  }

  .chart-period {
    grid-template-columns: 1fr;
  }
}

input[type="date"] {
  background: #040A11C8;
  color: #EBF3FB;
  border: 1px solid #2a3a4a; /* tweak if needed */
  padding: 8px 10px;
  border-radius: 6px;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  opacity: 0.8;
  cursor: pointer;
}
/* Hide empty status/message bars after manual token UI was removed. */
.message:empty,
.status-message:empty,
.auth-message:empty,
#message:empty,
#statusMessage:empty,
#authMessage:empty {
  display: none !important;
}

/* If JS leaves an empty message element visible, this class will hide it. */
.is-hidden {
  display: none !important;
}


/* Hide empty leftover message bars. */
.is-hidden {
  display: none !important;
}

#message.is-hidden,
#statusMessage.is-hidden,
#authMessage.is-hidden,
.message.is-hidden,
.status-message.is-hidden,
.auth-message.is-hidden,
[aria-live].is-hidden {
  display: none !important;
}
