/* ── Design tokens — dark (default) ──────────────────────────────────── */
:root {
  --bg:           #0e0e0e;
  --bg-2:         #161616;
  --bg-3:         #1e1e1e;
  --bg-hover:     #242424;
  --border:       rgba(255,255,255,0.07);
  --border-med:   rgba(255,255,255,0.12);
  --border-focus: rgba(255,255,255,0.30);
  --text-1:       #f0f0f0;
  --text-2:       #888;
  --text-3:       #4a4a4a;
  --check-mark:   url("data:image/svg+xml,%3Csvg width='10' height='8' viewBox='0 0 10 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 4L3.5 6.5L9 1' stroke='%230e0e0e' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --color-se:     #534AB7;
  --color-ai:     #0F6E56;
  --color-biz:    #993C1D;
  --link-hover:   #8b9cf7;
  --radius:       8px;
  --radius-sm:    5px;
  --mono:         'SF Mono', 'Fira Code', 'Consolas', ui-monospace, monospace;
  --sans:         -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --theme-icon:   "☀";
}

/* ── Design tokens — light ────────────────────────────────────────────── */
[data-theme="light"] {
  --bg:           #f5f5f5;
  --bg-2:         #ffffff;
  --bg-3:         #ebebeb;
  --bg-hover:     #e4e4e7;
  --border:       rgba(0,0,0,0.08);
  --border-med:   rgba(0,0,0,0.14);
  --border-focus: rgba(0,0,0,0.35);
  --text-1:       #111111;
  --text-2:       #6b7280;
  --text-3:       #b0b7c3;
  --check-mark:   url("data:image/svg+xml,%3Csvg width='10' height='8' viewBox='0 0 10 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 4L3.5 6.5L9 1' stroke='%23ffffff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --link-hover:   #4338ca;
  --theme-icon:   "☽";
}

/* ── Reset ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--text-2); text-decoration: none; }
a:hover { color: var(--text-1); }
button { cursor: pointer; font-family: inherit; font-size: 13px; }
input, textarea, select {
  font-family: inherit;
  font-size: 13px;
  background: var(--bg-3);
  color: var(--text-1);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-sm);
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--border-focus); }

/* ── Typography helpers ───────────────────────────────────────────────── */
.mono { font-family: var(--mono); letter-spacing: -0.02em; }

/* ── Nav ──────────────────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-1);
}
.nav-logo-icon { font-size: 18px; color: var(--color-se); }
.nav-right { display: flex; align-items: center; gap: 16px; }
.nav-link { font-size: 13px; color: var(--text-2); }
.nav-link:hover { color: var(--text-1); }
.nav-user {
  font-size: 12px;
  color: var(--text-3);
  font-family: var(--mono);
}

/* ── Theme toggle ─────────────────────────────────────────────────────── */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-med);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 14px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .12s, border-color .12s, background .12s;
  flex-shrink: 0;
}
.theme-toggle:hover {
  color: var(--text-1);
  border-color: var(--border-focus);
  background: var(--bg-hover);
}
/* Fixed toggle for auth pages (no nav) */
.theme-toggle-fixed {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 99;
}

/* ── Main layout ──────────────────────────────────────────────────────── */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  background: var(--text-1);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13px;
  transition: opacity .12s;
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary.btn-full { width: 100%; justify-content: center; }

.btn-ghost {
  padding: 6px 12px;
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-sm);
  transition: color .12s, border-color .12s;
}
.btn-ghost:hover { color: var(--text-1); border-color: var(--border-focus); }

.btn-danger-sm {
  padding: 4px 10px;
  background: transparent;
  color: #c0392b;
  border: 1px solid rgba(192,57,43,0.35);
  border-radius: var(--radius-sm);
  font-size: 12px;
  transition: background .12s;
}
.btn-danger-sm:hover { background: rgba(192,57,43,0.1); }

.btn-ghost-sm {
  padding: 4px 10px;
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.btn-ghost-sm:hover { color: var(--text-1); }

/* ── Auth pages ───────────────────────────────────────────────────────── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}
.auth-header { text-align: center; margin-bottom: 28px; }
.auth-logo { font-size: 28px; color: var(--color-se); }
.auth-title { font-size: 20px; font-weight: 600; margin-top: 8px; }
.auth-subtitle { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-footer { text-align: center; font-size: 12px; color: var(--text-2); margin-top: 20px; }
.auth-footer a { color: var(--text-1); text-decoration: underline; text-underline-offset: 2px; }

/* ── Forms ────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.form-input { padding: 8px 10px; width: 100%; }
.form-error {
  font-size: 12px;
  color: #e05252;
  padding: 8px 10px;
  background: rgba(224,82,82,0.08);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(224,82,82,0.2);
}

/* ── Dashboard ────────────────────────────────────────────────────────── */
.dashboard { display: flex; flex-direction: column; gap: 20px; }

/* Overall progress bar */
.overall-progress {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.section-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-2);
}
.progress-pct { font-size: 22px; font-weight: 600; color: var(--text-1); }

.progress-track {
  height: 5px;
  background: var(--bg-3);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 12px;
}
.progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .4s ease;
}
.progress-fill--gradient {
  background: linear-gradient(to right, var(--color-se), var(--color-ai), var(--color-biz));
}

.track-pct-row { display: flex; gap: 20px; flex-wrap: wrap; }
.track-mini-stat { display: flex; align-items: center; gap: 5px; }
.track-dot-sm {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.track-mini-label { font-size: 11px; color: var(--text-2); }
.track-mini-pct { font-size: 11px; color: var(--text-1); }

/* Month tabs */
.month-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  background: var(--bg-2);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: all .12s;
}
.tab-btn:hover { color: var(--text-1); border-color: var(--border-med); }
.tab-btn.active {
  background: var(--bg-3);
  color: var(--text-1);
  border-color: var(--border-med);
}
.tab-pct { font-size: 11px; color: var(--text-3); }
.tab-btn.active .tab-pct { color: var(--text-2); }

/* Tab panels */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Track grid */
.tracks-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 860px) { .tracks-grid { grid-template-columns: 1fr; } }
@media (min-width: 861px) and (max-width: 1050px) { .tracks-grid { grid-template-columns: repeat(2, 1fr); } }

/* Track column */
.track-col {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.track-col-header {
  display: flex;
  align-items: center;
  gap: 7px;
}
.track-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.track-col-name { font-size: 13px; font-weight: 500; flex: 1; }
.track-col-pct { font-size: 12px; color: var(--text-2); }
.track-col-bar {
  height: 2px;
  background: var(--bg-3);
  border-radius: 99px;
  overflow: hidden;
  margin-top: -6px;
}
.track-col-fill { height: 100%; border-radius: 99px; transition: width .4s ease; }

/* Item groups */
.item-group { display: flex; flex-direction: column; gap: 2px; }
.group-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  margin-bottom: 4px;
  padding-left: 2px;
}

/* Item rows */
.item-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 4px;
  border-radius: var(--radius-sm);
  transition: background .1s;
}
.item-row:hover { background: var(--bg-hover); }

/* Custom checkbox */
.item-check-label {
  position: relative;
  flex-shrink: 0;
  margin-top: 1px;
  cursor: pointer;
}
.item-check { position: absolute; opacity: 0; width: 0; height: 0; }
.check-box {
  display: block;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--border-med);
  border-radius: 3px;
  background: transparent;
  transition: all .12s;
}
.item-check:checked + .check-box {
  background: var(--text-1);
  border-color: var(--text-1);
  background-image: var(--check-mark);
  background-repeat: no-repeat;
  background-position: center;
}

.item-content { flex: 1; min-width: 0; }

.item-title-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.item-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  line-height: 1.4;
  flex: 1;
}
a.item-label {
  text-decoration: none;
  transition: color .1s;
}
a.item-label:hover { color: var(--link-hover); text-decoration: underline; text-underline-offset: 2px; }
.item-label--nolink { display: block; }

.is-done .item-label {
  color: var(--text-3);
  text-decoration: line-through;
  text-decoration-color: var(--text-3);
}
.is-done a.item-label:hover { color: var(--text-3); text-decoration: line-through; }

.item-desc {
  font-size: 11.5px;
  color: var(--text-2);
  line-height: 1.45;
  margin-top: 2px;
}
.is-done .item-desc { opacity: 0.45; }

.notes-toggle {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 11px;
  padding: 0 2px;
  line-height: 1;
  opacity: 0;
  transition: opacity .1s, color .1s;
}
.item-row:hover .notes-toggle { opacity: 1; }
.notes-toggle:hover { color: var(--text-2); }

/* Notes */
.notes-wrap { margin-top: 5px; }
.notes-input {
  width: 100%;
  min-height: 60px;
  padding: 7px 9px;
  resize: vertical;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
  border-radius: var(--radius-sm);
}
.notes-input:focus { color: var(--text-1); }

/* ── Admin page ───────────────────────────────────────────────────────── */
.admin-page { max-width: 800px; }
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.admin-title { font-size: 18px; font-weight: 600; }

.table-wrap {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.user-table { width: 100%; border-collapse: collapse; }
.user-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
}
.user-table td {
  padding: 10px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.user-table tr:last-child td { border-bottom: none; }
.user-table tr:hover td { background: var(--bg-hover); }
.row-inactive td { opacity: 0.4; }
.td-username { font-weight: 500; }
.td-email { color: var(--text-2); font-size: 12px; }
.td-date { color: var(--text-3); font-size: 12px; font-family: var(--mono); }
.td-you { font-size: 11px; color: var(--text-3); }
.td-actions { white-space: nowrap; }

.role-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 2px 7px;
  border-radius: 99px;
}
.role-admin {
  background: rgba(83,74,183,0.18);
  color: #a09be0;
  border: 1px solid rgba(83,74,183,0.3);
}
.role-student {
  background: var(--bg-3);
  color: var(--text-2);
  border: 1px solid var(--border);
}

.status-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 99px;
}
.status-active { background: rgba(15,110,86,0.15); color: #3ecfa0; border: 1px solid rgba(15,110,86,0.3); }
.status-inactive { background: var(--bg-3); color: var(--text-3); border: 1px solid var(--border); }

/* ── Modal ────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: var(--bg-2);
  border: 1px solid var(--border-med);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 380px;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.modal-title { font-weight: 600; font-size: 15px; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 16px;
  padding: 4px 8px;
}
.modal-close:hover { color: var(--text-1); }
