/**
 * SpoTics — Production Stylesheet
 * Design System: Dark theme with purple accent (#8B5CF6)
 * Fonts: DM Sans (UI), JetBrains Mono (data)
 */

/* ═══════════════════════════════════════════════
   1. CSS CUSTOM PROPERTIES (Design Tokens)
   ═══════════════════════════════════════════════ */

:root {
  /* Surfaces */
  --bg:       #0A0A0F;
  --surface:  #111118;
  --surface2: #1A1A24;
  --surface3: #22222F;

  /* Borders */
  --border:   rgba(255, 255, 255, 0.07);
  --border2:  rgba(255, 255, 255, 0.12);

  /* Text */
  --text:     #F0F0FF;
  --text2:    #8888AA;
  --text3:    #4A4A6A;

  /* Accent (purple) */
  --accent:   #8B5CF6;
  --accent2:  #A78BFA;
  --accent3:  rgba(139, 92, 246, 0.15);
  --accent4:  rgba(139, 92, 246, 0.08);

  /* Semantic */
  --danger:   #F87171;
  --success:  #34D399;
  --amber:    #FBBF24;

  /* Layout */
  --sidebar:  240px;
  --r:        12px;
  --r-lg:     18px;

  /* Motion */
  --ease:     cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Light Mode Overrides ─────────────────────── */

body.light {
  --bg:       #F5F5F7;
  --surface:  #FFFFFF;
  --surface2: #EAEAF0;
  --surface3: #DDDDE6;
  --border:   rgba(0, 0, 0, 0.08);
  --border2:  rgba(0, 0, 0, 0.14);
  --text:     #1A1A2E;
  --text2:    #5A5A7A;
  --text3:    #9090AA;
  --accent3:  rgba(139, 92, 246, 0.12);
  --accent4:  rgba(139, 92, 246, 0.06);
}

/* ═══════════════════════════════════════════════
   2. BASE / RESET
   ═══════════════════════════════════════════════ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg, #0A0A0F);
  color: var(--text, #F0F0FF);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ═══════════════════════════════════════════════
   3. SIDEBAR
   ═══════════════════════════════════════════════ */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar, 240px);
  background: var(--surface, #111118);
  border-right: 1px solid var(--border, rgba(255,255,255,0.07));
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}

/* ── Logo ─────────────────────────────────────── */

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.4rem 0.75rem 1.8rem;
}

.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent, #8B5CF6);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.logo-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 18px;
  padding: 0 4px;
}

.logo-bar {
  width: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.9);
  animation: logoPulse 1.4s ease-in-out infinite;
}

.logo-bar:nth-child(1) { height: 6px;  animation-delay: 0s;   }
.logo-bar:nth-child(2) { height: 14px; animation-delay: 0.2s; }
.logo-bar:nth-child(3) { height: 10px; animation-delay: 0.4s; }
.logo-bar:nth-child(4) { height: 16px; animation-delay: 0.1s; }
.logo-bar:nth-child(5) { height: 8px;  animation-delay: 0.3s; }

@keyframes logoPulse {
  0%, 100% { transform: scaleY(1);   }
  50%      { transform: scaleY(0.5); }
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text, #F0F0FF) 40%, var(--accent2, #A78BFA));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-sub {
  font-size: 0.65rem;
  color: var(--text3, #4A4A6A);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-left: 1px;
}

/* ── Navigation ───────────────────────────────── */

.nav-section {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text3, #4A4A6A);
  text-transform: uppercase;
  padding: 0 0.75rem;
  margin-bottom: 0.4rem;
}

.nav-gap {
  margin-top: 1.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.65rem 0.75rem;
  border-radius: var(--r, 12px);
  color: var(--text2, #8888AA);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s cubic-bezier(0.4,0,0.2,1);
  position: relative;
  margin-bottom: 2px;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.7;
  flex-shrink: 0;
}

.nav-item:hover {
  color: var(--text, #F0F0FF);
  background: var(--surface2, #1A1A24);
}

.nav-item.active {
  color: var(--accent2, #A78BFA);
  background: var(--accent4, rgba(139,92,246,0.08));
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent, #8B5CF6);
}

.nav-badge {
  margin-left: auto;
  background: var(--accent3, rgba(139,92,246,0.15));
  color: var(--accent2, #A78BFA);
  font-size: 0.65rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  padding: 2px 7px;
  border-radius: 99px;
}

/* ── Sidebar Footer ───────────────────────────── */

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border, rgba(255,255,255,0.07));
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.6rem 0.75rem;
  border-radius: var(--r, 12px);
  transition: background 0.15s;
  cursor: default;
}

.user-chip:hover {
  background: var(--surface2, #1A1A24);
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent, #8B5CF6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text, #F0F0FF);
}

.user-status {
  font-size: 0.7rem;
  color: var(--text3, #4A4A6A);
}

.user-status.live::before {
  content: '●';
  color: var(--success, #34D399);
  margin-right: 4px;
  font-size: 0.5rem;
  animation: blink 2s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1;   }
  50%      { opacity: 0.3; }
}

/* ── Theme Toggle ─────────────────────────────── */

.theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  margin-top: 4px;
}

.theme-label {
  font-size: 0.75rem;
  color: var(--text3, #4A4A6A);
}

.theme-toggle {
  width: 38px;
  height: 20px;
  border-radius: 99px;
  background: var(--surface3, #22222F);
  border: 1px solid var(--border2, rgba(255,255,255,0.12));
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
}

.theme-toggle.light-on {
  background: var(--amber, #FBBF24);
}

.theme-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.theme-toggle.light-on .theme-knob {
  transform: translateX(18px);
}

/* ═══════════════════════════════════════════════
   4. MAIN CONTENT AREA
   ═══════════════════════════════════════════════ */

.main {
  margin-left: var(--sidebar, 240px);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page {
  display: none;
  flex: 1;
  padding: 2rem 2.5rem;
  animation: fadeIn 0.2s cubic-bezier(0.4,0,0.2,1);
}

.page.active {
  display: flex;
  flex-direction: column;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none;           }
}

/* ═══════════════════════════════════════════════
   5. PAGE HEADER
   ═══════════════════════════════════════════════ */

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text, #F0F0FF);
  line-height: 1.1;
}

.page-sub {
  font-size: 0.85rem;
  color: var(--text3, #4A4A6A);
  margin-top: 4px;
  font-weight: 400;
}

.head-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════
   6. BUTTONS
   ═══════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.55rem 1.1rem;
  border-radius: var(--r, 12px);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  border: none;
  transition: all 0.15s cubic-bezier(0.4,0,0.2,1);
  white-space: nowrap;
}

.btn svg {
  width: 15px;
  height: 15px;
  stroke-width: 2;
}

.btn-primary {
  background: var(--accent, #8B5CF6);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent2, #A78BFA);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text2, #8888AA);
  border: 1px solid var(--border2, rgba(255,255,255,0.12));
}

.btn-ghost:hover {
  background: var(--surface2, #1A1A24);
  color: var(--text, #F0F0FF);
  border-color: var(--border2, rgba(255,255,255,0.12));
}

.btn-danger {
  background: transparent;
  color: var(--danger, #F87171);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.1);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}

/* ═══════════════════════════════════════════════
   7. STATS GRID
   ═══════════════════════════════════════════════ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--surface, #111118);
  border: 1px solid var(--border, rgba(255,255,255,0.07));
  border-radius: var(--r-lg, 18px);
  padding: 1.25rem 1.4rem;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
  cursor: default;
}

.stat-card:hover {
  border-color: var(--border2, rgba(255,255,255,0.12));
  transform: translateY(-2px);
}

/* Gradient overlay accent */
.stat-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent4, rgba(139,92,246,0.08)) 0%, transparent 60%);
  pointer-events: none;
}

.stat-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent3, rgba(139,92,246,0.15));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.9rem;
}

.stat-icon svg {
  width: 17px;
  height: 17px;
  stroke: var(--accent2, #A78BFA);
  stroke-width: 1.8;
}

.stat-val {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  font-family: 'DM Sans', sans-serif;
  color: var(--text, #F0F0FF);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text3, #4A4A6A);
  margin-top: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-delta {
  position: absolute;
  top: 1.25rem;
  right: 1.1rem;
  font-size: 0.7rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--success, #34D399);
  background: rgba(52, 211, 153, 0.1);
  padding: 2px 7px;
  border-radius: 99px;
}

/* ═══════════════════════════════════════════════
   8. DASHBOARD GRID
   ═══════════════════════════════════════════════ */

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1.25rem;
  flex: 1;
}

.dash-grid .col-right {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ═══════════════════════════════════════════════
   9. CARD
   ═══════════════════════════════════════════════ */

.card {
  background: var(--surface, #111118);
  border: 1px solid var(--border, rgba(255,255,255,0.07));
  border-radius: var(--r-lg, 18px);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.07));
}

.card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text, #F0F0FF);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 7px;
}

.card-title svg {
  width: 15px;
  height: 15px;
  stroke: var(--accent, #8B5CF6);
  stroke-width: 2;
}

.card-body {
  padding: 1.25rem 1.4rem;
}

.card-ctrl {
  font-size: 0.75rem;
  color: var(--text3, #4A4A6A);
  display: flex;
  gap: 0.5rem;
}

.card-tab {
  padding: 3px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}

.card-tab:hover {
  color: var(--text, #F0F0FF);
  background: var(--surface2, #1A1A24);
}

.card-tab.active {
  color: var(--accent2, #A78BFA);
  background: var(--accent4, rgba(139,92,246,0.08));
}

/* ═══════════════════════════════════════════════
   10. CHART
   ═══════════════════════════════════════════════ */

.chart-wrap {
  position: relative;
  padding: 1rem 1.4rem 1.4rem;
}

canvas.main-chart {
  width: 100% !important;
  display: block;
}

/* ═══════════════════════════════════════════════
   11. FREQUENCY BARS (Now Playing visualizer)
   ═══════════════════════════════════════════════ */

.freq-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 24px;
}

.freq-bar {
  width: 4px;
  border-radius: 3px 3px 0 0;
  background: var(--accent2, #A78BFA);
  animation: freqAnim 0.8s ease-in-out infinite alternate;
}

.freq-bar:nth-child(1) { animation-delay: 0.0s; }
.freq-bar:nth-child(2) { animation-delay: 0.1s; }
.freq-bar:nth-child(3) { animation-delay: 0.2s; }
.freq-bar:nth-child(4) { animation-delay: 0.15s; }
.freq-bar:nth-child(5) { animation-delay: 0.05s; }
.freq-bar:nth-child(6) { animation-delay: 0.25s; }
.freq-bar:nth-child(7) { animation-delay: 0.1s; }
.freq-bar:nth-child(8) { animation-delay: 0.3s; }

@keyframes freqAnim {
  from { height: 4px;   }
  to   { height: 100%;  }
}

.freq-bars.paused .freq-bar {
  animation-play-state: paused;
}

/* ═══════════════════════════════════════════════
   12. NOW PLAYING
   ═══════════════════════════════════════════════ */

.now-playing {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem 1.4rem;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.12) 0%, var(--surface, #111118) 100%);
}

.np-cover {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--surface3, #22222F);
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border, rgba(255,255,255,0.07));
}

.np-info {
  flex: 1;
  min-width: 0;
}

.np-status {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--accent2, #A78BFA);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.np-track {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text, #F0F0FF);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.np-artist {
  font-size: 0.8rem;
  color: var(--text2, #8888AA);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.np-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent2, #A78BFA);
  background: var(--accent3, rgba(139,92,246,0.15));
  padding: 3px 8px;
  border-radius: 99px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.np-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent, #8B5CF6);
  animation: blink 1.5s infinite;
}

.recent-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text2, #8888AA);
  padding: 0.6rem 1.4rem 0.2rem;
  letter-spacing: 0.02em;
}

/* ═══════════════════════════════════════════════
   13. TRACK LIST
   ═══════════════════════════════════════════════ */

.track-list {
  list-style: none;
}

.track-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.6rem 1.4rem;
  transition: background 0.12s;
  cursor: default;
}

.track-item:hover {
  background: var(--surface2, #1A1A24);
}

.track-num {
  width: 20px;
  text-align: right;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text3, #4A4A6A);
  flex-shrink: 0;
}

.track-cover {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface3, #22222F);
  border: 1px solid var(--border, rgba(255,255,255,0.07));
  flex-shrink: 0;
}

.track-info {
  flex: 1;
  min-width: 0;
}

.track-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text, #F0F0FF);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-artist {
  font-size: 0.75rem;
  color: var(--text3, #4A4A6A);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-time {
  font-size: 0.72rem;
  color: var(--text3, #4A4A6A);
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}

.track-empty {
  padding: 2.5rem 1.4rem;
  text-align: center;
  color: var(--text3, #4A4A6A);
  font-size: 0.85rem;
}

/* ── Track delta indicators ───────────────────── */

.track-delta {
  font-size: 0.68rem;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}

.track-delta.up   { color: #22c55e; }
.track-delta.down { color: #ef4444; }
.track-delta.same { color: var(--text3, #4A4A6A); }

/* ═══════════════════════════════════════════════
   14. ARTIST LIST (with bar chart)
   ═══════════════════════════════════════════════ */

.artist-list {
  padding: 0 1.4rem 1.2rem;
}

.artist-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0.75rem;
}

.artist-rank {
  font-size: 0.7rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text3, #4A4A6A);
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}

.artist-info {
  flex: 1;
  min-width: 0;
}

.artist-name {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text, #F0F0FF);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.artist-bar-wrap {
  height: 4px;
  background: var(--surface3, #22222F);
  border-radius: 99px;
  overflow: hidden;
}

.artist-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent, #8B5CF6), var(--accent2, #A78BFA));
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}

.artist-count {
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent2, #A78BFA);
  flex-shrink: 0;
  font-weight: 600;
}

.artist-delta {
  font-size: 0.68rem;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}

.artist-delta.up   { color: #22c55e; }
.artist-delta.down { color: #ef4444; }
.artist-delta.same { color: var(--text3, #4A4A6A); }

/* ═══════════════════════════════════════════════
   15. CALENDAR HEATMAP
   ═══════════════════════════════════════════════ */

.heatmap-wrap {
  padding: 0 1.4rem 1.4rem;
  overflow-x: auto;
}

.heatmap {
  display: flex;
  gap: 3px;
}

.heatmap-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.heatmap-cell {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--surface3, #22222F);
  transition: background 0.2s;
  cursor: default;
}

.heatmap-cell.l1 { background: rgba(139, 92, 246, 0.25); }
.heatmap-cell.l2 { background: rgba(139, 92, 246, 0.5);  }
.heatmap-cell.l3 { background: rgba(139, 92, 246, 0.75); }
.heatmap-cell.l4 { background: var(--accent, #8B5CF6);    }

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 1.4rem 0;
  font-size: 0.7rem;
  color: var(--text3, #4A4A6A);
}

.heatmap-legend-cell {
  width: 9px;
  height: 9px;
  border-radius: 2px;
}

/* ═══════════════════════════════════════════════
   16. MINI STAT ROW
   ═══════════════════════════════════════════════ */

.mini-stat-row {
  display: flex;
  gap: 1rem;
  padding: 0 1.4rem 1.2rem;
}

.mini-stat {
  text-align: center;
  flex: 1;
  padding: 0.75rem;
  background: var(--surface2, #1A1A24);
  border-radius: var(--r, 12px);
}

.mini-stat-val {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text, #F0F0FF);
  font-family: 'JetBrains Mono', monospace;
}

.mini-stat-lbl {
  font-size: 0.65rem;
  color: var(--text3, #4A4A6A);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 3px;
}

/* ═══════════════════════════════════════════════
   17. ALBUM GRID
   ═══════════════════════════════════════════════ */

.album-list {
  padding: 0 1.4rem 1.2rem;
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  padding: 0 1.4rem 1.2rem;
}

.album-card {
  background: var(--surface, #111118);
  border: 1px solid var(--border, rgba(255,255,255,0.07));
  border-radius: var(--r, 12px);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.album-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.album-cover {
  aspect-ratio: 1 / 1;
  background: var(--surface3, #22222F);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.album-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.album-cover .no-cover {
  font-size: 0.7rem;
  color: var(--text3, #4A4A6A);
  padding: 0.5rem;
  text-align: center;
}

.album-meta {
  padding: 0.6rem 0.75rem 0.8rem;
}

.album-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text, #F0F0FF);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.album-artist {
  font-size: 0.7rem;
  color: var(--text3, #4A4A6A);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════
   18. STREAK WIDGET
   ═══════════════════════════════════════════════ */

.streak-widget {
  margin-top: 0.6rem;
}

.streak-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.streak-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent, #8B5CF6) 15%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent, #8B5CF6);
}

.streak-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text, #F0F0FF);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.streak-count {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text, #F0F0FF);
  line-height: 1;
  margin-bottom: 4px;
}

.streak-count span {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text2, #8888AA);
  margin-left: 4px;
}

.streak-sub {
  font-size: 0.65rem;
  color: var(--text3, #4A4A6A);
  margin-bottom: 10px;
}

.streak-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.streak-dot {
  aspect-ratio: 1 / 1;
  border-radius: 4px;
  background: var(--surface3, #22222F);
}

.streak-dot.active {
  background: var(--accent, #8B5CF6);
}

.streak-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.6rem;
  color: var(--text3, #4A4A6A);
}

.streak-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.streak-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--surface3, #22222F);
}

.streak-legend-dot.active {
  background: var(--accent, #8B5CF6);
}

/* ═══════════════════════════════════════════════
   19. HISTORY PAGE
   ═══════════════════════════════════════════════ */

.history-toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

/* ── Search ───────────────────────────────────── */

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  stroke: var(--text3, #4A4A6A);
  stroke-width: 2;
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: var(--surface, #111118);
  border: 1px solid var(--border2, rgba(255,255,255,0.12));
  border-radius: var(--r, 12px);
  color: var(--text, #F0F0FF);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  padding: 0.6rem 0.9rem 0.6rem 2.2rem;
  transition: border-color 0.15s;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent, #8B5CF6);
}

.search-input::placeholder {
  color: var(--text3, #4A4A6A);
}

/* ── Sort Select ──────────────────────────────── */

.sort-select {
  background: var(--surface, #111118);
  border: 1px solid var(--border2, rgba(255,255,255,0.12));
  border-radius: var(--r, 12px);
  color: var(--text, #F0F0FF);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
}

.sort-select:focus {
  outline: none;
  border-color: var(--accent, #8B5CF6);
}

/* ── History Table ────────────────────────────── */

.history-table-wrap {
  background: var(--surface, #111118);
  border: 1px solid var(--border, rgba(255,255,255,0.07));
  border-radius: var(--r-lg, 18px);
  overflow: hidden;
  flex: 1;
}

.history-track-item {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.7rem 1.4rem;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.07));
  transition: background 0.12s;
}

.history-track-item:last-child {
  border-bottom: none;
}

.history-track-item:hover {
  background: var(--surface2, #1A1A24);
}

/* ═══════════════════════════════════════════════
   20. SETTINGS PAGE
   ═══════════════════════════════════════════════ */

.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 620px;
}

.settings-section {
  background: var(--surface, #111118);
  border: 1px solid var(--border, rgba(255,255,255,0.07));
  border-radius: var(--r-lg, 18px);
}

.settings-section-head {
  padding: 1rem 1.4rem;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.07));
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text2, #8888AA);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.4rem;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.07));
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row-label {
  font-size: 0.875rem;
  color: var(--text, #F0F0FF);
  font-weight: 500;
}

.settings-row-sub {
  font-size: 0.75rem;
  color: var(--text3, #4A4A6A);
  margin-top: 2px;
}

/* ── Toggle Switch (new version) ──────────────── */

.toggle-switch {
  width: 42px;
  height: 22px;
  border-radius: 99px;
  background: var(--surface3, #22222F);
  border: 1px solid var(--border2, rgba(255,255,255,0.12));
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-switch.on {
  background: var(--accent, #8B5CF6);
}

.toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s cubic-bezier(0.4,0,0.2,1);
}

.toggle-switch.on .toggle-knob {
  transform: translateX(20px);
}

/* ═══════════════════════════════════════════════
   21. CONNECT SCREEN
   ═══════════════════════════════════════════════ */

.connect-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem;
  min-height: 50vh;
}

.connect-icon {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: var(--accent3, rgba(139,92,246,0.15));
  border: 1px solid rgba(139, 92, 246, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
}

.connect-icon svg {
  width: 38px;
  height: 38px;
  stroke: var(--accent2, #A78BFA);
  stroke-width: 1.5;
}

.connect-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text, #F0F0FF);
  margin-bottom: 0.5rem;
}

.connect-sub {
  font-size: 0.9rem;
  color: var(--text3, #4A4A6A);
  max-width: 380px;
  margin: 0 auto 1.5rem;
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════
   22. TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════ */

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--surface2, #1A1A24);
  border: 1px solid var(--border2, rgba(255,255,255,0.12));
  border-left: 3px solid var(--accent, #8B5CF6);
  color: var(--text, #F0F0FF);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.8rem 1.2rem;
  border-radius: var(--r, 12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
  pointer-events: none;
  max-width: 280px;
}

.toast.show {
  opacity: 1;
  transform: none;
}

/* ═══════════════════════════════════════════════
   23. EMPTY / LOADING STATES
   ═══════════════════════════════════════════════ */

.empty {
  padding: 3rem;
  text-align: center;
  color: var(--text3, #4A4A6A);
  font-size: 0.85rem;
}

.shimmer {
  background: linear-gradient(
    90deg,
    var(--surface2, #1A1A24) 25%,
    var(--surface3, #22222F) 50%,
    var(--surface2, #1A1A24) 75%
  );
  background-size: 200% 100%;
  animation: shimmerAnim 1.5s infinite;
  border-radius: 6px;
  height: 14px;
}

@keyframes shimmerAnim {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ═══════════════════════════════════════════════
   24. MODAL
   ═══════════════════════════════════════════════ */

.modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-bg.show {
  display: flex;
}

.modal {
  background: var(--surface, #111118);
  border: 1px solid var(--border2, rgba(255,255,255,0.12));
  border-radius: var(--r-lg, 18px);
  padding: 2rem;
  width: 440px;
  max-width: 90vw;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

.modal-sub {
  font-size: 0.8rem;
  color: var(--text3, #4A4A6A);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

/* ── Form Fields ──────────────────────────────── */

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text2, #8888AA);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.field input {
  width: 100%;
  background: var(--surface2, #1A1A24);
  border: 1px solid var(--border2, rgba(255,255,255,0.12));
  border-radius: var(--r, 12px);
  color: var(--text, #F0F0FF);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.83rem;
  padding: 0.65rem 0.9rem;
  transition: border-color 0.15s;
}

.field input:focus {
  outline: none;
  border-color: var(--accent, #8B5CF6);
}

.field input::placeholder {
  color: var(--text3, #4A4A6A);
}

/* Generic input utility */
.inp {
  background: var(--surface2, #1A1A24);
  border: 1px solid var(--border, rgba(255,255,255,0.07));
  border-radius: 8px;
  color: var(--text, #F0F0FF);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  outline: none;
  transition: border-color 0.2s;
}

.inp:focus {
  border-color: var(--accent, #8B5CF6);
  box-shadow: 0 0 0 3px var(--accent4, rgba(139,92,246,0.08));
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.5rem;
}

/* ═══════════════════════════════════════════════
   25. SCROLLBAR
   ═══════════════════════════════════════════════ */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--surface3, #22222F);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text3, #4A4A6A);
}

/* ═══════════════════════════════════════════════
   26. UTILITY CLASSES
   ═══════════════════════════════════════════════ */

.hidden {
  display: none !important;
}

/* ═══════════════════════════════════════════════
   27. RESPONSIVE BREAKPOINTS
   ═══════════════════════════════════════════════ */

/* ── Large tablets / small desktops ───────────── */
@media (max-width: 1100px) {
  .dash-grid {
    grid-template-columns: 1fr;
  }

  .dash-grid .col-right {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }
}

/* ── Tablet ───────────────────────────────────── */
@media (max-width: 820px) {
  :root {
    --sidebar: 60px;
  }

  .logo-text,
  .logo-sub,
  .nav-item span,
  .nav-badge,
  .user-name,
  .user-status,
  .theme-label,
  .sidebar-footer .user-chip div {
    display: none;
  }

  .nav-item {
    padding: 0.65rem;
    justify-content: center;
  }

  .nav-item::before {
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
  }

  .logo {
    padding: 0.4rem 0;
    justify-content: center;
  }

  .main {
    margin-left: var(--sidebar, 60px);
  }

  .page {
    padding: 1.5rem 1.25rem;
  }

  .dash-grid .col-right {
    grid-template-columns: 1fr;
  }
}

/* ── Mobile ───────────────────────────────────── */
@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .page {
    padding: 1rem 0.9rem;
  }

  .page-title {
    font-size: 1.3rem;
  }
}
