:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #22263a;
  --border: #2e3350;
  --accent: #4f8ef7;
  --accent2: #7c6af7;
  --text: #e8eaf6;
  --muted: #8890b0;
  --success: #4caf7d;
  --warn: #f7a24f;
  --danger: #f76060;
  --radius: 14px;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ─── Layout ─────────────────────────────────── */
.container { max-width: 900px; margin: 0 auto; padding: 0 1.5rem; }

header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.2rem;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); }

/* ─── View switching ─────────────────────────── */
.view { display: none; }
.view.active { display: block; }

/* ─── Login ──────────────────────────────────── */
#login-view {
  display: none;
  min-height: calc(100vh - 65px);
  align-items: center;
  justify-content: center;
}
#login-view.active { display: flex; }

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
}

.login-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.login-card p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.field { margin-bottom: 1.25rem; }
.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.search-wrapper { position: relative; }
.search-wrapper input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 1rem;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s;
}
.search-wrapper input:focus { border-color: var(--accent); }
.search-wrapper input::placeholder { color: var(--muted); }

.field input[type="text"],
.field input[type="password"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 1rem;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s;
}
.field input[type="text"]:focus,
.field input[type="password"]:focus { border-color: var(--accent); }
.field input::placeholder { color: var(--muted); }

.dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 200;
  display: none;
}
.dropdown.open { display: block; }

.dropdown-item {
  padding: 0.65rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.1s;
}
.dropdown-item:hover,
.dropdown-item.selected { background: var(--border); }
.dropdown-item.selected { color: var(--accent); font-weight: 500; }
.dropdown-item.sso { color: var(--muted); }
.dropdown-item.sso:hover { color: var(--text); }
.sso-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--border);
  color: var(--muted);
  vertical-align: middle;
  margin-left: 4px;
}

/* ─── Grades page ────────────────────────────── */
#grades-view { padding: 2rem 0; }

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.page-subtitle { color: var(--muted); font-size: 0.9rem; margin-bottom: 2rem; }

/* Grades header */
.grades-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.grades-header .page-title { margin-bottom: 0.25rem; }
.grades-header .page-subtitle { margin-bottom: 0; }

select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 2rem 0.6rem 1rem;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238890b0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  transition: border-color 0.15s;
}
select:focus { border-color: var(--accent); }

/* Search bar */
.subject-search-wrap {
  margin-bottom: 1.5rem;
}
.subject-search-wrap input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1.2rem;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
}
.subject-search-wrap input:focus { border-color: var(--accent); }
.subject-search-wrap input::placeholder { color: var(--muted); }

/* Subjects grid */
.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.subject-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.subject-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(79, 142, 247, 0.1);
}
.subject-card.open {
  border-color: var(--accent2);
  box-shadow: 0 8px 30px rgba(124, 106, 247, 0.12);
}

.subject-afkorting {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.25rem;
}
.subject-naam {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}
.subject-count {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Ticker */
.grade-ticker-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.6rem;
}
.grade-ticker {
  font-size: 2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  min-width: 3ch;
}
.grade-ticker.low {
  background: linear-gradient(135deg, var(--danger), #f7a24f);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Grade detail panel */
.grade-panel {
  grid-column: 1 / -1;
  background: var(--surface2);
  border: 1px solid var(--accent2);
  border-radius: var(--radius);
  overflow: hidden;
  animation: slideDown 0.25s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.grade-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.grade-panel-title { font-weight: 600; font-size: 1rem; }

.grades-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.grades-table th {
  text-align: left;
  padding: 0.6rem 1.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--surface);
}
.grades-table td {
  padding: 0.65rem 1.5rem;
  border-top: 1px solid var(--border);
}
.grades-table tr:last-child td { border-bottom: none; }

.grade-val {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.9rem;
  background: rgba(79, 142, 247, 0.12);
  color: var(--accent);
}
.grade-val.pass { background: rgba(76, 175, 125, 0.12); color: var(--success); }
.grade-val.fail { background: rgba(247, 96, 96, 0.12); color: var(--danger); }
.grade-val.excluded { opacity: 0.45; }

.jaar-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 5px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--border);
  color: var(--muted);
}

.type-avg {
  font-style: italic;
  color: var(--accent2);
}

.type-rapport {
  color: var(--accent);
}

.rapport-row td {
  background: rgba(79, 142, 247, 0.05);
  font-weight: 600;
  border-top: 1px solid rgba(79, 142, 247, 0.2) !important;
  border-bottom: 1px solid rgba(79, 142, 247, 0.2);
}

/* Loading */
.loading-row td {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
}
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 0.5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty / error */
.empty-msg {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Skeleton loader for subjects */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 8px;
  height: 14px;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  height: 120px;
}
.skeleton-card .skeleton + .skeleton { margin-top: 0.6rem; }
.skeleton-card .skeleton:nth-child(1) { width: 40%; height: 10px; }
.skeleton-card .skeleton:nth-child(2) { width: 70%; height: 14px; }
.skeleton-card .skeleton:nth-child(3) { width: 50%; height: 10px; margin-top: 1rem; }

/* Upcoming tests section */
.upcoming-section {
  border-top: 2px solid var(--border);
}

.upcoming-header {
  padding: 0.65rem 1.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.target-avg-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  flex-shrink: 0;
}

.target-avg-slider-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.target-avg-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}
.target-avg-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(79,142,247,0.4);
  transition: transform 0.1s;
}
.target-avg-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}
.target-avg-slider:active::-webkit-slider-thumb { transform: scale(1.2); }

.target-avg-display {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 2.4rem;
}

.upcoming-table-wrap {
  overflow-x: auto;
}

.upcoming-avg-badge {
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
}
.upcoming-avg-badge.fail { background: rgba(247, 96, 96, 0.12); color: var(--danger); }
.upcoming-avg-badge.pass { background: rgba(76, 175, 125, 0.12); color: var(--success); }

.upcoming-row td {
  opacity: 0.8;
}

.min-score-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  margin-left: 0.5rem;
  vertical-align: middle;
}
.min-score-badge.needed  { background: rgba(247, 162, 79, 0.15); color: var(--warn); }
.min-score-badge.impossible { background: rgba(247, 96, 96, 0.12); color: var(--danger); }
.min-score-badge.ok { background: rgba(76, 175, 125, 0.12); color: var(--success); }

.btn-ghost.active {
  background: rgba(79, 142, 247, 0.1);
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── E-mail nudge banner ────────────────────────────────────────────────── */

.email-banner {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: linear-gradient(135deg, #1e2a45, #1e2d3e);
  border-bottom: 1px solid #2e4a6a;
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  animation: banner-slide-down 0.3s ease;
}

@keyframes banner-slide-down {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

.email-banner-icon { font-size: 1.3rem; flex-shrink: 0; }

.email-banner-text {
  flex: 1;
  color: var(--text);
  line-height: 1.5;
}

.email-banner-text strong { color: #fff; }

.email-banner-cta {
  flex-shrink: 0;
  font-size: 0.82rem;
  padding: 0.35rem 0.9rem;
  white-space: nowrap;
}

.email-banner-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color 0.15s;
}

.email-banner-close:hover { color: var(--text); }

@media (max-width: 600px) {
  .email-banner { flex-wrap: wrap; gap: 0.6rem; }
  .email-banner-text { flex-basis: 100%; }

  /* Aankomende toetsen: verberg minder belangrijke kolommen */
  .col-extra { display: none; }

  /* Slider: volle breedte + header stapelen */
  .upcoming-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .target-avg-label {
    flex-direction: row;
    align-items: center;
    width: 100%;
  }
  .target-avg-slider-wrap {
    flex: 1;
  }
  .target-avg-slider {
    width: 100%;
  }
}

/* ─── Profile / Settings panel ───────────────────────────────────────────── */

.profile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 200;
  backdrop-filter: blur(2px);
}

.profile-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100vw);
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 201;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.profile-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.profile-body {
  overflow-y: auto;
  flex: 1;
}

.profile-section {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.profile-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.profile-field {
  margin-bottom: 0.65rem;
}

.profile-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.profile-field-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.profile-hint {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.5;
}

.profile-subject-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.profile-subject-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.6rem;
  background: var(--surface2);
  border-radius: 8px;
}

.profile-subject-naam {
  flex: 1;
  font-size: 0.85rem;
}

.profile-subject-target {
  width: 4.5rem;
  padding: 0.15rem 0.35rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}

.profile-subject-target:focus { border-color: var(--accent); }

.profile-subject-del {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  padding: 0.1rem 0.25rem;
  border-radius: 4px;
  transition: color 0.15s;
}
.profile-subject-del:hover { color: var(--danger); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Unboxing overlay ─────────────────────────────────────────────────────── */
.unboxing-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.85);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(6px);
}
.unboxing-card {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  text-align: center; padding: 56px 48px;
  background: #0f1117; border: 1px solid #FFD700;
  border-radius: 20px; box-shadow: 0 0 60px rgba(255,215,0,.25);
  min-width: 340px; max-width: 480px;
}
.unboxing-vak {
  font-size: 1.1rem; font-weight: 600; color: #aaa; letter-spacing: .06em;
  text-transform: uppercase; opacity: 0;
  animation: ub-fadein .5s .1s forwards;
}
.unboxing-verdict {
  font-size: 2.2rem; font-weight: 800; letter-spacing: .02em;
  min-height: 2.6rem; opacity: 0;
}
.unboxing-verdict.show { animation: ub-pop .45s forwards; }
.unboxing-verdict.voldoende { color: #57F287; }
.unboxing-verdict.onvoldoende { color: #ED4245; }
.unboxing-cijfer {
  font-size: 5.5rem; font-weight: 900; line-height: 1;
  color: #FFD700; text-shadow: 0 0 30px rgba(255,215,0,.5);
  min-height: 6rem; letter-spacing: -.02em; opacity: 0;
}
.unboxing-cijfer.show { animation: ub-fadein .3s forwards; }
.unboxing-sub {
  font-size: .9rem; color: #666; min-height: 1.2rem; opacity: 0;
}
.unboxing-sub.show { animation: ub-fadein .4s forwards; }
.unboxing-next {
  margin-top: 8px; padding: 10px 32px;
  background: #FFD700; color: #0f1117;
  border: none; border-radius: 8px; font-size: 1rem; font-weight: 700;
  cursor: pointer; transition: transform .1s;
}
.unboxing-next:hover { transform: scale(1.04); }

/* Confetti particles */
.unboxing-particles { position: fixed; inset: 0; pointer-events: none; z-index: 1; }
.unboxing-particle {
  position: absolute; width: 8px; height: 8px; border-radius: 2px;
  animation: ub-fall linear forwards;
}

@keyframes ub-fadein { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:none; } }
@keyframes ub-pop    { 0% { opacity:0; transform:scale(.5); } 60% { transform:scale(1.15); } 100% { opacity:1; transform:scale(1); } }
@keyframes ub-fall   {
  0%   { opacity:1; transform: translateY(0) rotate(0deg); }
  100% { opacity:0; transform: translateY(100vh) rotate(720deg); }
}

/* ── Consent overlay (zelfde aanpak als unboxing) ───────────────────────── */
.consent-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}

.consent-card {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 20px;
  text-align: center;
  padding: 52px 44px;
  background: #0f1117;
  border: 1px solid #FFD700;
  border-radius: 20px;
  box-shadow: 0 0 80px rgba(255,215,0,.3), 0 32px 80px rgba(0,0,0,.7);
  width: 100%; max-width: 480px;
  animation: consent-card-in .5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes consent-card-in {
  from { opacity: 0; transform: scale(0.82) translateY(32px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Staggered entrance — fill-mode:both means opacity:0 applies during delay too */
.consent-icon {
  font-size: 3.5rem; line-height: 1;
  animation: ub-pop .55s .3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  filter: drop-shadow(0 0 18px rgba(255,215,0,.5));
}

.consent-title {
  font-size: 1.5rem; font-weight: 800; color: #FFD700;
  text-shadow: 0 0 24px rgba(255,215,0,.45); letter-spacing: .01em;
  animation: ub-fadein .4s .55s ease both;
}

.consent-subtitle {
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .12em; color: #555; margin-top: -12px;
  animation: ub-fadein .4s .67s ease both;
}

.consent-body {
  font-size: .875rem; color: #999; line-height: 1.75; margin: 0;
  animation: ub-fadein .4s .8s ease both;
}
.consent-body a { color: #FFD700; text-decoration: none; }
.consent-body a:hover { text-decoration: underline; }

.consent-check-label {
  display: flex; align-items: flex-start; gap: 12px; text-align: left;
  background: rgba(255,215,0,.05); border: 1px solid rgba(255,215,0,.2);
  border-radius: 10px; padding: 14px 16px;
  font-size: .875rem; color: #ccc; cursor: pointer; width: 100%;
  transition: border-color .25s, background .25s, box-shadow .25s;
  animation: ub-fadein .4s .95s ease both;
}
.consent-check-label:has(input:checked) {
  border-color: #FFD700;
  background: rgba(255,215,0,.09);
  box-shadow: 0 0 16px rgba(255,215,0,.12);
}
.consent-check-label input {
  margin-top: 2px; flex-shrink: 0;
  accent-color: #FFD700; width: 16px; height: 16px; cursor: pointer;
}

.consent-btn {
  width: 100%; padding: 14px;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: #0f1117;
  border: none; border-radius: 10px;
  font-size: 1rem; font-weight: 800; cursor: pointer;
  letter-spacing: .01em;
  box-shadow: 0 4px 20px rgba(255,215,0,.3);
  transition: transform .15s, box-shadow .15s, opacity .3s;
  /* Geen animation hier — opacity gecontroleerd via JS + :disabled CSS */
}
.consent-btn:not(:disabled):hover {
  transform: scale(1.04);
  box-shadow: 0 6px 28px rgba(255,215,0,.45);
}
/* Disabled: dim en no pointer — JS zorgt voor initieel verbergen */
.consent-btn:disabled { opacity: .3; cursor: not-allowed; box-shadow: none; }

/* ── Nav tabs ────────────────────────────────────────────────────────────── */
.main-nav {
  display: flex; gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
}
.nav-tab {
  background: none; border: none;
  padding: 6px 16px; border-radius: 8px;
  font-size: 0.85rem; font-weight: 600;
  color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-tab:hover { color: var(--text); }
.nav-tab.active { background: var(--surface2); color: var(--text); }

/* ── Analyse view ────────────────────────────────────────────────────────── */
.analyse-summary {
  display: flex; gap: 16px; margin-bottom: 24px;
  flex-wrap: wrap;
}
.analyse-stat {
  flex: 1; min-width: 120px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  text-align: center;
}
.analyse-stat-value {
  font-size: 2rem; font-weight: 800;
  line-height: 1; margin-bottom: 6px;
}
.analyse-stat-label { font-size: 0.78rem; color: var(--muted); font-weight: 500; }

.analyse-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
  margin-bottom: 16px;
  border-left: 4px solid var(--border);
}
.analyse-card--success { border-left-color: var(--success); }
.analyse-card--danger  { border-left-color: var(--danger);  }
.analyse-card--warn    { border-left-color: #f0a500;        }
.analyse-card--gold    { border-left-color: #f5c542;        }

/* ── Records toggle ───────────────────────────────────────────────────────── */
.records-toggle {
  display: flex;
  gap: 6px;
  margin: 6px 0 0;
}
.records-toggle-pill {
  padding: 4px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.records-toggle-pill:hover  { background: var(--surface2); color: var(--text); }
.records-toggle-pill.active { background: #f5c542; color: #111; border-color: #f5c542; }

/* ── Records grid ─────────────────────────────────────────────────────────── */
.records-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.record-item {
  background: var(--surface2);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
}
.record-val  {
  font-size: 1.8rem; font-weight: 800; line-height: 1; margin-bottom: 4px;
}
.record-label {
  font-size: 0.75rem; font-weight: 600; color: var(--text);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px;
}
.record-sub     { font-size: 0.72rem; color: var(--muted); line-height: 1.6; }
.record-sj      { opacity: 0.6; font-size: 0.68rem; }
.record-periode {
  display: inline-block;
  font-size: 0.65rem; font-weight: 700;
  padding: 1px 5px; border-radius: 4px;
  background: var(--surface2); color: var(--text);
  vertical-align: middle; margin: 0 2px;
}

.analyse-card-title {
  font-size: 1rem; font-weight: 700; margin-bottom: 4px;
}
.analyse-card-sub {
  font-size: 0.8rem; color: var(--muted); margin-bottom: 14px;
}
.analyse-rows { display: flex; flex-direction: column; gap: 8px; }
.analyse-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: var(--surface2);
  border-radius: 8px;
}
.analyse-vak  { flex: 1; font-size: 0.88rem; font-weight: 500; }
.analyse-meta { font-size: 0.8rem; color: var(--muted); }
.analyse-badge {
  font-size: 0.85rem; font-weight: 700;
  padding: 2px 10px; border-radius: 20px;
  background: rgba(255,255,255,.06);
  white-space: nowrap;
}

/* Kleurhelpers */
.colour-green  { color: var(--success); }
.colour-yellow { color: #f0a500; }
.colour-red    { color: var(--danger); }

.trend-up     { color: var(--success); font-size: 0.75rem; }
.trend-down   { color: var(--danger);  font-size: 0.75rem; }
.trend-stable { color: var(--muted);   font-size: 0.75rem; }

/* ── Multi-year trend ──────────────────────────────────────────────────────── */
.multi-year-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0;
}
.multi-year-label {
  font-size: 0.82rem; font-weight: 600;
  min-width: 120px; line-height: 1.3;
}
.my-label-sub {
  font-weight: 400; color: var(--muted); font-size: 0.73rem;
}
.my-huidig-badge {
  display: inline-block; font-size: 0.62rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  background: var(--accent); color: #fff;
  border-radius: 4px; padding: 1px 6px;
  margin-bottom: 3px; line-height: 1.6;
}
.multi-year-bar-wrap {
  flex: 1; height: 10px;
  background: var(--surface2); border-radius: 99px; overflow: hidden;
}
.multi-year-bar {
  height: 100%; border-radius: 99px;
  transition: width 0.6s ease;
}
.multi-year-val {
  font-size: 0.9rem; font-weight: 700; min-width: 2.8rem; text-align: right;
}
.multi-year-meta {
  font-size: 0.75rem; color: var(--muted); min-width: 90px;
}

/* ── Per-vak vergelijkingstabel (multi-year) ───────────────────────────────── */
.my-table {
  width: 100%; border-collapse: collapse; margin-top: 1rem;
  font-size: 0.85rem;
}
.my-th-vak {
  text-align: left; padding: 8px 10px 8px 0;
  font-weight: 600; color: var(--muted); font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
  min-width: 140px;
}
.my-th-jaar {
  text-align: center; padding: 8px 12px;
  font-weight: 600; color: var(--muted); font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  line-height: 1.35;
}
.my-th-trend {
  text-align: center; padding: 8px 8px;
  border-bottom: 1px solid var(--border); width: 40px;
}
.my-tr { border-bottom: 1px solid var(--border); }
.my-tr:last-child { border-bottom: none; }
.my-tr:hover { background: var(--surface2); }
.my-td-vak {
  padding: 9px 10px 9px 0; font-weight: 500;
  white-space: nowrap; min-width: 140px;
}
.my-td-cijfer {
  text-align: center; padding: 9px 12px;
  font-weight: 700; font-size: 0.88rem;
  vertical-align: top;
}
.my-td-perioden {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  margin-top: 5px;
}
.my-td-periode {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface2);
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
}
.my-td-periode span { font-weight: 700; }
.my-td-empty { color: var(--muted); font-weight: 400; }
.my-td-trend { text-align: center; padding: 9px 8px; vertical-align: top; }

/* ── Bevorderingsadvies ────────────────────────────────────────────────────── */
.bevor-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  padding: 10px 14px;
  background: var(--surface2);
  border-radius: 8px;
}
.bevor-status-icon  { font-size: 1.4rem; }
.bevor-status-label { font-size: 1rem; font-weight: 700; flex: 1; }
.bevor-gem          { font-size: 1.1rem; font-weight: 800; }

.bevor-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 12px;
}
@media (max-width: 600px) { .bevor-two-col { grid-template-columns: 1fr; } }

.bevor-section-title {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); margin-bottom: 4px;
}

.bevor-table {
  width: 100%; border-collapse: collapse; font-size: .82rem;
  margin-top: 6px;
}
.bevor-table thead th {
  text-align: left; padding: 6px 8px;
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.bevor-tr { border-bottom: 1px solid var(--border); }
.bevor-tr:last-child { border-bottom: none; }
.bevor-tr:hover { background: var(--surface2); }
.bevor-td-icon   { padding: 7px 6px; text-align: center; width: 28px; }
.bevor-td-vak    { padding: 7px 8px; font-weight: 600; }
.bevor-td-cij    { padding: 7px 8px; text-align: center; font-weight: 800; font-size: .95rem; width: 40px; }
.bevor-td-min    { padding: 7px 8px; text-align: center; width: 56px; color: var(--accent); }
.bevor-td-advies { padding: 7px 8px; color: var(--muted); font-size: .78rem; }

.bevor-tag {
  display: inline-block; font-size: .6rem; font-weight: 700;
  padding: 1px 6px; border-radius: 10px;
  background: var(--surface2); color: var(--muted);
  margin-left: 5px; vertical-align: middle;
}
.bevor-tag--combi { background: #2a3a5e; color: #7aabf7; }

.bevor-opmerkingen {
  margin-top: 14px; display: flex; flex-direction: column; gap: 4px;
  font-size: .72rem; color: var(--muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE — max-width: 640px
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {

  /* ── Algemeen ── */
  .container { padding: 0 1rem; }

  /* ── Header: compacter, uitloggen als icon ── */
  header { padding: 0.65rem 0; }

  #user-name { display: none; }              /* naam verbergen, ruimte besparen */

  #logout-btn { font-size: 0; padding: 0.45rem 0.65rem; }   /* alleen icon */
  #logout-btn::after { content: '↩'; font-size: 0.95rem; }

  .main-nav { gap: 2px; padding: 2px; }
  .nav-tab  { padding: 6px 10px; font-size: 0.78rem; }

  /* ── Subject-cards: 1 kolom op smalle schermen ── */
  .subjects-grid { grid-template-columns: 1fr; }

  /* ── Grades-header: stapelen ── */
  .grades-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .grades-header select { width: 100%; }

  /* ── Cijfertabel: compactere padding, weging verbergen ── */
  .grades-table th,
  .grades-table td { padding: 0.55rem 0.75rem; }

  .grades-table th:nth-child(4),
  .grades-table td:nth-child(4) { display: none; }   /* weging-kolom */

  /* ── Grade detail panel ── */
  .grade-panel-header { padding: 0.75rem 1rem; }

  /* ── Multi-jaar analyse: horizontaal scrollen ── */
  .analyse-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .my-table     { min-width: 480px; }

  /* ── Analyse summary stats: 2×2 grid ipv 1 rij ── */
  .analyse-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .analyse-stat    { margin: 0; }

  /* ── Bevorderingsadvies: kolom-labels inkorten ── */
  .bevor-td-advies { display: none; }         /* advies-kolom weghalen op mobiel */
  .bevor-td-min    { padding: 7px 4px; }
  .bevor-td-cij    { padding: 7px 4px; }

  /* ── Email banner: stapelen ── */
  .email-banner { padding: 0.75rem 1rem; }
  .email-banner-cta { width: 100%; justify-content: center; }
}

/* Extra smal (320px, bijv. iPhone SE) */
@media (max-width: 380px) {
  .nav-tab { padding: 5px 7px; font-size: 0.72rem; }
  .grade-ticker { font-size: 1.6rem; }
}
