/* === Dashboard === */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}
.dashboard-grid > .card { grid-column: span 12; }
@media (min-width: 760px) {
  .col-6 { grid-column: span 6 !important; }
  .col-4 { grid-column: span 4 !important; }
  .col-8 { grid-column: span 8 !important; }
}

/* Heatmap (calendar) */

.heatmap-wrap { overflow-x: auto; padding-bottom: 6px; }
.heatmap {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 14px);
  gap: 3px;
  min-height: 110px;
}
.heatmap-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--surface-3);
  transition: transform 0.1s ease, outline 0.1s ease;
  cursor: default;
}
.heatmap-cell.l1 { background: #c2ecff; }
.heatmap-cell.l2 { background: #6cc6ec; }
.heatmap-cell.l3 { background: #2d8fb9; }
.heatmap-cell.l4 { background: #ff9eb5; }
:root[data-theme="dark"] .heatmap-cell,
:root[data-theme="auto"] .heatmap-cell { background: #1a2d44; }
:root[data-theme="dark"] .heatmap-cell.l1,
:root[data-theme="auto"] .heatmap-cell.l1 { background: #2d5a85; }
:root[data-theme="dark"] .heatmap-cell.l2,
:root[data-theme="auto"] .heatmap-cell.l2 { background: #4a8fbf; }
:root[data-theme="dark"] .heatmap-cell.l3,
:root[data-theme="auto"] .heatmap-cell.l3 { background: #6cc6ec; }
:root[data-theme="dark"] .heatmap-cell.l4,
:root[data-theme="auto"] .heatmap-cell.l4 { background: #ff9eb5; }

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .heatmap-cell { background: #1a2d44; }
  :root[data-theme="auto"] .heatmap-cell.l1 { background: #2d5a85; }
}

.heatmap-cell:hover { transform: scale(1.5); outline: 2px solid var(--ink); }

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 11px;
  color: var(--ink-mute);
}
.heatmap-legend .scale {
  display: flex;
  gap: 3px;
}
.heatmap-legend .scale .heatmap-cell {
  width: 12px; height: 12px;
}

.heatmap-months {
  display: flex;
  font-size: 10px;
  color: var(--ink-mute);
  margin-top: 4px;
  padding-left: 24px;
  user-select: none;
}

.heatmap-row-labels {
  display: grid;
  grid-template-rows: repeat(7, 14px);
  gap: 3px;
  font-size: 9px;
  color: var(--ink-mute);
  text-align: right;
  padding-right: 4px;
}

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

/* === Podium === */

.podium {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 22px;
}
.podium-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 14px 16px;
  text-align: center;
  border: 3px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: relative;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.podium-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.podium-card.rank-1 { border-color: var(--gold); transform: translateY(-6px); }
.podium-card.rank-2 { border-color: var(--silver); }
.podium-card.rank-3 { border-color: var(--bronze); }
.podium-card.rank-1:hover { transform: translateY(-10px); }
.podium-medal { font-size: 28px; line-height: 1; margin-bottom: 6px; }
.podium-card .song-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 2px;
  word-break: break-word;
  line-height: 1.4;
}
.podium-card .song-artist {
  font-size: 11.5px;
  color: var(--ink-mute);
  margin-bottom: 10px;
  word-break: break-word;
}
.podium-card .count-big {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary-strong);
  line-height: 1;
  font-feature-settings: var(--tnum);
}
.podium-card .count-big small {
  font-size: 12px;
  color: var(--ink-mute);
  font-weight: 500;
  margin-left: 2px;
}
.podium-card .last-sung {
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--ink-mute);
}

/* === Song list (rows) === */

.song-list {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 2px solid var(--border-soft);
}
.song-row {
  display: grid;
  grid-template-columns: 52px 1fr 90px 120px;
  align-items: center;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background 0.12s ease;
  gap: 10px;
}
.song-row:last-child { border-bottom: none; }
.song-row:hover { background: var(--surface-2); }
.song-row .rank {
  font-weight: 700;
  color: var(--primary-strong);
  font-size: 16px;
  text-align: center;
  font-feature-settings: var(--tnum);
}
.song-row .rank.r1 { color: var(--gold); }
.song-row .rank.r2 { color: var(--silver); }
.song-row .rank.r3 { color: var(--bronze); }
.song-row .info { min-width: 0; }
.song-row .title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  word-break: break-word;
}
.song-row .artist {
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 2px;
  word-break: break-word;
}
.song-row .count {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-strong);
  text-align: right;
  font-feature-settings: var(--tnum);
}
.song-row .count small {
  font-size: 11px;
  color: var(--ink-mute);
  font-weight: 500;
  margin-left: 1px;
}
.song-row .last {
  font-size: 11px;
  color: var(--ink-mute);
  text-align: right;
  line-height: 1.4;
}
.song-row .last .badge { margin-top: 2px; }

@media (max-width: 600px) {
  .song-row {
    grid-template-columns: 38px 1fr;
    grid-template-rows: auto auto;
    gap: 4px 10px;
  }
  .song-row .rank { grid-row: 1 / 3; align-self: start; padding-top: 4px; font-size: 14px; }
  .song-row .info { grid-column: 2; }
  .song-row .count { grid-column: 2; text-align: left; font-size: 13px; }
  .song-row .last { grid-column: 2; text-align: left; }
}

/* === Timeline === */

.timeline {
  position: relative;
  padding-left: 24px;
}
.timeline::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 8px;
  width: 3px;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  border-radius: 2px;
}
.timeline-item {
  position: relative;
  margin-bottom: 16px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 18px;
  border: 2px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.timeline-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}
.timeline-item::before {
  content: "";
  position: absolute;
  top: 22px;
  left: -22px;
  width: 14px;
  height: 14px;
  background: var(--primary);
  border: 3px solid var(--surface);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
.timeline-item.recent::before { background: var(--accent); }
.timeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.timeline-date {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-strong);
  font-feature-settings: var(--tnum);
}
.timeline-stream-no {
  font-size: 11px;
  color: var(--ink-mute);
  background: var(--surface-3);
  padding: 1px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.timeline-songcount {
  font-size: 11px;
  color: var(--accent-strong);
  font-weight: 600;
}
.timeline-title {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 10px;
  word-break: break-word;
  line-height: 1.5;
}
.timeline-title a {
  color: var(--primary-strong);
  border-bottom: 1px dashed var(--border-strong);
}
.timeline-title a:hover { border-bottom-style: solid; text-decoration: none; }

.watch-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #ff5b5b, var(--red));
  color: #fff !important;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  margin-left: auto;
  white-space: nowrap;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.watch-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(226, 57, 57, 0.35);
  text-decoration: none !important;
}

.setlist {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.setlist-song {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11.5px;
  color: var(--ink-soft);
  word-break: break-all;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}
.setlist-song:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--ink);
}
.setlist-song:active { transform: scale(0.97); }
.setlist-song.hit {
  background: var(--accent-soft);
  border-color: var(--accent-strong);
  color: var(--accent-strong);
  font-weight: 700;
}
.setlist-song .sl-num {
  color: var(--primary-strong);
  font-weight: 700;
  margin-right: 4px;
}
.setlist-song.hit .sl-num { color: var(--accent-strong); }

.timeline-controls {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

@media (max-width: 600px) {
  .timeline { padding-left: 18px; }
  .timeline-item::before { left: -18px; }
  .timeline-item { padding: 14px 14px; }
}

/* === Charts === */

.chart-wrap {
  position: relative;
  width: 100%;
  height: 280px;
}
.chart-wrap.short { height: 200px; }
.chart-wrap.tall { height: 360px; }
.chart-wrap canvas {
  max-width: 100% !important;
  height: 100% !important;
}

/* === Analytics tags === */

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11.5px;
  color: var(--ink-soft);
  transition: all 0.1s ease;
}
.tag.clickable {
  cursor: pointer;
  user-select: none;
}
.tag.clickable:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-strong);
}
.tag .tag-num {
  display: inline-block;
  margin-left: 6px;
  background: var(--primary-strong);
  color: #fff;
  border-radius: 999px;
  padding: 0 6px;
  font-size: 10.5px;
  font-weight: 700;
}

/* Recent activity list */
.activity-row {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 12.5px;
}
.activity-row:last-child { border-bottom: none; }
.activity-row .a-date {
  font-weight: 700;
  color: var(--primary-strong);
  font-feature-settings: var(--tnum);
}
.activity-row .a-title {
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.activity-row .a-meta { color: var(--ink-mute); font-size: 11px; }
.activity-row a { color: var(--ink); }

/* Top-list with bars */
.bar-list .bar-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 13px;
  cursor: default;
}
.bar-list .bar-row.clickable { cursor: pointer; }
.bar-list .bar-row.clickable:hover .bar-bar { filter: brightness(1.1); }
.bar-list .bar-rank {
  font-weight: 700;
  font-size: 12px;
  color: var(--ink-mute);
  text-align: center;
  font-feature-settings: var(--tnum);
}
.bar-list .bar-content {
  min-width: 0;
}
.bar-list .bar-label {
  font-size: 12.5px;
  color: var(--ink);
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-list .bar-bar {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-strong));
  transition: filter 0.12s ease;
}
.bar-list .bar-bar.accent {
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
}
.bar-list .bar-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-strong);
  font-feature-settings: var(--tnum);
}
