/* ── BUTTONS ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-xs);
  padding: 10px 18px;
  font-weight: 600;
  font-size: 13.5px;
  transition: opacity 0.12s ease;
}
.btn:active { opacity: 0.75; }
.btn-primary { background: var(--text-primary); color: var(--bg); }
.btn-ghost { background: var(--surface); color: var(--text-primary); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }

.btn-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 600;
}
.btn-chip.active { background: var(--text-primary); color: var(--bg); }
.btn-sm { padding: 7px 12px; font-size: 12px; }

.link-btn {
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  padding: 4px 2px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* ── SECTIONS ───────────────────────────────────────────── */
.dash-section, .timetable-week, .hub-subjects, .hub-content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-card);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.section-header h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-header h2 input[type="date"] {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 5px 10px;
  font-size: 11.5px;
  color: var(--text-primary);
}

h2 {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.empty-state {
  text-align: center;
  padding: 36px 16px;
  color: var(--text-muted);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}
.empty-state-inline {
  text-align: center;
  padding: 18px 8px;
  color: var(--text-muted);
  font-size: 12.5px;
}

/* ── FORM FIELDS ────────────────────────────────────────── */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 12.5px;
  color: var(--text-secondary);
  font-weight: 600;
}
.form-field-inline {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text-secondary);
}
.form-field input[type="text"],
.form-field input[type="number"],
.form-field input[type="date"],
.form-field input[type="time"],
.form-field select,
.form-field textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-primary);
  outline: none;
  width: 100%;
}
.form-field textarea { resize: vertical; min-height: 70px; }
.settings-grid, .form-field .settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.settings-note { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ── COLOR / WEEKDAY PICKERS ────────────────────────────── */
.color-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.color-dot {
  width: 24px; height: 24px; border-radius: var(--radius-xs);
  border: 2px solid transparent;
}
.color-dot.selected { border-color: var(--text-primary); }

.weekday-picker { display: flex; gap: 6px; margin-bottom: 14px; }
.weekday-btn {
  width: 32px; height: 32px; border-radius: var(--radius-xs);
  background: var(--surface); color: var(--text-secondary); font-size: 11px; font-weight: 700;
}
.weekday-btn.selected { background: var(--text-primary); color: var(--bg); }

/* ── CHECKLIST EDITOR (Assignments) ──────────────────────── */
.checklist-editor { display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; }
.checklist-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.checklist-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--text-primary); flex-shrink: 0; }
.checklist-text { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.checklist-row.done .checklist-text { text-decoration: line-through; color: var(--text-muted); }
.checklist-remove { color: var(--text-muted); display: flex; flex-shrink: 0; padding: 2px; }
.checklist-add-row { display: flex; gap: 6px; align-items: center; }
.checklist-add-row input { flex: 1; }

/* ── CHIPS: SUBJECTS / DAYS ─────────────────────────────── */
.subject-chip-row, .day-indicator {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.subject-chip-row::-webkit-scrollbar, .day-indicator::-webkit-scrollbar { display: none; }

.subject-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  color: var(--text-secondary);
  padding: 7px 12px;
  border-radius: var(--radius-xs);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.subject-chip.selected { background: var(--surface-2); color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--border); }
.subject-chip-add { padding: 7px 10px; }
.chip-dot {
  width: 7px; height: 7px; border-radius: 2px;
  background: var(--chip-color, var(--accent));
  display: inline-block;
}

.day-chip {
  background: var(--surface);
  color: var(--text-muted);
  padding: 7px 11px;
  border-radius: var(--radius-xs);
  font-size: 11.5px;
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
}
.day-chip.active-day { background: var(--text-primary); color: var(--bg); }
.day-chip.today-chip:not(.active-day) { color: var(--accent); }

/* ── SESSION ROWS ───────────────────────────────────────── */
.session-list { display: flex; flex-direction: column; gap: 6px; }
.session-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
}
.session-row.completed { opacity: 0.5; }
.session-row.completed .session-title { text-decoration: line-through; }
.session-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--text-primary); flex-shrink: 0; }
.session-row.editable .session-info { cursor: pointer; }
.session-icon { color: var(--text-muted); display: flex; }
.session-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.session-title { font-weight: 600; font-size: 13.5px; }
.session-meta { font-size: 11.5px; color: var(--text-muted); }

/* ── DUE LIST (assignments + assessments, shared across views) ── */
.due-list { display: flex; flex-direction: column; gap: 6px; }
.due-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  text-align: left;
}
.due-chip {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  flex-shrink: 0;
}
.due-chip-assignment { background: var(--accent-soft); color: var(--accent); }
.due-chip-assessment { background: var(--warning-soft); color: var(--warning); }
.due-title { flex: 1; min-width: 0; font-weight: 600; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.due-when { flex-shrink: 0; font-size: 11.5px; color: var(--text-muted); font-weight: 600; }

/* ── ASSIGNMENT LIST (Subject Workspace) ─────────────────── */
.assignment-list { display: flex; flex-direction: column; gap: 6px; }
.assignment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  text-align: left;
}
.assignment-row.status-submitted, .assignment-row.status-graded { opacity: 0.55; }
.assignment-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.assignment-title { font-weight: 600; font-size: 13px; }
.assignment-meta { font-size: 11px; color: var(--text-muted); }
.badge-priority-1 { background: var(--surface-2); color: var(--text-muted); }
.badge-priority-2 { background: var(--warning-soft); color: var(--warning); }
.badge-priority-3 { background: var(--danger-soft); color: var(--danger); }

/* ── SUBJECT WORKSPACE OVERVIEW TAB ──────────────────────── */
.overview-lecturers { font-size: 12px; color: var(--text-secondary); margin-bottom: 12px; }
.overview-next {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 12px 13px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.overview-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; color: var(--text-muted); }
.overview-title { font-weight: 600; font-size: 13.5px; }
.overview-subhead {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 16px 0 8px;
}
.overview-subhead:first-of-type { margin-top: 0; }

/* ── TOPIC / EXAM / QUIZ / CARD LISTS ───────────────────── */
.topic-list, .exam-list, .card-list, .quiz-list, .note-list { display: flex; flex-direction: column; gap: 6px; }
.topic-row, .card-row, .quiz-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 13px;
  text-align: left;
}
.exam-row {
  display: flex;
  justify-content: space-between;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 13px;
}

.badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-xs);
  flex-shrink: 0;
}
.badge-new { background: var(--surface-2); color: var(--text-muted); }
.badge-learning { background: var(--warning-soft); color: var(--warning); }
.badge-mastered { background: var(--success-soft); color: var(--success); }

.note-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  text-align: left;
}
.note-title { font-weight: 600; font-size: 13.5px; }
.note-preview { font-size: 11.5px; color: var(--text-muted); }

.note-card.resource-row { flex-direction: row; align-items: center; gap: 10px; padding: 9px 9px 9px 13px; }
.resource-open {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: inherit;
  text-decoration: none;
}
.resource-open .note-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resource-edit { flex-shrink: 0; color: var(--text-muted); padding: 6px; display: flex; }

/* ── HUB TABS ───────────────────────────────────────────── */
.hub-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: -2px 0 2px;
}
.hub-tabs::-webkit-scrollbar { display: none; }
.hub-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  color: var(--text-muted);
  padding: 8px 13px;
  border-radius: var(--radius-xs);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.hub-tab.active { background: var(--text-primary); color: var(--bg); }

.review-cta { width: 100%; margin-bottom: 12px; }

/* ── FLASHCARD REVIEW ───────────────────────────────────── */
.review-body { display: flex; flex-direction: column; gap: 16px; align-items: center; }
.review-progress { font-size: 11.5px; color: var(--text-muted); font-weight: 600; }
.flashcard {
  width: 100%;
  min-height: 130px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.flashcard.flipped { background: var(--accent-soft); border-color: transparent; }
.rating-row { display: flex; gap: 8px; width: 100%; }
.rating-btn { flex: 1; padding: 10px 4px; font-size: 12px; }
.rating-again { background: var(--danger-soft); color: var(--danger); }
.rating-hard { background: var(--warning-soft); color: var(--warning); }
.rating-good { background: var(--accent-soft); color: var(--accent); }
.rating-easy { background: var(--success-soft); color: var(--success); }

/* ── QUIZ ───────────────────────────────────────────────── */
.quiz-body { display: flex; flex-direction: column; gap: 18px; max-height: 55vh; overflow-y: auto; }
.quiz-question-text { font-weight: 600; margin-bottom: 8px; font-size: 13.5px; }
.quiz-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 13px;
}
.quiz-option.correct { background: var(--success-soft); color: var(--success); }
.quiz-option.incorrect { background: var(--danger-soft); color: var(--danger); }
.quiz-result { font-weight: 700; text-align: center; font-size: 15px; }

/* ── MODAL ──────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  padding: 0;
}
.modal.active { visibility: visible; opacity: 1; }
.modal-card {
  background: var(--card);
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 18px 18px 0 0;
  padding: 22px 18px calc(18px + var(--safe-bottom));
  border: 1px solid var(--border);
  border-bottom: none;
}
.modal-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; }
.modal-message { color: var(--text-secondary); font-size: 13.5px; margin-bottom: 6px; }
.modal-actions { display: flex; gap: 8px; margin-top: 8px; }
.modal-actions .btn { flex: 1; }

@media (min-width: 640px) {
  .modal { align-items: center; }
  .modal-card { border-radius: 18px; border-bottom: 1px solid var(--border); }
}

/* ── TOAST ──────────────────────────────────────────────── */
#toast-root {
  position: fixed;
  bottom: calc(80px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  color: var(--text-primary);
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 1100;
  max-width: 88vw;
  text-align: center;
  border: 1px solid var(--border);
}
#toast-root.show { opacity: 1; transform: translate(-50%, -4px); }

/* ── CHARTS ─────────────────────────────────────────────── */
.ring-chart-label {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  fill: var(--text-primary);
}
.stat-ring { align-items: center; justify-content: center; gap: 8px; }

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
}
.bar-chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
}
.bar-chart-bar {
  width: 100%;
  max-width: 20px;
  background: var(--surface-2);
  border-radius: 3px 3px 2px 2px;
  transition: height 0.3s ease;
}
.bar-chart-bar.is-today { background: var(--text-primary); }
.bar-chart-label {
  font-size: 9.5px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ── ACCOUNT / SYNC ─────────────────────────────────────── */
.account-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.account-row-compact {
  justify-content: space-between;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  margin-bottom: 6px;
}
.account-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.account-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
}
.account-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.account-name { font-weight: 600; font-size: 13.5px; }
.account-email { font-size: 11.5px; color: var(--text-muted); }
.account-list { margin-bottom: 8px; }
