.dashboard {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  padding: clamp(20px, 4vw, 30px);
  background: var(--surface-translucent);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  backdrop-filter: blur(16px);
  /* Per-test accent colors, scoped to this file only -- the app
     otherwise only has --primary (green) and --accent (gold); a third
     hue makes the IQ/EQ/AQ icons and left-accent bars tell apart from
     each other at a glance instead of every test looking the same. */
  --dash-iq: var(--primary);
  --dash-iq-soft: var(--primary-soft);
  --dash-eq: var(--accent);
  --dash-eq-soft: var(--accent-soft);
  --dash-aq: #4f9ad6;
  --dash-aq-soft: rgba(79, 154, 214, 0.16);
  --dash-other: var(--muted);
  --dash-other-soft: var(--surface-soft);
}

.dashboard-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.account-avatar {
  display: inline-flex;
  padding: 3px;
  background: linear-gradient(135deg, var(--primary), var(--accent-bright));
  border-radius: 999px;
}

.account-avatar-inner {
  display: flex;
  width: 52px;
  height: 52px;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border-radius: 999px;
  color: var(--text);
  font-size: 1.3rem;
  font-weight: 900;
}

.dashboard-head h1 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  letter-spacing: 0;
}

.dashboard-head p {
  margin: 2px 0 0;
  color: var(--muted);
}

.dashboard-head .panel-link {
  margin-left: auto;
  color: var(--muted);
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.dashboard-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.dashboard-stat-icon {
  display: flex;
  width: 38px;
  height: 38px;
  flex: none;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  border-radius: 999px;
  color: var(--primary-dark);
}

.dashboard-stat-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dashboard-stat strong {
  display: block;
  font-size: 1.3rem;
  line-height: 1.1;
}

.dashboard-stat span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.dashboard-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 20px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
}

.dashboard-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 1 0 auto;
  min-height: 42px;
  padding: 0 14px;
  white-space: nowrap;
  background: transparent;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  color: var(--muted);
  font-weight: 900;
  transition: background 0.15s ease, color 0.15s ease;
}

.dashboard-tab-icon {
  display: inline-flex;
}

.dashboard-tab-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.dashboard-panel {
  display: none;
}

.dashboard-panel.is-active {
  display: block;
}

.dashboard-empty {
  margin: 0;
  padding: 22px 16px;
  background: var(--surface-soft);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

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

.dashboard-history-row {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 14px 20px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-left: 4px solid var(--dash-other);
  border-radius: var(--radius);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.dashboard-history-row:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.dashboard-history-row.dashboard-test-iq {
  border-left-color: var(--dash-iq);
}

.dashboard-history-row.dashboard-test-eq {
  border-left-color: var(--dash-eq);
}

.dashboard-history-row.dashboard-test-aq {
  border-left-color: var(--dash-aq);
}

.dashboard-history-icon {
  display: flex;
  width: 38px;
  height: 38px;
  flex: none;
  align-items: center;
  justify-content: center;
  background: var(--dash-other-soft);
  border-radius: 999px;
  color: var(--dash-other);
}

.dashboard-test-iq .dashboard-history-icon {
  background: var(--dash-iq-soft);
  color: var(--dash-iq);
}

.dashboard-test-eq .dashboard-history-icon {
  background: var(--dash-eq-soft);
  color: var(--dash-eq);
}

.dashboard-test-aq .dashboard-history-icon {
  background: var(--dash-aq-soft);
  color: var(--dash-aq);
}

.dashboard-history-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dashboard-history-main {
  flex: 1 1 200px;
}

.dashboard-history-main h3 {
  margin: 0;
  font-size: 1.05rem;
}

.dashboard-history-main p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.dashboard-percentile {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  max-width: 220px;
}

.dashboard-percentile-track {
  flex: 1;
  height: 6px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.dashboard-percentile-fill {
  height: 100%;
  border-radius: inherit;
  /* Falls back to --dash-other for a test type with no dedicated color
     (there isn't one today, but this shouldn't go invisible if a fourth
     test ever shows up before its own accent color does) -- overridden
     per test type below, same scoping the left-accent-bar/icon use. */
  background: var(--dash-other);
}

.dashboard-test-iq .dashboard-percentile-fill {
  background: var(--dash-iq);
}

.dashboard-test-eq .dashboard-percentile-fill {
  background: var(--dash-eq);
}

.dashboard-test-aq .dashboard-percentile-fill {
  background: var(--dash-aq);
}

.dashboard-percentile span {
  flex: none;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

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

.dashboard-history-actions .deal-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dashboard-history-actions .deal-badge svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dashboard-history-actions .deal-badge.is-unpaid {
  background: var(--accent-soft);
  color: var(--accent-contrast);
}

.dashboard-favorites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.dashboard-profile-form {
  display: grid;
  gap: 12px;
  max-width: 480px;
}

.dashboard-field-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.dashboard-field-icon {
  display: inline-flex;
  width: 22px;
  height: 22px;
  flex: none;
  align-items: center;
  justify-content: center;
  background: var(--surface-soft);
  border-radius: 999px;
  color: var(--primary-dark);
}

.dashboard-field-icon svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 640px) {
  .dashboard-head {
    flex-wrap: wrap;
  }

  .dashboard-head .panel-link {
    margin-left: 0;
    width: 100%;
    text-align: center;
  }

  .dashboard-stats {
    grid-template-columns: 1fr;
  }

  .dashboard-history-row {
    flex-direction: column;
    align-items: flex-start;
  }
}
