:root {
  --bg: #0b0e14;
  --bg-elev: #151923;
  --bg-elev-2: #1d2230;
  --border: #2a3142;
  --text: #e6edf3;
  --text-dim: #8b95a7;
  --text-faint: #5a6478;
  --accent: #6ee7ff;
  --accent-2: #a78bfa;
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: #60a5fa;
  --gap: 18px;
  --radius: 16px;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "tnum";
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.dashboard {
  display: grid;
  width: 100vw;
  height: 100vh;
  padding: var(--gap);
  gap: var(--gap);
  grid-template-columns: 1.4fr 1fr 1fr;
  grid-template-rows: auto 1fr 1fr auto;
  grid-template-areas:
    "clock   weather  spotify"
    "prs     prs      jira"
    "pipes   pipes    jira"
    "status  status   status";
}

.clock-panel     { grid-area: clock; }
.weather-panel   { grid-area: weather; }
.spotify-panel   { grid-area: spotify; }
.prs-panel       { grid-area: prs; }
.pipelines-panel { grid-area: pipes; }
.jira-panel      { grid-area: jira; }

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 26px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.panel-title {
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-count {
  background: var(--bg-elev-2);
  color: var(--accent);
  font-size: 0.85rem;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0;
  text-transform: none;
}

/* ---------- Clock ---------- */
.clock-panel {
  justify-content: center;
  align-items: flex-start;
  padding: 26px 36px;
}
.time {
  font-size: clamp(5rem, 11vw, 11rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.date {
  font-size: clamp(1.4rem, 2vw, 2.1rem);
  color: var(--text-dim);
  margin-top: 8px;
  font-weight: 500;
}

/* ---------- Weather ---------- */
.weather-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
  min-height: 0;
}
.weather-now {
  display: flex;
  align-items: center;
  gap: 22px;
}
.weather-temp {
  font-size: clamp(3rem, 6vw, 5rem);
  font-weight: 700;
  line-height: 1;
}
.weather-desc { font-size: 1.4rem; font-weight: 600; }
.weather-loc  { color: var(--text-dim); margin-top: 4px; }

.weather-forecast {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.forecast-day {
  background: var(--bg-elev-2);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}
.forecast-day .fd-name { font-size: 0.85rem; color: var(--text-dim); }
.forecast-day .fd-icon { font-size: 1.6rem; margin: 4px 0; }
.forecast-day .fd-temp { font-weight: 600; }
.forecast-day .fd-temp .fd-lo { color: var(--text-faint); margin-left: 6px; }

/* ---------- Spotify ---------- */
.spotify-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 0;
}
.spotify-art {
  width: 130px;
  height: 130px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
.spotify-meta { flex: 1; min-width: 0; }
.spotify-track {
  font-size: 1.5rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.spotify-artist {
  font-size: 1.05rem;
  color: var(--text-dim);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.spotify-progress {
  height: 6px;
  background: var(--bg-elev-2);
  border-radius: 999px;
  margin-top: 14px;
  overflow: hidden;
}
.spotify-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #1db954, #4ade80);
  width: 0%;
  transition: width 1s linear;
}
.spotify-idle { color: var(--text-dim); font-size: 1.1rem; text-align: center; }

.connect-btn {
  background: #1db954;
  color: white;
  border: none;
  padding: 14px 22px;
  border-radius: 999px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.connect-btn:hover { filter: brightness(1.1); }

/* ---------- Lists (PRs, Pipelines, Jira) ---------- */
.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.list::-webkit-scrollbar { width: 8px; }
.list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-elev-2);
  border-radius: 10px;
  border-left: 3px solid var(--border);
}
.row .row-main {
  flex: 1;
  min-width: 0;
}
.row .row-title {
  font-size: 1.05rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row .row-sub {
  font-size: 0.9rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}
.row .row-meta {
  font-size: 0.85rem;
  color: var(--text-dim);
  text-align: right;
  flex-shrink: 0;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--bg-elev);
  color: var(--text-dim);
}
.badge.success { background: rgba(74,222,128,0.15); color: var(--success); }
.badge.danger  { background: rgba(248,113,113,0.15); color: var(--danger); }
.badge.warning { background: rgba(251,191,36,0.15); color: var(--warning); }
.badge.info    { background: rgba(96,165,250,0.15); color: var(--info); }

.row.status-success  { border-left-color: var(--success); }
.row.status-failed   { border-left-color: var(--danger); }
.row.status-running  { border-left-color: var(--info); }
.row.status-pending  { border-left-color: var(--warning); }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-elev);
  flex-shrink: 0;
  object-fit: cover;
}

.loading, .empty, .error {
  color: var(--text-dim);
  padding: 20px;
  text-align: center;
  font-size: 1rem;
}
.error { color: var(--danger); }

/* ---------- Status bar ---------- */
.status-bar {
  grid-area: status;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text-faint);
  font-size: 0.85rem;
  padding: 0 8px;
}
.status-spacer { flex: 1; }

/* small screens fallback */
@media (max-width: 1100px) {
  .dashboard {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "clock   weather"
      "spotify spotify"
      "prs     prs"
      "pipes   jira"
      "status  status";
  }
}
