:root {
  color-scheme: light;
  --background: #f6f7f9;
  --foreground: #17202a;
  --muted: #5f6b7a;
  --border: #d8dee8;
  --surface: #ffffff;
  --accent: #0f766e;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--background);
  color: var(--foreground);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.dashboard-shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.dashboard-header {
  margin-bottom: 24px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgb(44 19 5 / 18%);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
}

h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.dashboard-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.dashboard-navigation {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.tabs {
  display: flex;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  background: var(--surface);
}

.tabs button {
  min-width: 92px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 8px 14px;
  font-weight: 700;
}

.tabs button.active {
  background: var(--accent);
  color: #ffffff;
}

.telegram-link {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 6px;
  border: 1px solid #168acd;
  border-radius: 7px;
  background: #229ed9;
  color: #ffffff;
  padding: 0 14px;
  font-weight: 700;
  text-decoration: none;
}

.telegram-link:hover {
  background: #168acd;
}

.telegram-link:focus-visible {
  outline: 3px solid rgb(34 158 217 / 28%);
  outline-offset: 2px;
}

.telegram-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: currentColor;
}

.snapshot-button {
  min-height: 40px;
  border: 1px solid #0f766e;
  border-radius: 7px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  padding: 0 14px;
  font-weight: 700;
}

.snapshot-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.toolbar label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.toolbar input,
.toolbar select {
  width: 100%;
  min-width: 0;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--foreground);
  padding: 0 10px;
}

.notice {
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--surface);
}

.notice.error {
  border-color: #fecaca;
  color: #991b1b;
}

.notice.success {
  border-color: #99f6e4;
  color: #0f766e;
}

.chart-panel,
.table-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  min-width: 0;
}

.table-panel {
  margin-top: 18px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.panel-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.status {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  font-size: 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.segmented-control {
  display: flex;
  flex: 0 0 auto;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}

.segmented-control button {
  min-width: 76px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
}

.segmented-control button.active {
  background: var(--foreground);
  color: #ffffff;
}

.chart-frame {
  display: block;
  height: 440px;
  min-width: 0;
  min-height: 440px;
  padding: 16px 12px 10px 0;
  width: 100%;
}

.chart-plot {
  height: 100%;
  width: 100%;
  min-width: 0;
  min-height: 0;
}

.chart-tooltip {
  max-width: min(360px, calc(100vw - 48px));
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgb(23 32 42 / 14%);
  padding: 10px 12px;
}

.chart-tooltip-label {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chart-tooltip-list {
  display: grid;
  gap: 6px;
}

.chart-tooltip-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.chart-tooltip-marker {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.chart-tooltip-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-tooltip-value {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.empty-state {
  display: grid;
  height: 100%;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.positive {
  color: #047857;
}

.negative {
  color: #be123c;
}

.event-name,
.subtle,
.mono {
  display: block;
}

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

.event-link {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.mono {
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    monospace;
}

.picks-panel {
  margin-top: 0;
}

.picks-matrix {
  min-width: 1040px;
  font-size: 13px;
}

.picks-matrix th,
.picks-matrix td {
  padding: 8px 10px;
  vertical-align: top;
}

.picks-matrix th:first-child,
.picks-matrix td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 220px;
  background: var(--surface);
}

.picks-matrix th:first-child {
  z-index: 2;
}

.picks-matrix .numeric {
  text-align: right;
}

.winner-cell {
  background: #ecfdf5;
}

.eliminated-cell {
  background: #fef2f2;
}

@media (max-width: 900px) {
  .dashboard-header {
    margin-bottom: 20px;
  }

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

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .chart-frame {
    height: 360px;
    min-height: 360px;
  }
}

@media (max-width: 560px) {
  .dashboard-shell {
    width: min(100vw - 20px, 1280px);
    padding-top: 20px;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 28px;
  }

  .brand-icon {
    width: 54px;
    height: 54px;
    border-radius: 12px;
  }
}

.rust-chart {
  padding: 16px;
}
.rust-chart svg {
  width: 100%;
  height: auto;
  min-height: 230px;
}
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  list-style: disc;
  padding-left: 24px;
}
circle:focus {
  outline: 2px solid #17202a;
}
.snapshot-admin {
  padding: 18px;
}
.snapshot-admin summary {
  cursor: pointer;
  font-weight: 700;
}
.snapshot-admin p {
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.snapshot-admin label {
  display: grid;
  gap: 8px;
  max-width: 440px;
  font-weight: 700;
}
.snapshot-admin input {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
}
.snapshot-admin .dashboard-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}
.snapshot-admin button {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--foreground);
  cursor: pointer;
}
.snapshot-admin button:disabled {
  opacity: 0.6;
  cursor: default;
}
.snapshot-admin #snapshot-submit {
  background: var(--accent);
  color: white;
}
.snapshot-admin .notice:empty {
  display: none;
}
