/* Dashboard-specific styles */
body { background: var(--bg); }

.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
aside.side {
  background: var(--bg-deep);
  border-right: 1px solid var(--border);
  padding: 24px 18px;
  display: flex; flex-direction: column; gap: 24px;
  position: sticky; top: 0; height: 100vh;
}
.side .brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: -0.02em; padding: 0 6px; }
.side .brand img { width: 26px; height: 26px; }

.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  color: var(--text-dim);
  font-size: 14px;
  transition: background .2s, color .2s;
  white-space: nowrap;
}
.side nav a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side nav a:hover { background: var(--surface); color: var(--text); }
.side nav a.active {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-card);
}
.side nav a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .8; }
.side nav a.active svg { opacity: 1; color: var(--violet-soft); }

.side .group-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em; color: var(--text-faint); text-transform: uppercase; padding: 0 12px 6px; }

.side .user {
  margin-top: auto;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.avatar {
  width: 36px; height: 36px; border-radius: 999px;
  background: var(--grad-primary);
  display: grid; place-items: center;
  color: #0B1020; font-family: var(--font-display); font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.side .user .meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.side .user .name { font-size: 13px; font-weight: 600; }
.side .user .role { font-size: 11px; color: var(--text-dim); }

/* ===== Main ===== */
main {
  padding: 32px 40px 60px;
  display: flex; flex-direction: column; gap: 28px;
  min-width: 0;
}
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.topbar .search {
  display: flex; align-items: center; gap: 10px;
  width: 360px;
  height: 40px; padding: 0 14px;
  border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 13px;
}
.topbar .actions { display: flex; gap: 10px; align-items: center; }
.icon-btn { width: 40px; height: 40px; border-radius: 999px; display:grid;place-items:center; background: var(--surface); border: 1px solid var(--border); cursor: pointer; transition: background .2s; color: var(--text); }
.icon-btn:hover { background: var(--surface-2); }

/* Greeting hero card */
.greeting {
  position: relative; overflow: hidden;
  border-radius: var(--r-xl);
  padding: 36px;
  background:
    radial-gradient(600px 240px at 80% 30%, rgba(124,92,255,0.28), transparent 60%),
    radial-gradient(500px 200px at 90% 90%, rgba(34,211,238,0.22), transparent 60%),
    var(--surface);
  border: 1px solid var(--border);
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end;
}
.greeting h1 { font-family: var(--font-display); font-weight: 600; font-size: 36px; letter-spacing: -0.03em; margin: 0 0 6px; line-height: 1.1; }
.greeting p { color: var(--text-dim); font-size: 15px; margin: 0 0 22px; max-width: 520px; line-height: 1.55; }
.streak { display: flex; gap: 22px; align-items: center; }
.streak-num {
  font-family: var(--font-display);
  font-size: 56px; font-weight: 600; letter-spacing: -0.04em;
  background: var(--grad-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  line-height: 1;
}
.streak-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.streak-days .day { width: 24px; height: 24px; border-radius: 6px; background: var(--surface-3); border: 1px solid var(--border); }
.streak-days .day.on { background: var(--violet); border-color: transparent; box-shadow: 0 0 0 1px rgba(124,92,255,0.5), 0 4px 14px -2px rgba(124,92,255,0.7); }
.streak-days .day.today { background: var(--grad-primary); }

/* Stat cards row */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat {
  padding: 22px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}
.stat .lbl { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-faint); }
.stat .val { font-family: var(--font-display); font-size: 36px; font-weight: 600; letter-spacing: -0.03em; margin-top: 4px; line-height: 1; }
.stat .val .u { font-size: 14px; color: var(--text-dim); font-weight: 500; margin-left: 4px; }
.stat .delta { font-size: 12px; margin-top: 8px; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.stat .delta span { white-space: nowrap; }
.stat .delta.up { color: #6EE7B7; }
.stat .delta.down { color: #FFA0BD; }
.stat .spark { position: absolute; right: 12px; bottom: 12px; opacity: .6; }

/* Section title */
.sec-title { display: flex; align-items: baseline; justify-content: space-between; }
.sec-title h2 { font-family: var(--font-display); font-weight: 600; font-size: 22px; letter-spacing: -0.02em; margin: 0; }
.sec-title a { font-size: 13px; color: var(--text-dim); white-space: nowrap; }
.sec-title a:hover { color: var(--text); }

/* Scenario cards (continue / start) */
.scenarios-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.scenario {
  aspect-ratio: 3/4;
  border-radius: var(--r-lg);
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
  transition: transform .2s, border-color .2s;
  cursor: pointer;
}
.scenario:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.scenario .top { display: flex; justify-content: space-between; align-items: start; position: relative; z-index: 2; }
.scenario h3 { font-family: var(--font-display); font-weight: 600; font-size: 18px; letter-spacing: -0.02em; margin: 6px 0 4px; position: relative; z-index: 2; }
.scenario .sub { font-size: 12px; color: var(--text-dim); position: relative; z-index: 2; }
.scenario .bg { position: absolute; inset: 0; opacity: .8; pointer-events: none; }

/* Two-column section */
.cols-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.panel { padding: 24px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); backdrop-filter: blur(16px); }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.panel-head h3 { font-family: var(--font-display); font-weight: 600; font-size: 18px; letter-spacing: -0.02em; margin: 0; }
.panel-head .tabs { display: flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.panel-head .tabs button { background: transparent; border: 0; color: var(--text-dim); font-size: 12px; padding: 6px 12px; border-radius: 999px; cursor: pointer; font-family: var(--font-body); }
.panel-head .tabs button.active { background: var(--surface-3); color: var(--text); }

/* Chart */
.chart { height: 240px; position: relative; }
.chart svg { width: 100%; height: 100%; display: block; }
.chart .y-lbl { font-family: var(--font-mono); font-size: 10px; fill: var(--text-faint); }
.chart .grid-line { stroke: var(--border); stroke-dasharray: 2 4; }
.chart .x-lbl { font-family: var(--font-mono); font-size: 10px; fill: var(--text-faint); }

/* Sessions list */
.session-row {
  display: grid; grid-template-columns: 44px 1fr 100px 90px 24px;
  gap: 14px; align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.session-row:last-child { border-bottom: 0; }
.session-row .ic { width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; }
.session-row .title { font-size: 14px; font-weight: 500; }
.session-row .date { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.session-row .score { font-family: var(--font-display); font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.score-high { color: #6EE7B7; }
.score-mid { color: #FFD27A; }
.score-low { color: #FFA0BD; }
.session-row .dur { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }
.session-row .more { color: var(--text-faint); cursor: pointer; }

/* Goals */
.goal { display: flex; gap: 12px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border); }
.goal:last-child { border-bottom: 0; }
.ring {
  position: relative;
  width: 40px; height: 40px; border-radius: 999px;
  background: conic-gradient(var(--violet) var(--p, 60%), var(--surface-3) 0);
  flex-shrink: 0;
}
.ring::after {
  content: ""; position: absolute; inset: 4px; border-radius: 999px;
  background: var(--bg-deep);
}
.ring .pct { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-mono); font-size: 10px; font-weight: 600; color: var(--text); z-index: 1; }
.ring.done { background: conic-gradient(#34D399 100%, transparent 0); }
.goal .text { font-size: 13px; line-height: 1.5; }
.goal .text .name { font-weight: 500; color: var(--text); }
.goal .text .meta { color: var(--text-dim); margin-top: 2px; font-size: 12px; }

/* Achievements */
.ach-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ach { aspect-ratio: 1/1; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; }
.ach.locked { opacity: .4; }
.ach svg { width: 36px; height: 36px; }

@media (max-width: 1100px) {
  .app { grid-template-columns: 72px 1fr; }
  .side .brand span, .side nav a span, .side .user .meta, .side .group-label { display: none; }
  .scenarios-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .cols-2 { grid-template-columns: 1fr; }
}
