/* ==========================================================================
   QT Trading Lab — dashboard (dashboard.html). Markup from qt-dashboard.js.
   Requires qt-tokens.css, qt-components.css and qt-shell.css.
   ========================================================================== */

.dash {
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 1120px;
  padding: 44px 44px 72px;
}

.dash-loading {
  margin: 48px 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--color-text-faint);
}

/* ---- Header ---- */
.dash-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px 28px;
  margin-bottom: 6px;
}

.dash-head-copy {
  min-width: 0;
}

.dash-head h1 {
  margin: 10px 0 8px;
  font-size: clamp(30px, 3.8vw, 42px);
  font-weight: var(--font-heading-weight);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.dash-summary {
  max-width: 60ch;
  margin: 0;
  font-size: 15px;
  color: var(--color-text-muted);
  text-wrap: pretty;
}

.dash-note {
  margin: 0;
  padding: 10px 14px;
  border-left: 2px solid var(--pl-warn);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: color-mix(in srgb, var(--pl-warn) 8%, transparent);
  font-size: 13.5px;
  color: var(--color-text);
}

/* ---- Stat tiles ---- */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.dash-stat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px;
}

.dash-stat-label,
.dash-next-kind,
.dash-card-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}

.dash-stat-value {
  font-size: 30px;
  font-weight: var(--font-heading-weight);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.dash-stat-value small {
  font-size: 15px;
  font-weight: 400;
  color: var(--color-text-faint);
}

.dash-stat-sub {
  font-size: 12px;
  line-height: 1.4;
  color: var(--color-text-faint);
}

.dash-stat .qt-progress {
  margin-top: 2px;
}

/* ---- Cards ---- */
.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  align-items: start;
  gap: 14px;
}

.dash-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 20px;
}

.dash-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.dash-card-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: var(--font-heading-weight);
}

.dash-card-head a {
  font-size: 12.5px;
  color: var(--color-accent-300);
  text-decoration: none;
}

.dash-card-head a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.dash-empty {
  margin: 0;
  font-size: 13.5px;
  color: var(--color-text-faint);
}

/* ---- Up next ---- */
.dash-next {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dash-next a {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: inherit;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.dash-next a:hover {
  background: color-mix(in srgb, var(--color-accent) 10%, transparent);
}

.dash-next li:first-child .dash-next-kind {
  color: var(--color-accent-300);
}

.dash-next-title {
  font-size: 14px;
  line-height: 1.35;
  color: var(--color-text);
}

.dash-next-meta {
  font-size: 12px;
  color: var(--color-text-muted);
}

/* ---- Courses ---- */
.dash-courses {
  display: flex;
  flex-direction: column;
}

.dash-course {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  background: linear-gradient(to right, transparent, var(--color-divider) 48px, var(--color-divider) calc(100% - 48px), transparent) no-repeat top / 100% 1px;
}

.dash-course:first-child {
  padding-top: 2px;
  background: none;
}

.dash-course-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.dash-course-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.dash-course h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: var(--font-heading-weight);
}

.dash-course-meta {
  margin: 0;
  font-size: 12px;
  color: var(--color-text-faint);
  font-variant-numeric: tabular-nums;
}

.dash-course .qt-btn {
  flex: none;
  min-height: 32px;
  padding: 6px 12px;
  font-size: 13px;
}

/* ---- Quiz results ---- */
.dash-quiz-course + .dash-quiz-course {
  margin-top: 10px;
}

.dash-quiz-course h3 {
  margin: 0 0 4px;
  font-size: 13.5px;
  font-weight: var(--font-heading-weight);
  color: var(--color-text-muted);
}

/* position: relative keeps the table's visually hidden header text (absolutely positioned)
   inside the scroll area; without it the text escapes and widens the page on phones. */
.dash-table-wrap {
  position: relative;
  overflow-x: auto;
}

.dash-table-wrap .qt-table {
  min-width: 520px;
}

.dash-table-wrap td:nth-child(2),
.dash-table-wrap td:nth-child(3) {
  white-space: nowrap;
}

.dash-module-num {
  margin-right: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-text-faint);
}

.dash-table-wrap td a {
  font-size: 13px;
  color: var(--color-accent-300);
  text-decoration: none;
  white-space: nowrap;
}

.dash-table-wrap td a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- Responsive ---- */
@media (max-width: 1023px) {
  .dash {
    padding: 36px 32px 60px;
  }

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

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

@media (max-width: 767px) {
  .dash {
    padding: 28px 18px 40px;
  }

  .dash-head .qt-btn {
    width: 100%;
  }

  .dash-stat {
    padding: 14px;
  }

  .dash-stat-value {
    font-size: 26px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dash-next a {
    transition: none;
  }
}
