:root {
  color-scheme: dark;
  --bg: #0f1116;
  --panel: #181c23;
  --panel-2: #232933;
  --line: #313846;
  --text: #edf1f7;
  --muted: #a7b0c0;
  --accent: #32c0a8;
  --bad: #f06767;
  --good: #60d394;
  --warning: #ffc107;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select {
  font: inherit;
}

.dashboard-shell {
  display: grid;
  gap: 18px;
  width: min(1560px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.dashboard-header,
.filters,
.panel,
.metric-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brand img {
  width: 250px;
  max-width: 38vw;
  max-height: 42px;
  object-fit: contain;
  object-position: left center;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.1;
}

h2 {
  font-size: 16px;
}

p,
small {
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

button,
.ghost-button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.ghost-button:hover {
  border-color: var(--accent);
}

button.danger {
  border-color: color-mix(in srgb, var(--bad), transparent 40%);
  color: var(--bad);
}

.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  padding: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text);
  padding: 0 10px;
  text-transform: none;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 12px;
  padding: 14px;
}

.chart-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #121720;
}

.chart-card-wide {
  grid-column: span 2;
}

.chart-card h3 {
  margin: 0;
  font-size: 14px;
}

.chart-card p {
  margin-top: 3px;
  font-size: 12px;
}

.chart-card canvas {
  width: 100%;
  min-height: 210px;
  border-radius: 6px;
  background: #0b0f15;
}

.metric-card {
  padding: 16px;
}

.metric-card span {
  display: block;
  font-size: 30px;
  font-weight: 850;
  line-height: 1;
}

.metric-card small {
  display: block;
  margin-top: 7px;
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.panel-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.attempts-wrap table {
  min-width: 1260px;
}

.skill-wrap table {
  min-width: 1180px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
  line-height: 1.25;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #111827;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.018);
}

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #111720;
  font-size: 12px;
  white-space: nowrap;
}

.pill.good {
  border-color: color-mix(in srgb, var(--good), transparent 40%);
  color: var(--good);
}

.pill.bad {
  border-color: color-mix(in srgb, var(--bad), transparent 40%);
  color: var(--bad);
}

.empty-row {
  color: var(--muted);
  text-align: center;
}

@media (max-width: 960px) {
  .dashboard-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions {
    justify-content: flex-start;
  }

  .filters,
  .summary-grid,
  .chart-grid {
    grid-template-columns: 1fr 1fr;
  }

  .chart-card-wide {
    grid-column: auto;
  }
}

@media (max-width: 620px) {
  .filters,
  .summary-grid,
  .chart-grid {
    grid-template-columns: 1fr;
  }

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

  .brand img {
    max-width: 100%;
  }
}
