.dashboard-page {
  min-height: 100dvh;
}

.dashboard-topbar {
  justify-content: space-between;
}

.dashboard-back {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 7px;
  padding: 0 13px;
  color: var(--green);
  background: rgba(255, 253, 248, 0.58);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  transition: background 150ms ease, transform 150ms ease;
}

.dashboard-back .icon {
  width: 15px;
  height: 15px;
}

.dashboard-back:active {
  transform: scale(0.97);
}

.dashboard-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 32px 0 max(56px, env(safe-area-inset-bottom));
}

.dashboard-hero {
  margin-bottom: 22px;
}

.dashboard-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding: 12px 3px 26px;
}

.dashboard-heading h1 {
  margin: 3px 0 6px;
  font-family: var(--serif);
  font-size: clamp(34px, 5vw, 54px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.dashboard-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.today-score {
  display: grid;
  min-width: 128px;
  grid-template-columns: auto auto;
  align-items: end;
  justify-content: end;
  column-gap: 6px;
  text-align: right;
}

.today-score span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.today-score strong {
  color: var(--green);
  font-family: var(--serif);
  font-size: 58px;
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 1;
}

.today-score small {
  padding-bottom: 7px;
  color: var(--faint);
  font-size: 11px;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  background: rgba(255, 253, 248, 0.6);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(43, 48, 39, 0.04);
}

.dashboard-stat {
  position: relative;
  display: grid;
  min-height: 122px;
  align-content: center;
  gap: 2px;
  padding: 20px 24px;
}

.dashboard-stat + .dashboard-stat {
  border-left: 1px solid var(--line-soft);
}

.dashboard-stat::before {
  position: absolute;
  top: 22px;
  bottom: 22px;
  left: 0;
  width: 2px;
  content: "";
  background: transparent;
  border-radius: 0 2px 2px 0;
}

.dashboard-stat.accent-green::before {
  background: var(--green);
}

.dashboard-stat.accent-orange::before {
  background: var(--orange);
}

.dashboard-stat > span {
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.04em;
}

.dashboard-stat strong {
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 500;
  line-height: 1.12;
}

.dashboard-stat small {
  color: var(--faint);
  font-size: 10px;
}

.dashboard-panel {
  padding: 22px;
  background: rgba(255, 253, 248, 0.64);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 12px 32px rgba(43, 48, 39, 0.04);
}

.dashboard-panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.dashboard-panel-heading h2 {
  margin: 1px 0 0;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 550;
  line-height: 1.25;
}

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

.dashboard-panel-heading p strong {
  color: var(--green);
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
}

.dashboard-panel-heading p span {
  margin: 0 4px;
  color: var(--line);
}

.heatmap-panel {
  margin-bottom: 22px;
}

.heatmap-scroll {
  overflow-x: auto;
  scrollbar-width: thin;
}

.heatmap-months {
  display: flex;
  gap: 3px;
  margin-left: 30px;
  margin-bottom: 6px;
}

.heatmap-months span {
  flex: 1;
  min-width: 8px;
  color: var(--faint);
  font-size: 8.5px;
  white-space: nowrap;
}

.heatmap-body {
  display: flex;
  gap: 8px;
  min-width: 300px;
}

.heatmap-weekdays {
  display: grid;
  width: 22px;
  flex: 0 0 22px;
  grid-template-rows: repeat(7, 12px);
  gap: 3px;
}

.heatmap-weekdays span {
  align-self: center;
  color: var(--faint);
  font-size: 8px;
  line-height: 1;
}

.heatmap-weeks {
  display: flex;
  flex: 1;
  gap: 3px;
}

.heatmap-week {
  display: grid;
  min-width: 8px;
  flex: 1;
  grid-template-rows: repeat(7, 12px);
  gap: 3px;
}

.heatmap-cell {
  display: block;
  width: 100%;
  min-width: 8px;
  aspect-ratio: 1;
  background: #eae4d8;
  border: 1px solid rgba(201, 192, 176, 0.28);
  border-radius: 3px;
}

.heatmap-cell.level-1,
.heatmap-legend .level-1 {
  background: #d7e6de;
  border-color: #d1dfd7;
}

.heatmap-cell.level-2,
.heatmap-legend .level-2 {
  background: #a7c8b7;
  border-color: #a3c2b2;
}

.heatmap-cell.level-3,
.heatmap-legend .level-3 {
  background: #5f977c;
  border-color: #5f977c;
}

.heatmap-cell.level-4,
.heatmap-legend .level-4 {
  background: var(--green);
  border-color: var(--green);
}

.heatmap-cell.is-future {
  background: transparent;
  border-color: transparent;
}

.heatmap-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  color: var(--faint);
  font-size: 9px;
}

.heatmap-legend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.heatmap-legend i {
  display: block;
  width: 10px;
  height: 10px;
  background: #eae4d8;
  border: 1px solid rgba(201, 192, 176, 0.28);
  border-radius: 2px;
}

.dashboard-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.75fr);
  gap: 22px;
  align-items: start;
}

.dashboard-panel-heading.compact {
  margin-bottom: 12px;
}

.today-list {
  display: grid;
}

.today-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 2px;
  border-top: 1px solid var(--line-soft);
}

.today-item:first-child {
  border-top: 0;
}

.today-kind {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 9px 9px 9px 3px;
  font-size: 10px;
  font-weight: 700;
}

.today-kind.is-review {
  color: #8a551d;
  background: var(--orange-soft);
}

.today-copy {
  min-width: 0;
}

.today-copy strong {
  display: block;
  overflow: hidden;
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-copy small {
  display: block;
  overflow: hidden;
  margin-top: 1px;
  color: var(--faint);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-rating {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 650;
}

.today-rating.skilled {
  color: var(--green);
  background: var(--green-soft);
}

.today-rating.fuzzy {
  color: #87621e;
  background: #f3ead7;
}

.today-rating.forgotten {
  color: #8b4d41;
  background: #f4e6e1;
}

.today-empty {
  display: grid;
  min-height: 220px;
  place-items: center;
  padding: 30px;
  text-align: center;
}

.today-empty div {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.today-empty strong {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
}

.today-empty p {
  max-width: 260px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.today-empty a {
  min-height: 44px;
  margin-top: 8px;
  padding: 10px 17px;
  color: #fffdf7;
  background: var(--green);
  border-radius: 11px;
  font-size: 11px;
  font-weight: 650;
}

.rating-breakdown {
  display: grid;
  gap: 15px;
  padding: 3px 0 20px;
}

.rating-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 26px;
  align-items: center;
  gap: 10px;
}

.rating-row > span {
  color: var(--muted);
  font-size: 10px;
}

.rating-row > strong {
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.rating-track {
  height: 6px;
  overflow: hidden;
  background: var(--line-soft);
  border-radius: 999px;
}

.rating-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  transition: width 400ms ease;
}

.rating-track .skilled {
  background: var(--green);
}

.rating-track .fuzzy {
  background: var(--gold);
}

.rating-track .forgotten {
  background: #a76150;
}

.dashboard-goals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.dashboard-goals > span {
  grid-column: 1 / -1;
  color: var(--faint);
  font-size: 9.5px;
  letter-spacing: 0.06em;
}

.dashboard-goals > div {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 11px;
  background: rgba(245, 240, 229, 0.6);
  border-radius: 10px;
}

.dashboard-goals small {
  color: var(--muted);
  font-size: 9.5px;
}

.dashboard-goals strong {
  color: var(--green);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 820px) {
  .dashboard-shell {
    width: min(100% - 24px, 680px);
    padding-top: 18px;
  }

  .dashboard-heading {
    align-items: flex-start;
    padding-top: 8px;
  }

  .dashboard-heading h1 {
    font-size: clamp(32px, 10vw, 42px);
  }

  .today-score strong {
    font-size: 46px;
  }

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

  .dashboard-stat {
    min-height: 102px;
    padding: 16px 18px;
  }

  .dashboard-stat:nth-child(3) {
    border-left: 0;
  }

  .dashboard-stat:nth-child(n + 3) {
    border-top: 1px solid var(--line-soft);
  }

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

  .dashboard-panel {
    padding: 17px;
  }

  .dashboard-panel-heading {
    margin-bottom: 16px;
  }

  .dashboard-panel-heading h2 {
    font-size: 20px;
  }

  .heatmap-footer {
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .dashboard-topbar {
    padding-right: 12px;
    padding-left: 12px;
  }

  .dashboard-back {
    min-height: 40px;
    padding: 0 11px;
  }

  .dashboard-back span {
    display: none;
  }

  .dashboard-heading {
    gap: 12px;
    padding-bottom: 19px;
  }

  .dashboard-heading h1 {
    margin-top: 2px;
    font-size: 34px;
  }

  .dashboard-heading p {
    max-width: 190px;
    font-size: 10.5px;
  }

  .today-score {
    min-width: 82px;
  }

  .today-score strong {
    font-size: 40px;
  }

  .today-score small {
    padding-bottom: 4px;
    font-size: 9.5px;
  }

  .dashboard-stats,
  .heatmap-panel,
  .dashboard-columns .dashboard-panel {
    border-radius: 15px;
  }

  .dashboard-stat {
    min-height: 96px;
    padding: 13px 15px;
  }

  .dashboard-stat strong {
    font-size: 29px;
  }

  .dashboard-stat small {
    font-size: 9.5px;
  }

  .heatmap-panel {
    margin-bottom: 14px;
  }

  .heatmap-months {
    margin-left: 27px;
  }

  .heatmap-body {
    gap: 6px;
  }

  .heatmap-weekdays {
    width: 19px;
    flex-basis: 19px;
  }

  .heatmap-weekdays span {
    font-size: 7.5px;
  }

  .heatmap-weeks,
  .heatmap-months {
    gap: 2px;
  }

  .heatmap-week {
    gap: 2px;
  }

  .heatmap-cell {
    min-width: 7px;
    border-radius: 2px;
  }

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

  .dashboard-panel-heading p {
    max-width: 125px;
    font-size: 9.5px;
    line-height: 1.5;
    text-align: right;
  }

  .today-item {
    grid-template-columns: 31px minmax(0, 1fr) auto;
    gap: 9px;
    padding: 12px 0;
  }

  .today-kind {
    width: 30px;
    height: 30px;
  }

  .today-copy strong {
    font-size: 13px;
  }

  .heatmap-footer {
    display: grid;
    gap: 8px;
  }
}
