/* ─── CSS VARIABLES ────────────────────────────────────────────────────────── */
:root {
  --primary:       #4F46E5;
  --primary-light: #EEF2FF;
  --primary-dark:  #3730A3;
  --success:       #10B981;
  --success-light: #ECFDF5;
  --warning:       #F59E0B;
  --warning-light: #FFFBEB;
  --danger:        #EF4444;
  --danger-light:  #FEF2F2;
  --bg:            #F1F5F9;
  --card:          #FFFFFF;
  --border:        #E2E8F0;
  --text:          #1E293B;
  --text-muted:    #64748B;
  --text-light:    #94A3B8;
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.08);
  --shadow:        0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg:     0 8px 30px rgba(0,0,0,0.12);
  --radius:        10px;
  --radius-sm:     6px;
  --radius-lg:     16px;
  --m1: #EF4444;
  --m2: #F97316;
  --m3: #EAB308;
  --m4: #84CC16;
  --m5: #10B981;
  --header-h: 106px;
}

/* ─── RESET ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 15px; }
a { color: var(--primary); text-decoration: none; }

/* ─── LAYOUT ─────────────────────────────────────────────────────────────────── */
#app { display: flex; flex-direction: column; min-height: 100vh; }

.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--primary);
  box-shadow: 0 2px 12px rgba(79,70,229,0.3);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}

.brand-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.countdown-badge {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.18);
  padding: 4px 12px;
  border-radius: 20px;
  white-space: nowrap;
}

/* ─── TAB NAV ───────────────────────────────────────────────────────────────── */
.tab-nav {
  display: flex;
  padding: 0 12px;
  gap: 2px;
}

.tab-btn {
  flex: 1;
  padding: 9px 8px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.7);
  font-size: 13.5px;
  font-weight: 500;
  border-bottom: 3px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.tab-btn:hover { color: rgba(255,255,255,0.9); }

.tab-btn.active {
  color: #fff;
  border-bottom-color: #fff;
  font-weight: 600;
}

/* ─── ROLLOVER BAR ──────────────────────────────────────────────────────────── */
.rollover-bar {
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--warning);
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
}

.rollover-bar.hidden { display: none; }

.rollover-icon { font-size: 16px; }

.rollover-dismiss {
  margin-left: auto;
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  line-height: 1;
  opacity: 0.8;
}

.rollover-dismiss:hover { opacity: 1; }

/* ─── MAIN ──────────────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  margin-top: var(--header-h);
  padding: 20px;
  max-width: 860px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.main.with-banner { margin-top: calc(var(--header-h) + 42px); }

.loading {
  text-align: center;
  color: var(--text-muted);
  padding: 60px;
}

/* ─── CARDS ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 14px;
}

/* ─── TODAY VIEW ─────────────────────────────────────────────────────────────── */
.today-header {
  margin-bottom: 20px;
}

.today-date {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.today-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 2px;
}

.progress-section {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.progress-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.progress-count {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.progress-bar-wrap {
  height: 8px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
  transition: width 0.3s ease;
}

.progress-bar-fill.done { background: var(--success); }

/* ─── TASK CARD ─────────────────────────────────────────────────────────────── */
.task-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
  position: relative;
}

.task-card:hover { box-shadow: var(--shadow); }

.task-card.status-done {
  border-color: #A7F3D0;
  background: #F0FDF9;
}

.task-card.status-skipped {
  border-color: var(--border);
  background: #F8FAFC;
  opacity: 0.75;
}

.task-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 10px;
}

.task-block-num {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.task-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.task-chapter {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.task-chapter.done-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.task-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.task-undo {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
}

.task-undo:hover { color: var(--text); }

.rolled-over-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--warning);
  background: var(--warning-light);
  border: 1px solid #FDE68A;
  padding: 2px 7px;
  border-radius: 20px;
}

/* ─── BADGES ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
}

.badge-subject {
  color: #fff;
}

.badge-mastery {
  color: #fff;
  font-size: 11px;
}

.badge-duration {
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 500;
}

/* ─── MASTERY STARS ─────────────────────────────────────────────────────────── */
.mastery-stars {
  display: inline-flex;
  gap: 2px;
  align-items: center;
}

.star {
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.1s;
  line-height: 1;
}

.star:hover { transform: scale(1.2); }
.star.filled { color: #F59E0B; }
.star.empty  { color: #D1D5DB; }

/* clickable stars in forms */
.star-input { cursor: pointer; }

/* ─── BUTTONS ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover { background: #0DA271; }

.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #DC2626; }

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--border); }

.btn-warning  { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #D97706; }

.btn-ghost {
  background: transparent;
  color: var(--primary);
  border-color: transparent;
  padding: 6px 10px;
}
.btn-ghost:hover { background: var(--primary-light); }

.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-xs { padding: 3px 8px; font-size: 11.5px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }

/* ─── EMPTY STATE ────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.empty-text {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

/* ─── STATS STRIP ─────────────────────────────────────────────────────────────── */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ─── PLANNING VIEW ──────────────────────────────────────────────────────────── */
.week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.week-label {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.day-row {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.day-row-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  gap: 12px;
  user-select: none;
  transition: background 0.15s;
}

.day-row-header:hover { background: var(--bg); }

.day-row-header.today-row { background: var(--primary-light); }

.day-label {
  font-weight: 600;
  font-size: 14.5px;
  min-width: 120px;
}

.day-row-header.today-row .day-label { color: var(--primary); }

.day-status-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}

.day-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  color: #fff;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-chip.done-chip { opacity: 0.6; text-decoration: line-through; }

.day-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.day-count {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.day-done-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--success);
}

.day-overdue-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--danger);
}

.day-expand-icon {
  font-size: 12px;
  color: var(--text-light);
  transition: transform 0.2s;
}

.day-expand-icon.open { transform: rotate(180deg); }

.day-body {
  display: none;
  padding: 0 16px 12px;
  border-top: 1px solid var(--border);
}

.day-body.open { display: block; }

.day-task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--bg);
  font-size: 13.5px;
}

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

.day-task-num {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 36px;
}

.day-task-chapter {
  flex: 1;
  font-weight: 500;
}

.day-task-status {
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}

.status-pending  { background: var(--bg);          color: var(--text-muted); }
.status-done     { background: var(--success-light); color: var(--success); }
.status-skipped  { background: #F1F5F9;             color: var(--text-muted); }
.status-overdue  { background: var(--danger-light);  color: var(--danger); }

.day-task-actions { display: flex; gap: 4px; flex-shrink: 0; }

.no-study-day {
  padding: 12px 16px;
  color: var(--text-light);
  font-size: 13.5px;
  font-style: italic;
}

/* ─── CHAPTERS VIEW ──────────────────────────────────────────────────────────── */
.chapters-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.chapters-toolbar .spacer { flex: 1; }

.filter-select {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-size: 13.5px;
  cursor: pointer;
}

.table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.chapter-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.chapter-table th {
  padding: 11px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.chapter-table th:hover { color: var(--text); }
.chapter-table th.sort-asc::after  { content: ' ▲'; font-size: 10px; }
.chapter-table th.sort-desc::after { content: ' ▼'; font-size: 10px; }

.chapter-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.chapter-table tr:last-child td { border-bottom: none; }
.chapter-table tr:hover td { background: #FAFBFD; }

.chapter-name-cell {
  font-weight: 500;
}

.chapter-notes-cell {
  color: var(--text-muted);
  font-size: 13px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  align-items: center;
  white-space: nowrap;
}

.actions-col {
  width: 160px;
  min-width: 160px;
  text-align: right !important;
}

.chapter-actions .btn {
  padding: 4px 6px;
  min-width: 28px;
  justify-content: center;
}

.chapter-actions .btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.mastery-bar-wrap {
  width: 80px;
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  display: inline-block;
}

.mastery-bar-fill {
  height: 100%;
  border-radius: 99px;
}

/* ─── SETTINGS VIEW ──────────────────────────────────────────────────────────── */
.settings-section {
  margin-bottom: 24px;
}

.settings-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.form-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 140px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.form-input {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-size: 14.5px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}

.form-input-sm {
  padding: 7px 10px;
  font-size: 14px;
  text-align: center;
  width: 70px;
}

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

.day-block-input {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.day-block-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.settings-warning {
  background: var(--warning-light);
  border: 1px solid #FDE68A;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13.5px;
  color: #92400E;
  margin-top: 12px;
}

.settings-info {
  background: var(--primary-light);
  border: 1px solid #C7D2FE;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13.5px;
  color: #3730A3;
  margin-top: 12px;
}

.capacity-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-size: 13.5px;
}

.danger-zone {
  border: 1px solid #FECACA;
  border-radius: var(--radius);
  padding: 16px 18px;
  background: #FFF5F5;
}

.danger-zone-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--danger);
  margin-bottom: 8px;
}

/* ─── MODAL ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}

.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 1;
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  padding: 0 2px;
  line-height: 1;
}

.modal-close-btn:hover { color: var(--text); }

.modal-body {
  padding: 20px 22px;
}

.modal-body .form-group {
  margin-bottom: 14px;
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}

/* star rating in form */
.star-rating-input {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.star-rating-input .star {
  font-size: 24px;
}

.mastery-description {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
  min-height: 18px;
}

/* ─── SECTION HEADER ────────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

/* ─── CONGRATULATIONS BANNER ─────────────────────────────────────────────────── */
.congrats-banner {
  background: linear-gradient(135deg, var(--success), #059669);
  color: #fff;
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  margin-bottom: 20px;
}

.congrats-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.congrats-text {
  font-size: 14px;
  opacity: 0.9;
}

/* ─── PLANNING CAP WARNING ───────────────────────────────────────────────────── */
.cap-bar {
  height: 10px;
  border-radius: 99px;
  background: var(--border);
  overflow: hidden;
  margin-top: 8px;
}

.cap-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--success);
  transition: width 0.4s;
}

.cap-fill.over { background: var(--danger); }
.cap-fill.near { background: var(--warning); }

/* ─── RESPONSIVE ─────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
  .days-grid { grid-template-columns: repeat(4, 1fr); }
  .main { padding: 14px; }
  .header-inner { padding: 10px 14px 8px; }
  .tab-btn { font-size: 12px; padding: 8px 6px; }
  .chapter-table th:nth-child(4),
  .chapter-table td:nth-child(4),
  .chapter-table th:nth-child(5),
  .chapter-table td:nth-child(5) { display: none; }
}

@media (max-width: 420px) {
  .stats-strip { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .form-row { flex-direction: column; }
  .days-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
}

/* ─── VAKKEN VIEW ────────────────────────────────────────────────────────────── */
.vakken-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.subject-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.subject-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.15s;
}

.subject-card:hover { box-shadow: var(--shadow); }

.subject-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  color: #fff;
}

.subject-card-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.subject-card-name::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  background: rgba(255,255,255,0.7);
  border-radius: 50%;
  flex-shrink: 0;
}

.subject-card-actions {
  display: flex;
  gap: 4px;
}

.subject-card-action {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s;
}

.subject-card-action:hover { background: rgba(255,255,255,0.35); }

.subject-card-body {
  padding: 14px 16px;
}

.subject-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.subject-stat-row strong { color: var(--text); }

.subject-progress-bar {
  height: 7px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin: 8px 0 10px;
}

.subject-progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.3s;
}

.subject-next-block {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.subject-card-footer {
  border-top: 1px solid var(--border);
  padding: 10px 16px;
}

/* ─── COLOR SWATCHES (subject modal) ──────────────────────────────────────────── */
.color-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.color-swatch:hover { transform: scale(1.15); }

.color-swatch.selected {
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.3);
  transform: scale(1.1);
}

/* ─── PLANNING FILTER BAR ────────────────────────────────────────────────────── */
.plan-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.plan-filter-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.plan-filter-active {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  color: #fff;
}

.plan-filter-clear {
  background: rgba(255,255,255,0.25);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ─── TODAY SUBJECT GROUP ────────────────────────────────────────────────────── */
.subject-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 8px;
}

.subject-group-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.subject-group-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.subject-group-count {
  font-size: 12px;
  color: var(--text-light);
  margin-left: auto;
}

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

/* ─── SUBJECT DETAIL VIEW ───────────────────────────────────────────────────── */
.subject-detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 0 4px;
  margin-bottom: 14px;
}
.subject-detail-back:hover { color: var(--primary); }

.subject-detail-header {
  border-radius: var(--radius);
  padding: 20px 22px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.subject-detail-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.subject-detail-subtitle {
  font-size: 13px;
  opacity: 0.85;
  margin-top: 4px;
}

/* ─── EXAM LIST (subject detail) ─────────────────────────────────────────────── */
.exam-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.exam-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.exam-item-name { flex: 1; font-weight: 500; }
.exam-item-duration { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }

.exam-item-done {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--success);
  background: var(--success-light);
  padding: 2px 8px;
  border-radius: 20px;
}

.exam-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 4px;
}
.exam-delete:hover { color: var(--danger); background: var(--danger-light); }

.exam-none {
  font-size: 13.5px;
  color: var(--text-light);
  font-style: italic;
  padding: 8px 0;
}

/* ─── PARTS MANAGEMENT (chapter modal) ──────────────────────────────────────── */
.parts-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.parts-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.parts-info {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.5;
}

.parts-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
  min-height: 10px;
}

.part-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
}

.part-item-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 20px;
}

.part-item-name { flex: 1; }

.part-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.part-input-row input { flex: 1; }

/* ─── EXAM TASK CARD ─────────────────────────────────────────────────────────── */
.task-card.exam-task {
  border-left: 4px solid var(--warning);
}

.exam-task-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #92400E;
  background: var(--warning-light);
  border: 1px solid #FDE68A;
  padding: 2px 8px;
  border-radius: 20px;
}

.task-part-label {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 2px 0 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* exam chip in planning */
.day-chip.exam-chip { background: var(--warning); }

/* ─── CHAPTER LIST (subject detail) ─────────────────────────────────────────── */
.chapter-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 14px;
}

.chapter-list-name { flex: 1; font-weight: 500; }
.chapter-list-parts { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* ─── STUDY ORDER TOGGLE ─────────────────────────────────────────────────────── */
.study-order-toggle {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.study-order-option {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--card);
  transition: border-color 0.15s, background 0.15s;
  text-align: left;
}

.study-order-option:hover { border-color: var(--primary); }

.study-order-option.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.study-order-option input[type="radio"] { margin-top: 2px; flex-shrink: 0; }

.study-order-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  display: block;
}

.study-order-desc {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
  line-height: 1.4;
}

/* ─── UTILITIES ──────────────────────────────────────────────────────────────── */
.hidden   { display: none !important; }
.mt-8     { margin-top: 8px; }
.mt-12    { margin-top: 12px; }
.mt-16    { margin-top: 16px; }
.text-muted { color: var(--text-muted); font-size: 13px; }
.text-danger { color: var(--danger); }
.flex-center { display: flex; align-items: center; justify-content: center; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ─── LOGIN SCHERM ───────────────────────────────────────────────────────────── */
.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.login-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.10);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.login-brand svg {
  width: 28px;
  height: 28px;
  stroke: var(--primary);
}

.login-title {
  font-size: 26px;
  line-height: 1.1;
  margin-bottom: 8px;
  color: var(--text);
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.login-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--danger-light);
  border-radius: 8px;
}

.login-toggle-btn {
  width: 100%;
  margin-top: 12px;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.login-toggle-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
