/* ============================================================
   SOLIDWORKS Learning Hub — stylesheet
   Premium engineering dashboard aesthetic
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  /* Light theme (default fallback values also set on [data-theme]) */
  --bg: #f6f7f9;
  --bg-elev: #ffffff;
  --bg-subtle: #eef1f5;
  --bg-inset: #f1f4f8;
  --border: #dde3ea;
  --border-strong: #c7cfd9;
  --border-subtle: #e6eaef;

  --fg: #0f172a;
  --fg-muted: #475569;
  --fg-soft: #64748b;
  --fg-faint: #94a3b8;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.10);
  --accent-fg: #ffffff;

  --success: #059669;
  --success-soft: rgba(5, 150, 105, 0.12);
  --warning: #d97706;
  --warning-soft: rgba(217, 119, 6, 0.12);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.10);

  --renewable: #10b981;
  --mechatronics: #8b5cf6;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 24px -8px rgba(15, 23, 42, 0.12), 0 4px 8px -4px rgba(15, 23, 42, 0.06);
  --shadow-pop: 0 16px 40px -12px rgba(15, 23, 42, 0.18);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --sidebar-w: 256px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;

  --transition: 160ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg: #0b1220;
  --bg-elev: #111a2e;
  --bg-subtle: #0f1828;
  --bg-inset: #0c1422;
  --border: #1e2940;
  --border-strong: #2a3654;
  --border-subtle: #18223a;

  --fg: #e8edf6;
  --fg-muted: #a6b2c8;
  --fg-soft: #7a8aa3;
  --fg-faint: #4d5d77;

  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --accent-soft: rgba(96, 165, 250, 0.14);
  --accent-fg: #0b1220;

  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.14);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.14);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.14);

  --renewable: #34d399;
  --mechatronics: #a78bfa;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.35), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 24px -8px rgba(0, 0, 0, 0.45), 0 4px 8px -4px rgba(0, 0, 0, 0.3);
  --shadow-pop: 0 16px 40px -12px rgba(0, 0, 0, 0.55);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
ul, ol { list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); color: var(--fg); }

.skip-link {
  position: absolute;
  top: -100px;
  left: 12px;
  background: var(--accent);
  color: var(--accent-fg);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  z-index: 9999;
  font-weight: 600;
  transition: top var(--transition);
}
.skip-link:focus { top: 12px; text-decoration: none; }

/* ---------- App shell ---------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 50;
  transition: transform var(--transition);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--fg);
  line-height: 1.1;
}
.brand-subtitle {
  font-size: 11px;
  color: var(--fg-soft);
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.sidebar-close {
  display: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--fg-muted);
  align-items: center;
  justify-content: center;
}
.sidebar-close:hover { background: var(--bg-subtle); color: var(--fg); }

.sidebar-nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.sidebar-nav ul { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--fg-muted);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  position: relative;
}
.sidebar-nav a:hover {
  background: var(--bg-subtle);
  color: var(--fg);
  text-decoration: none;
}
.sidebar-nav a svg { flex-shrink: 0; opacity: 0.85; }
.sidebar-nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.sidebar-nav a.active svg { opacity: 1; }
.sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.sidebar-footer {
  padding: 14px 18px 18px;
  border-top: 1px solid var(--border-subtle);
}
.version-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  color: var(--fg-soft);
  font-family: var(--font-mono);
  margin-bottom: 8px;
}
.status-dot {
  width: 7px; height: 7px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--success-soft);
}
.sidebar-tagline {
  font-size: 11px;
  color: var(--fg-faint);
  line-height: 1.4;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  z-index: 49;
  opacity: 0;
  transition: opacity var(--transition);
}
.sidebar-overlay.visible { display: block; opacity: 1; }

/* ---------- Main wrapper ---------- */
.main-wrapper {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(8px);
}
.menu-toggle {
  display: none;
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  color: var(--fg-muted);
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}
.menu-toggle:hover { background: var(--bg-subtle); color: var(--fg); }

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--fg);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Student switcher */
.student-switcher { position: relative; }
.student-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--fg);
  font-size: 13px;
  font-weight: 600;
  transition: background var(--transition), border-color var(--transition);
}
.student-pill:hover { background: var(--bg-inset); border-color: var(--border-strong); }
.student-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--renewable);
  flex-shrink: 0;
}
.student-dot.renewable { background: var(--renewable); }
.student-dot.mechatronics { background: var(--mechatronics); }
.student-pill svg { color: var(--fg-soft); }

.student-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 240px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 6px;
  z-index: 60;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
}
.student-menu.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.student-menu li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition);
}
.student-menu li:hover { background: var(--bg-subtle); }
.student-menu li strong {
  display: block;
  font-size: 13px;
  color: var(--fg);
  font-weight: 600;
}
.student-menu li small {
  font-size: 11px;
  color: var(--fg-soft);
}
.student-menu li[aria-selected="true"] {
  background: var(--accent-soft);
}
.student-menu li[aria-selected="true"] strong { color: var(--accent); }

/* Theme toggle */
.theme-toggle {
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}
.theme-toggle:hover { background: var(--bg-inset); color: var(--fg); }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---------- Main content ---------- */
.main-content {
  flex: 1;
  padding: 28px 32px 64px;
  min-width: 0;
}
.view-root {
  max-width: 1280px;
  margin: 0 auto;
  animation: fade-in 240ms ease-out;
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.loading-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--fg-soft);
}

/* ---------- Page header ---------- */
.page-header {
  margin-bottom: 26px;
}
.page-header h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--fg);
  margin-bottom: 6px;
}
.page-header p {
  color: var(--fg-soft);
  font-size: 14px;
  max-width: 720px;
}

.section-eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

/* ---------- Card primitives ---------- */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}
.card.clickable:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.card-title { font-size: 16px; font-weight: 700; color: var(--fg); }
.card-subtitle { font-size: 13px; color: var(--fg-soft); margin-top: 2px; }

/* ---------- Grid utilities ---------- */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* ---------- Badges / chips ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-subtle);
  color: var(--fg-muted);
  border: 1px solid var(--border);
  letter-spacing: 0.02em;
}
.badge-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge-success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge-warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-renewable { background: rgba(16, 185, 129, 0.12); color: var(--renewable); border-color: transparent; }
.badge-mechatronics { background: rgba(139, 92, 246, 0.12); color: var(--mechatronics); border-color: transparent; }
.badge-shared { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  transition: background var(--transition), border-color var(--transition), color var(--transition), opacity var(--transition), transform var(--transition);
  border: 1px solid transparent;
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary {
  background: var(--bg-subtle);
  color: var(--fg);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-inset); border-color: var(--border-strong); }
.btn-ghost { color: var(--fg-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-subtle); color: var(--fg); }
.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: transparent;
}
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-lg { padding: 12px 22px; font-size: 14px; }
.btn-block { width: 100%; }

/* ---------- Progress bar ---------- */
.progress {
  position: relative;
  width: 100%;
  height: 8px;
  background: var(--bg-inset);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #7c3aed);
  border-radius: 999px;
  transition: width 480ms cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0;
}
.progress-bar.success { background: linear-gradient(90deg, var(--success), #34d399); }
.progress-bar.warning { background: linear-gradient(90deg, var(--warning), #fbbf24); }
.progress-bar.renewable { background: var(--renewable); }
.progress-bar.mechatronics { background: var(--mechatronics); }

.progress-lg { height: 12px; }
.progress-sm { height: 5px; }

/* ---------- Big progress ring ---------- */
.ring-container {
  position: relative;
  width: 160px;
  height: 160px;
  flex-shrink: 0;
}
.ring-container svg { transform: rotate(-90deg); }
.ring-bg { stroke: var(--bg-inset); }
.ring-fg {
  stroke: url(#ringGrad);
  stroke-linecap: round;
  transition: stroke-dashoffset 600ms cubic-bezier(0.4, 0, 0.2, 1);
}
.ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.ring-label .pct {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--fg);
  line-height: 1;
}
.ring-label .lbl {
  font-size: 11px;
  color: var(--fg-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
}

/* ---------- Stat card ---------- */
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 6px;
}
.stat-icon.success { background: var(--success-soft); color: var(--success); }
.stat-icon.warning { background: var(--warning-soft); color: var(--warning); }
.stat-icon.renewable { background: rgba(16, 185, 129, 0.12); color: var(--renewable); }
.stat-icon.mechatronics { background: rgba(139, 92, 246, 0.12); color: var(--mechatronics); }
.stat-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--fg);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: 12px;
  color: var(--fg-soft);
  font-weight: 500;
}

/* ---------- Week card ---------- */
.week-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.week-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent);
  opacity: 0;
  transition: opacity var(--transition);
}
.week-card:hover::before { opacity: 1; }
.week-card.completed::before { background: var(--success); opacity: 1; }
.week-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.week-number {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-soft);
  font-weight: 600;
  letter-spacing: 0.06em;
}
.week-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.01em;
  margin-top: 2px;
}
.week-objective {
  font-size: 13px;
  color: var(--fg-soft);
  line-height: 1.55;
}
.week-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--fg-soft);
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}
.week-meta-item { display: inline-flex; align-items: center; gap: 5px; }
.week-meta-item svg { color: var(--fg-faint); }

/* ---------- Roadmap timeline ---------- */
.timeline {
  position: relative;
  padding-left: 38px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 20px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: -32px;
  top: 4px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-elev);
  border: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-soft);
  font-family: var(--font-mono);
  z-index: 1;
}
.timeline-item.completed .timeline-dot {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.timeline-item.active .timeline-dot {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* ---------- Tasks / checklist ---------- */
.task-list { display: flex; flex-direction: column; gap: 6px; }
.task {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 11px 13px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: background var(--transition), border-color var(--transition);
  cursor: pointer;
}
.task:hover { background: var(--bg-inset); border-color: var(--border); }
.task.completed { background: var(--success-soft); border-color: transparent; }
.task.completed .task-text { color: var(--fg-soft); text-decoration: line-through; }
.task-checkbox {
  width: 18px; height: 18px;
  border-radius: 5px;
  border: 2px solid var(--border-strong);
  flex-shrink: 0;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), border-color var(--transition);
}
.task.completed .task-checkbox {
  background: var(--success);
  border-color: var(--success);
}
.task-checkbox svg { opacity: 0; transition: opacity var(--transition); color: #fff; }
.task.completed .task-checkbox svg { opacity: 1; }
.task-content { flex: 1; min-width: 0; }
.task-text { font-size: 13.5px; color: var(--fg); line-height: 1.5; }
.task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  font-size: 11px;
  color: var(--fg-soft);
}
.task input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.tab {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-soft);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.tab:hover { color: var(--fg); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Resource card ---------- */
.resource-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}
.resource-tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.resource-title { font-size: 15px; font-weight: 700; color: var(--fg); line-height: 1.4; }
.resource-desc { font-size: 13px; color: var(--fg-soft); line-height: 1.55; flex: 1; }
.resource-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--fg-soft);
}
.resource-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  color: var(--accent);
  font-size: 12px;
}
.resource-link:hover { text-decoration: underline; }

/* ---------- Project card ---------- */
.project-card .project-spec {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 8px 14px;
  font-size: 13px;
  margin: 10px 0;
}
.project-spec dt { color: var(--fg-soft); font-weight: 600; }
.project-spec dd { color: var(--fg); }

/* ---------- Capstone subsystem card ---------- */
.subsystem-card {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 16px;
  align-items: flex-start;
}
.subsystem-icon {
  width: 56px; height: 56px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  font-family: var(--font-mono);
}
.subsystem-icon.renewable { background: rgba(16, 185, 129, 0.12); color: var(--renewable); }
.subsystem-icon.mechatronics { background: rgba(139, 92, 246, 0.12); color: var(--mechatronics); }
.subsystem-icon.shared { background: var(--accent-soft); color: var(--accent); }

/* ---------- Quiz ---------- */
.quiz-question {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  background: var(--bg-subtle);
}
.quiz-question.correct { border-color: var(--success); background: var(--success-soft); }
.quiz-question.incorrect { border-color: var(--danger); background: var(--danger-soft); }
.quiz-q-text {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 12px;
}
.quiz-options { display: flex; flex-direction: column; gap: 7px; }
.quiz-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  background: var(--bg-elev);
  font-size: 13.5px;
}
.quiz-option:hover { background: var(--bg-inset); border-color: var(--border-strong); }
.quiz-option input { accent-color: var(--accent); width: 16px; height: 16px; }
.quiz-option.selected { background: var(--accent-soft); border-color: var(--accent); }
.quiz-option.correct { background: var(--success-soft); border-color: var(--success); }
.quiz-option.incorrect { background: var(--danger-soft); border-color: var(--danger); }
.quiz-explanation {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--bg-inset);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 12.5px;
  color: var(--fg-muted);
}
.quiz-score {
  text-align: center;
  padding: 22px;
  background: var(--bg-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
}
.quiz-score .score-num {
  font-size: 38px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.02em;
  line-height: 1;
}

/* ---------- Study tracker ---------- */
.timer-display {
  font-family: var(--font-mono);
  font-size: 56px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
  text-align: center;
  line-height: 1;
}
.timer-controls {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}
.timer-state { text-align: center; font-size: 12px; color: var(--fg-soft); margin-top: 8px; text-transform: uppercase; letter-spacing: 0.06em; }

.session-list { display: flex; flex-direction: column; gap: 8px; }
.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  font-size: 13px;
}
.session-item .topic { font-weight: 600; color: var(--fg); }
.session-item .duration { font-family: var(--font-mono); color: var(--accent); font-weight: 600; }
.session-item .date { color: var(--fg-soft); font-size: 11px; }

/* ---------- Notes ---------- */
.note-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
}
.note-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--fg-soft); }
.note-body {
  font-size: 13.5px;
  color: var(--fg);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  flex: 1;
  max-height: 200px;
  overflow-y: auto;
}
.note-actions { display: flex; gap: 6px; padding-top: 10px; border-top: 1px solid var(--border-subtle); }

textarea, input[type="text"], input[type="number"], select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elev);
  color: var(--fg);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 100px; font-family: inherit; line-height: 1.55; }

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.field-group { margin-bottom: 14px; }

/* ---------- Settings ---------- */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-info { flex: 1; }
.settings-row-title { font-size: 14px; font-weight: 600; color: var(--fg); }
.settings-row-desc { font-size: 12px; color: var(--fg-soft); margin-top: 2px; }

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  color: var(--fg);
  max-width: 360px;
  animation: toast-in 280ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--accent); }
.toast.removing { animation: toast-out 200ms ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(0.96); } }

/* ---------- Modal ---------- */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
}
.modal-root.open { display: block; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  animation: fade-in 200ms ease-out;
}
.modal {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(540px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-pop);
  padding: 24px;
  animation: modal-in 280ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modal-in { from { opacity: 0; transform: translate(-50%, -46%) scale(0.96); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.modal-title { font-size: 17px; font-weight: 700; color: var(--fg); }
.modal-close {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  color: var(--fg-soft);
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--bg-subtle); color: var(--fg); }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--fg-soft);
}
.empty-state svg {
  margin: 0 auto 14px;
  color: var(--fg-faint);
  opacity: 0.6;
}
.empty-state h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg-muted);
  margin-bottom: 4px;
}
.empty-state p { font-size: 13px; max-width: 360px; margin: 0 auto; }

/* ---------- Divider / helper ---------- */
.divider { height: 1px; background: var(--border-subtle); margin: 18px 0; border: none; }
.muted { color: var(--fg-soft); }
.mono { font-family: var(--font-mono); }
.row { display: flex; gap: 10px; align-items: center; }
.row-wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.spacer { flex: 1; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.mt-0 { margin-top: 0; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; }

/* ---------- Page hero (dashboard) ---------- */
.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 28px;
  align-items: center;
  background: linear-gradient(135deg, var(--bg-elev), var(--bg-subtle));
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px 30px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 240px; height: 240px;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
  pointer-events: none;
}
.hero-content { position: relative; z-index: 1; min-width: 0; }
.hero-greeting { font-size: 13px; color: var(--fg-soft); margin-bottom: 4px; font-weight: 500; }
.hero-name { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; color: var(--fg); margin-bottom: 4px; }
.hero-tagline { font-size: 14px; color: var(--fg-muted); max-width: 540px; }

/* ---------- Mini bar chart ---------- */
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 180px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.chart-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  justify-content: flex-end;
  cursor: pointer;
}
.chart-bar {
  width: 100%;
  max-width: 42px;
  background: linear-gradient(180deg, var(--accent), var(--accent-hover));
  border-radius: 6px 6px 0 0;
  transition: opacity var(--transition), transform var(--transition);
  position: relative;
  min-height: 4px;
}
.chart-bar-col:hover .chart-bar { opacity: 0.85; transform: scaleY(1.04); }
.chart-bar.completed { background: linear-gradient(180deg, var(--success), #059669); }
.chart-bar.empty { background: var(--bg-inset); border: 1px solid var(--border); }
.chart-bar-label {
  font-size: 11px;
  color: var(--fg-soft);
  font-weight: 600;
}
.chart-bar-value {
  font-size: 11px;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-weight: 600;
}

/* ---------- Code-ish tag ---------- */
.kbd {
  display: inline-block;
  padding: 1px 6px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg-muted);
}

/* ---------- Week detail page ---------- */
.week-detail-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: flex-start;
}
.week-detail-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.week-detail-side {
  position: sticky;
  top: 90px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-block {
  margin-bottom: 0;
}
.section-block h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.section-block h3 .badge { font-size: 10px; padding: 2px 7px; }

.list-styled { padding-left: 18px; }
.list-styled li {
  list-style: disc;
  font-size: 13.5px;
  color: var(--fg);
  margin-bottom: 4px;
  line-height: 1.55;
}
.list-styled li::marker { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .week-detail-grid { grid-template-columns: 1fr; }
  .week-detail-side { position: static; }
}

@media (max-width: 880px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: flex; }
  .menu-toggle { display: flex; }
  .sidebar-overlay.visible { display: block; }
  .main-content { padding: 22px 18px 56px; }
  .topbar { padding: 12px 16px; }
  .topbar-title { font-size: 15px; }
  .hero { grid-template-columns: 1fr; padding: 22px; }
  .hero-name { font-size: 22px; }
  .ring-container { width: 130px; height: 130px; }
  .ring-label .pct { font-size: 26px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-auto { grid-template-columns: 1fr; }
  .student-name { display: none; }
  .student-pill { padding: 7px 10px; }
  .page-header h1 { font-size: 22px; }
  .modal { width: calc(100vw - 24px); padding: 20px; }
  .chart-bars { height: 140px; }
  .timer-display { font-size: 44px; }
}

@media (max-width: 480px) {
  .main-content { padding: 16px 14px 48px; }
  .card { padding: 16px; }
  .topbar { padding: 10px 14px; gap: 8px; }
  .hero { padding: 18px; }
  .hero-name { font-size: 20px; }
  .ring-container { width: 110px; height: 110px; }
  .ring-label .pct { font-size: 22px; }
  .stat-value { font-size: 22px; }
  .toast-container { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: none; }
  .quiz-q-text { font-size: 13.5px; }
  .timer-display { font-size: 38px; }
  .subsystem-card { grid-template-columns: 44px 1fr; gap: 12px; }
  .subsystem-icon { width: 44px; height: 44px; font-size: 18px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .view-root { animation: none; }
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--fg-faint); }
