:root {
  --bg: #f8f6f3;
  --text: #1a1a2e;
  --text-light: #64748b;
  --text-muted: #94a3b8;
  --border: #e5e2de;
  --card: #ffffff;
  --radius: 10px;
}

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

body {
  font-family: 'DM Sans', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ========== Center screen (loading/login) ========== */
.center-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; color: var(--text);
}

/* ========== Login ========== */
.login-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem;
  width: 100%; max-width: 380px;
}
.login-card h1 { text-align: center; font-family: 'Space Mono', monospace; font-size: 1.25rem; letter-spacing: -0.5px; }
.login-card .subtitle { text-align: center; color: var(--text-light); font-size: 0.85rem; margin: 0.25rem 0 1.5rem; }
.error-box { background: #fee2e2; color: #991b1b; padding: 0.5rem 0.75rem; border-radius: 6px; font-size: 0.85rem; margin-bottom: 1rem; }
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 0.8rem; font-weight: 500; margin-bottom: 0.25rem; }
.field input { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.875rem; font-family: inherit; }
.field input:focus { outline: none; border-color: #1a1a2e; box-shadow: 0 0 0 3px rgba(26,26,46,0.1); }
.btn-full { width: 100%; padding: 0.625rem; background: #1a1a2e; color: #fff; border: none; border-radius: 8px; font-weight: 600; font-size: 0.875rem; cursor: pointer; font-family: inherit; }
.btn-full:hover { background: #16213e; }
.btn-full:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-full.dark { background: #1a1a2e; color: #fff; }

/* ========== Header ========== */
.header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: #fff; padding: 24px 20px 18px;
}
.header-top { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; }
.header-title { font-family: 'Space Mono', monospace; font-size: 20px; letter-spacing: -0.5px; }
.header-sub { margin-top: 4px; opacity: 0.7; font-size: 12px; }
.header-right { text-align: right; }
.days-left { }
.days-num { font-family: 'Space Mono', monospace; font-size: 28px; font-weight: 700; color: #22c55e; display: block; }
.days-left.urgent .days-num { color: #ef4444; }
.days-label { font-size: 11px; opacity: 0.6; text-transform: uppercase; letter-spacing: 1px; }
.header-user { margin-top: 12px; display: flex; justify-content: space-between; align-items: center; font-size: 13px; opacity: 0.8; gap: 12px; }
.logout-btn { background: rgba(255,255,255,0.15); border: none; color: #fff; padding: 4px 12px; border-radius: 6px; font-size: 12px; cursor: pointer; font-family: inherit; }
.logout-btn:hover { background: rgba(255,255,255,0.25); }
.drive-dropdown { position: relative; }
.drive-btn { background: rgba(255,255,255,0.15); border: none; color: #fff; padding: 4px 14px; border-radius: 6px; font-size: 12px; cursor: pointer; font-family: inherit; white-space: nowrap; }
.drive-btn:hover { background: rgba(255,255,255,0.25); }
.drive-menu { position: absolute; top: 100%; right: 0; margin-top: 6px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,0.12); min-width: 180px; z-index: 100; overflow: hidden; }
.drive-link { display: block; padding: 8px 16px; color: var(--text); text-decoration: none; font-size: 13px; transition: background 0.15s; text-transform: capitalize; }
.drive-link:hover { background: var(--bg); }
.drive-link.root { font-weight: 600; border-bottom: 1px solid var(--border); }

/* ========== Progress ========== */
.progress-section { margin-top: 16px; }
.progress-label { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 6px; opacity: 0.8; }
.progress-pct { font-weight: 600; }
.progress-bar { background: rgba(255,255,255,0.15); border-radius: 8px; height: 10px; overflow: hidden; }
.progress-fill { background: linear-gradient(90deg, #22c55e, #6C3FA0); height: 100%; border-radius: 8px; transition: width 0.5s; }

/* ========== Subject pills in header ========== */
.subject-pills { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.pill { background: rgba(255,255,255,0.1); border-radius: 6px; padding: 4px 10px; font-size: 12px; }
.pill-name { font-weight: 600; }
.pill-pct { opacity: 0.6; margin-left: 6px; }

/* ========== Tabs ========== */
.tabs {
  display: flex; border-bottom: 2px solid var(--border);
  background: var(--card); overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; padding: 12px 14px; font-size: 13px;
  font-weight: 500; color: var(--text-muted);
  background: none; border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer; margin-bottom: -2px; white-space: nowrap;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text-light); }
.tab.active { font-weight: 700; color: var(--text); border-bottom-color: var(--text); }

/* ========== Content ========== */
.content { padding: 20px 16px; max-width: 1100px; margin: 0 auto; }

/* ========== Card ========== */
.card { background: var(--card); border-radius: var(--radius); padding: 16px 18px; border: 1px solid var(--border); margin-bottom: 10px; }

/* ========== Motivational Quote ========== */
.quote-banner {
  background: linear-gradient(135deg, #1a1a2e, #0f3460);
  color: #fff;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.quote-icon {
  font-size: 18px;
  color: #f59e0b;
  flex-shrink: 0;
  line-height: 1.5;
}

/* ========== Today view ========== */
.phase-banner { color: #fff; border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.phase-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; opacity: 0.8; }
.phase-date { font-size: 18px; font-weight: 700; margin-top: 4px; }
.time-slot { background: var(--card); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 10px; border: 1px solid var(--border); }
.time-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.time-task { font-size: 15px; font-weight: 600; margin-top: 4px; }
.tips-section { margin-top: 20px; }
.tips-title { font-size: 14px; font-weight: 700; margin-bottom: 10px; color: var(--text-light); }
.tip-card { background: var(--card); border-radius: 8px; padding: 12px 14px; margin-bottom: 6px; font-size: 13px; line-height: 1.5; border: 1px solid var(--border); }
.empty-state { text-align: center; padding: 40px; color: var(--text-muted); font-size: 14px; }

/* Today resources */
.today-resources { margin-top: 24px; }
.today-resources-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.today-resource-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.today-resource-card:hover {
  border-color: #6C3FA0;
  box-shadow: 0 2px 8px rgba(108,63,160,0.08);
}
.today-resource-title { font-size: 14px; font-weight: 600; }
.today-resource-desc { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.today-resource-meta { display: flex; gap: 6px; margin-top: 8px; }

/* ========== Subjects view ========== */
.subject-tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.subject-tab {
  padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 600;
  border: 2px solid var(--border); background: var(--card); color: var(--text-light);
  cursor: pointer; font-family: inherit;
  transition: all 0.15s;
}
.tab-pct { margin-left: 6px; font-size: 11px; opacity: 0.7; }
.subject-header { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.subject-header h2 { font-size: 18px; font-weight: 700; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.level-badge { font-size: 12px; color: var(--text-muted); background: #f1f0ee; padding: 2px 8px; border-radius: 4px; }
.paper-section { margin-bottom: 20px; }
.paper-title { font-size: 14px; font-weight: 600; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid; }
.topic-card { background: var(--card); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; border: 1px solid var(--border); }
.topic-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.topic-header h4 { font-size: 14px; font-weight: 600; }
.confidence-btns { display: flex; gap: 3px; }
.conf-btn {
  width: 22px; height: 22px; border-radius: 4px;
  border: 1px solid #ddd; cursor: pointer;
  font-size: 9px; font-weight: 700;
  background: var(--card); font-family: inherit;
  transition: all 0.1s;
}
.conf-label { font-size: 10px; font-weight: 600; margin-top: 4px; margin-bottom: 8px; }
.subtopic { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; font-size: 13px; cursor: pointer; color: var(--text); }
.subtopic.done { color: var(--text-muted); }
.subtopic.done span { text-decoration: line-through; }
.subtopic input { margin-top: 2px; }

/* ========== Badges ========== */
.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-type {
  background: #ede9fe;
  color: #6C3FA0;
}
.badge-source {
  background: #f1f0ee;
  color: var(--text-light);
}

/* ========== Search bar ========== */
.search-bar-wrap { margin-bottom: 12px; }
.search-bar {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--card);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-bar:focus {
  outline: none;
  border-color: #6C3FA0;
  box-shadow: 0 0 0 3px rgba(108,63,160,0.1);
}
.search-bar::placeholder { color: var(--text-muted); }

/* ========== Filter pills ========== */
.filter-row {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.filter-pill {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--text-light);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  white-space: nowrap;
}
.filter-pill:hover { border-color: var(--text-muted); }
.filter-pill.active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}
.filter-pill.small { padding: 4px 10px; font-size: 11px; }

/* ========== Bookmark toggle ========== */
.bookmark-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-light);
  cursor: pointer;
}
.bookmark-toggle input { accent-color: #ef4444; }

/* ========== Resources grid ========== */
.resources-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.resource-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.resource-card:hover {
  border-color: #ccc;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.resource-card-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}
.resource-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.resource-title {
  font-size: 14px;
  font-weight: 600;
  flex: 1;
  line-height: 1.3;
}
.bookmark-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  flex-shrink: 0;
  transition: transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bookmark-btn:hover { transform: scale(1.15); }
.bookmark-btn.bookmarked svg { filter: drop-shadow(0 0 4px rgba(239,68,68,0.3)); }
.resource-desc {
  font-size: 12px;
  color: var(--text-light);
  line-height: 1.4;
  margin-bottom: 10px;
  flex: 1;
}
.resource-meta {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.resource-link {
  font-size: 12px;
  font-weight: 600;
  color: #6C3FA0;
  text-decoration: none;
  display: inline-block;
  transition: color 0.15s;
}
.resource-link:hover { color: #8b5cf6; }

/* ========== Flashcards ========== */
.flashcard-progress {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}
.flashcard-score strong { color: var(--text); }

.flashcard-container {
  perspective: 1000px;
  margin-bottom: 20px;
}
.flashcard {
  width: 100%;
  min-height: 250px;
  cursor: pointer;
  position: relative;
}
.flashcard-inner {
  width: 100%;
  min-height: 250px;
  transition: transform 0.5s;
  transform-style: preserve-3d;
  position: relative;
}
.flashcard.flipped .flashcard-inner {
  transform: rotateY(180deg);
}
.flashcard-front, .flashcard-back {
  position: absolute;
  top: 0; left: 0; right: 0;
  min-height: 250px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}
.flashcard-back {
  transform: rotateY(180deg);
  background: #fafaf7;
}
.flashcard-subject-tag {
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  padding: 3px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}
.flashcard-text {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.6;
  color: var(--text);
}
.flashcard-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 16px;
  align-self: center;
}

.flashcard-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 12px;
}
.fc-btn {
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.fc-btn.struggling { background: #fee2e2; color: #991b1b; }
.fc-btn.struggling:hover { background: #fecaca; }
.fc-btn.know { background: #dcfce7; color: #166534; }
.fc-btn.know:hover { background: #bbf7d0; }
.fc-btn.next { background: var(--text); color: #fff; }
.fc-btn.next:hover { background: #16213e; }

.flashcard-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 8px;
}

/* ========== Small buttons ========== */
.btn-small {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-light);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-small:hover { border-color: var(--text-muted); color: var(--text); }
.btn-small.danger { color: #991b1b; border-color: #fca5a5; }
.btn-small.danger:hover { background: #fee2e2; }
.btn-small.reviewed-btn { background: #dcfce7; color: #166534; border-color: #86efac; }

/* ========== Timer ========== */
.timer-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  justify-content: center;
}
.timer-preset-btn {
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.timer-preset-btn:hover:not(:disabled) { border-color: var(--text); }
.timer-preset-btn.active { background: var(--text); color: #fff; border-color: var(--text); }
.timer-preset-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.timer-custom {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-light);
}
.timer-custom-input {
  width: 70px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  text-align: center;
}

.timer-options {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.timer-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: var(--card);
  color: var(--text);
}

.timer-display {
  text-align: center;
  margin-bottom: 24px;
}
.timer-countdown {
  font-family: 'Space Mono', monospace;
  font-size: 72px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 2px;
  line-height: 1;
  transition: color 0.3s;
}
.timer-countdown.running { color: #22c55e; }
.timer-total-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.timer-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
}
.timer-btn {
  padding: 12px 32px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.timer-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.timer-btn.start { background: #22c55e; color: #fff; }
.timer-btn.start:hover:not(:disabled) { background: #16a34a; }
.timer-btn.pause { background: #f59e0b; color: #fff; }
.timer-btn.pause:hover { background: #d97706; }
.timer-btn.resume { background: #22c55e; color: #fff; }
.timer-btn.resume:hover { background: #16a34a; }
.timer-btn.reset { background: #ef4444; color: #fff; }
.timer-btn.reset:hover { background: #dc2626; }

.timer-done {
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #22c55e;
  padding: 16px;
  background: #dcfce7;
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.timer-history { margin-top: 24px; }
.timer-history h3 { font-size: 14px; font-weight: 700; margin-bottom: 10px; color: var(--text-light); }
.timer-session-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 4px;
  font-size: 13px;
}
.timer-session-subject { font-weight: 600; }
.timer-session-type { color: var(--text-light); margin-left: 8px; }
.timer-session-meta { text-align: right; }
.timer-session-date { color: var(--text-muted); margin-left: 8px; }

/* ========== Mistakes ========== */
.mistakes-stats {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.stat-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  text-align: center;
  min-width: 70px;
}
.stat-num {
  font-family: 'Space Mono', monospace;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.mistake-form h3 { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.mistake-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mistake-fields select,
.mistake-fields input,
.mistake-fields textarea {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: var(--card);
  color: var(--text);
  resize: vertical;
}
.mistake-fields select:focus,
.mistake-fields input:focus,
.mistake-fields textarea:focus {
  outline: none;
  border-color: #6C3FA0;
  box-shadow: 0 0 0 3px rgba(108,63,160,0.1);
}

.mistakes-list { margin-top: 16px; }
.mistake-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: opacity 0.15s;
}
.mistake-card.reviewed { opacity: 0.6; }
.mistake-card.reviewed .mistake-body { text-decoration: line-through; color: var(--text-muted); }
.mistake-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 4px;
}
.mistake-subject { font-weight: 700; font-size: 13px; }
.mistake-topic { font-size: 12px; color: var(--text-light); margin-left: 8px; }
.mistake-date { font-size: 11px; color: var(--text-muted); }
.mistake-body { font-size: 13px; line-height: 1.6; }
.mistake-body div { margin-bottom: 4px; }
.mistake-body strong { color: var(--text-light); font-weight: 600; }
.mistake-wrong { color: #991b1b; }
.mistake-correct { color: #166534; }
.mistake-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* ========== Notes ========== */
.notes-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  min-height: 400px;
}
.notes-sidebar {
  max-height: 600px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.notes-paper-group { margin-bottom: 12px; }
.notes-paper-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 8px;
  margin-bottom: 2px;
}
.notes-topic-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-left: 3px solid transparent;
  background: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-light);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all 0.1s;
  border-radius: 0 6px 6px 0;
}
.notes-topic-btn:hover { background: rgba(0,0,0,0.03); color: var(--text); }
.notes-topic-btn.active { font-weight: 700; color: var(--text); }
.notes-indicator { font-size: 6px; color: #22c55e; margin-left: 4px; }

.notes-editor {
  display: flex;
  flex-direction: column;
}
.notes-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.notes-editor-header h3 { font-size: 16px; font-weight: 700; }
.notes-saved-indicator {
  font-size: 12px;
  color: #22c55e;
  font-weight: 600;
  background: #dcfce7;
  padding: 2px 10px;
  border-radius: 4px;
}
.notes-saving-indicator {
  font-size: 12px;
  color: #f59e0b;
  font-weight: 600;
  background: #fef9c3;
  padding: 2px 10px;
  border-radius: 4px;
}
.notes-textarea {
  width: 100%;
  min-height: 400px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  line-height: 1.7;
  color: var(--text);
  background: var(--card);
  resize: vertical;
  transition: border-color 0.15s;
}
.notes-textarea:focus {
  outline: none;
  border-color: #6C3FA0;
  box-shadow: 0 0 0 3px rgba(108,63,160,0.1);
}
.notes-textarea::placeholder { color: var(--text-muted); }
.notes-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ========== Calendar view ========== */
.section-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.section-sub { font-size: 13px; color: var(--text-light); margin-bottom: 18px; margin-top: -10px; }
.phase-group { margin-bottom: 20px; }
.phase-group-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.cal-day {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; margin-bottom: 4px;
  display: grid; grid-template-columns: 110px 1fr; gap: 8px;
  font-size: 13px;
}
.cal-past { opacity: 0.5; }
.cal-date { font-weight: 600; }
.cal-info { color: var(--text-light); }
.cal-focus { font-weight: 500; }
.cal-detail { }

/* ========== Strategy view ========== */
.strategy-group { margin-bottom: 20px; }
.strategy-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.strategy-header h3 { font-size: 15px; font-weight: 700; }
.strategy-tip {
  background: var(--card); border-radius: 8px; padding: 12px 14px;
  margin-bottom: 6px; font-size: 13px; line-height: 1.6;
  border: 1px solid var(--border); border-left-width: 3px;
}
.general-tips {
  background: #1a1a2e; color: #fff; border-radius: var(--radius);
  padding: 18px 20px; margin-top: 10px;
}
.general-tips h3 { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.general-tip { font-size: 13px; line-height: 1.6; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.1); }
.general-tip:last-child { border-bottom: none; }

/* ========== Scores view ========== */
.score-form h3 { font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.score-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.score-grid select, .score-grid input {
  padding: 8px 10px; border-radius: 6px; border: 1px solid #ddd;
  font-size: 13px; font-family: inherit;
}
.mt { margin-top: 10px; }
.score-subject { margin-bottom: 16px; }
.score-subject h3 { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.score-row {
  background: var(--card); border-radius: 8px; padding: 10px 14px;
  margin-bottom: 4px; border: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; font-size: 13px;
}
.score-paper { font-weight: 600; }
.score-date { color: var(--text-muted); margin-left: 8px; }
.score-value { font-weight: 700; }
.score-value.green { color: #22c55e; }
.score-value.amber { color: #f59e0b; }
.score-value.red { color: #ef4444; }

/* ========== Papers view ========== */
.papers-nav { display: flex; gap: 4px; margin-bottom: 16px; background: var(--bg); border-radius: 8px; padding: 3px; }
.papers-nav-btn {
  flex: 1; padding: 8px 12px; border: none; border-radius: 6px;
  font-size: 12px; font-weight: 600; color: var(--text-light);
  background: transparent; cursor: pointer; font-family: inherit;
  transition: all 0.15s;
}
.papers-nav-btn.active { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.papers-nav-btn:hover:not(.active) { color: var(--text); }

.papers-stats-bar {
  display: flex; align-items: center; gap: 16px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px;
}
.papers-stat { text-align: center; }
.papers-stat-num { font-family: 'Space Mono', monospace; font-size: 20px; font-weight: 700; display: block; }
.papers-stat-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.papers-progress-mini { flex: 1; }
.papers-pct { font-size: 11px; color: var(--text-light); margin-top: 4px; display: block; }

.papers-sources { margin-bottom: 16px; }
.papers-sources-title { font-size: 13px; font-weight: 700; margin-bottom: 10px; color: var(--text); }
.papers-sources-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.papers-source-link {
  display: block; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: 8px; text-decoration: none; color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.papers-source-link:hover { border-color: #6C3FA0; box-shadow: 0 2px 8px rgba(108,63,160,0.08); }
.papers-source-name { font-size: 13px; font-weight: 600; display: block; color: #6C3FA0; }
.papers-source-desc { font-size: 11px; color: var(--text-light); display: block; margin-top: 2px; }

.papers-practice-order { margin-bottom: 16px; }
.papers-order-step {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 6px 0; font-size: 13px; line-height: 1.5; color: var(--text);
}
.papers-order-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--text); color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.papers-paper-section { margin-bottom: 24px; }
.papers-paper-header {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 8px;
  border-left: 4px solid var(--text);
}
.papers-paper-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.papers-paper-meta { display: flex; gap: 6px; margin-bottom: 8px; }
.papers-paper-sections { margin-bottom: 8px; }
.papers-section-item { font-size: 12px; color: var(--text-light); padding: 1px 0; }
.papers-paper-tip {
  font-size: 12px; color: var(--text); background: #fffbeb;
  border: 1px solid #fef3c7; border-radius: 6px; padding: 8px 12px;
  margin-top: 8px; line-height: 1.5;
}

.papers-year-list { }
.papers-year-row {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px; margin-bottom: 4px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  transition: opacity 0.15s, background 0.15s;
}
.papers-year-row.done { background: #f0fdf4; border-color: #bbf7d0; }
.papers-check-label {
  display: flex; align-items: center; gap: 10px; cursor: pointer; flex: 1; min-width: 200px;
}
.papers-year-info { display: flex; flex-direction: column; }
.papers-year-name { font-size: 13px; font-weight: 600; }
.papers-year-note { font-size: 11px; color: var(--text-muted); }
.papers-year-actions { display: flex; align-items: center; gap: 8px; }
.papers-score-inline {
  width: 100%; display: flex; align-items: center; gap: 6px;
  padding-top: 8px; margin-top: 4px; border-top: 1px solid var(--border);
}
.papers-score-input {
  width: 60px; padding: 5px 8px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 13px; font-family: inherit; text-align: center;
}
.papers-score-slash { color: var(--text-muted); font-weight: 600; }

.papers-boundaries { margin-top: 20px; }
.papers-boundary-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.papers-boundary-item {
  text-align: center; background: var(--bg); border-radius: 6px;
  padding: 8px 14px; min-width: 60px;
}
.papers-boundary-grade { display: block; font-size: 16px; font-weight: 700; color: var(--text); }
.papers-boundary-marks { display: block; font-size: 11px; color: var(--text-light); }
.papers-boundary-note { font-size: 11px; color: var(--text-muted); font-style: italic; }

/* ========== Stats grid ========== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.stats-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; text-align: center; }
.stats-num { font-family: 'Space Mono', monospace; font-size: 20px; font-weight: 700; color: var(--text); }
.stats-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }

/* ========== Welcome card ========== */
.welcome-card { background: linear-gradient(135deg, #1a1a2e, #0f3460); color: #fff; border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.welcome-card h3 { font-size: 18px; margin-bottom: 6px; }
.welcome-card p { font-size: 13px; opacity: 0.8; }

/* ========== Plans ========== */
.plan-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.plan-title { font-size: 15px; font-weight: 700; }
.plan-items { }
.plan-item { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; font-size: 13px; cursor: pointer; color: var(--text); border-bottom: 1px solid var(--border); }
.plan-item:last-child { border-bottom: none; }
.plan-item.done span { text-decoration: line-through; color: var(--text-muted); }
.plan-item input { margin-top: 2px; accent-color: #22c55e; }

/* ========== Messages ========== */
.messages-list { }
.message-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 8px; position: relative; cursor: default; }
.message-card.message-sent { border-left: 3px solid #6C3FA0; }
.message-card.message-unread { border-left: 3px solid #22c55e; background: #f0fdf4; cursor: pointer; }
.message-header { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-light); margin-bottom: 6px; flex-wrap: wrap; }
.message-from { font-weight: 700; color: var(--text); }
.message-arrow { color: var(--text-muted); }
.message-to { font-weight: 600; }
.message-time { margin-left: auto; font-size: 11px; color: var(--text-muted); }
.message-body { font-size: 14px; line-height: 1.5; }
.message-unread-badge { position: absolute; top: 8px; right: 12px; background: #22c55e; color: #fff; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px; }

/* ========== Tab badge ========== */
.tab-badge { display: inline-block; background: #ef4444; color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 8px; margin-left: 4px; min-width: 16px; text-align: center; }

/* ========== Admin ========== */
.admin-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.admin-user-card { text-align: center; }
.admin-user-card h4 { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.admin-email { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.admin-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 8px; }
.admin-stat { }
.admin-stat-num { display: block; font-family: 'Space Mono', monospace; font-size: 16px; font-weight: 700; }
.admin-stat-label { display: block; font-size: 9px; color: var(--text-muted); text-transform: uppercase; }
.admin-born { font-size: 11px; color: var(--text-muted); }
.drive-btn.active { background: rgba(255,255,255,0.3); }

/* ========== Exams ========== */
.exam-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.exam-title { font-size: 15px; font-weight: 700; }
.exam-input {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px; font-family: inherit; background: var(--card); color: var(--text);
  width: 100%; resize: vertical;
}
.exam-input:focus { outline: none; border-color: #6C3FA0; box-shadow: 0 0 0 3px rgba(108,63,160,0.1); }
.exam-question-edit { border-left: 3px solid #6C3FA0; }
.exam-take-header {
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(135deg, #1a1a2e, #0f3460); color: #fff;
  border-radius: var(--radius); padding: 16px 20px; margin-bottom: 16px;
}
.exam-take-header h3 { font-size: 16px; }
.exam-timer-display { text-align: right; }
.exam-timer-value { font-family: 'Space Mono', monospace; font-size: 28px; font-weight: 700; }
.exam-timer-value.urgent { color: #ef4444; }
.exam-option {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
  font-size: 14px; transition: all 0.15s;
}
.exam-option:hover { border-color: #6C3FA0; background: rgba(108,63,160,0.03); }
.exam-option.selected { border-color: #6C3FA0; background: rgba(108,63,160,0.08); font-weight: 600; }
.exam-option input { accent-color: #6C3FA0; }
.exam-results-header { text-align: center; }
.exam-results-score { margin-top: 8px; }
.exam-results-num { font-family: 'Space Mono', monospace; font-size: 32px; font-weight: 700; }
.exam-results-pct { font-size: 20px; font-weight: 700; margin-left: 12px; }
.exam-results-pct.green { color: #22c55e; }
.exam-results-pct.amber { color: #f59e0b; }
.exam-results-pct.red { color: #ef4444; }
.exam-result-card.correct { border-left: 3px solid #22c55e; }
.exam-result-card.incorrect { border-left: 3px solid #ef4444; }
.exam-result-card.pending { border-left: 3px solid #f59e0b; }
.badge-correct { background: #dcfce7; color: #166534; }
.badge-incorrect { background: #fee2e2; color: #991b1b; }

/* ========== University / Clearing ========== */
.uni-nav {
  display: flex; gap: 4px; margin-bottom: 16px; background: var(--bg);
  border-radius: 8px; padding: 3px; overflow-x: auto;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.uni-nav::-webkit-scrollbar { display: none; }
.uni-nav-btn {
  flex: none; padding: 8px 12px; border: none; border-radius: 6px;
  font-size: 12px; font-weight: 600; color: var(--text-light);
  background: transparent; cursor: pointer; font-family: inherit;
  transition: all 0.15s; white-space: nowrap;
}
.uni-nav-btn.active { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.uni-nav-btn:hover:not(.active) { color: var(--text); }

.uni-countdown {
  background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 100%);
  color: #fff; border-radius: var(--radius); padding: 24px; text-align: center;
}
.uni-countdown-num {
  font-family: 'Space Mono', monospace; font-size: 56px; font-weight: 700;
  color: #22c55e; line-height: 1;
}
.uni-countdown-label {
  font-size: 16px; font-weight: 600; margin-top: 6px; opacity: 0.9;
}
.uni-countdown-date {
  font-size: 12px; opacity: 0.6; margin-top: 4px;
}

.uni-tier-section {
  margin-bottom: 20px; border-left: 4px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.uni-tier-header {
  padding: 12px 16px; border: 1px solid var(--border);
  border-left: none; border-radius: 0 var(--radius) 0 0;
}
.uni-tier-header h4 { font-size: 14px; font-weight: 700; }

.uni-shortlist-card {
  background: var(--card); border: 1px solid var(--border);
  border-left: none; padding: 14px 16px; margin-bottom: 1px;
  transition: background 0.15s;
}
.uni-shortlist-card:hover { background: #fafaf9; }

.uni-phone {
  font-family: 'Space Mono', monospace; font-size: 16px; font-weight: 700;
  color: #3b82f6; margin-top: 6px; letter-spacing: 0.5px;
}

.uni-scenario-card {
  background: var(--card); border: 1px solid var(--border);
  border-top: 4px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 12px;
}
.uni-scenario-card h4 { font-size: 15px; font-weight: 700; }

.uni-script-box {
  min-height: 200px; font-size: 14px; line-height: 1.7;
}

.uni-tip-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px; margin-bottom: 6px;
}

.uni-faq-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; padding: 14px 16px; margin-bottom: 8px;
}

.uni-finance-group {
  font-size: 12px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px;
  padding: 4px 0; margin-bottom: 6px; border-bottom: 1px solid var(--border);
}

.uni-accom-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px;
}

.uni-status-badge {
  display: inline-block; font-size: 10px; font-weight: 600;
  padding: 2px 8px; border-radius: 4px; text-transform: capitalize;
  margin-left: 8px; vertical-align: middle;
}
.uni-status-not_started { background: #f1f0ee; color: var(--text-muted); }
.uni-status-applied { background: #dbeafe; color: #1d4ed8; }
.uni-status-offered { background: #fef3c7; color: #92400e; }
.uni-status-accepted { background: #dcfce7; color: #166534; }
.uni-status-rejected { background: #fee2e2; color: #991b1b; }

.uni-prep-tabs {
  display: flex; gap: 4px; margin-bottom: 16px; background: var(--bg);
  border-radius: 8px; padding: 3px; flex-wrap: wrap;
}
.uni-prep-tab {
  flex: 1; min-width: 70px; padding: 8px 12px; border: none; border-radius: 6px;
  font-size: 12px; font-weight: 600; color: var(--text-light);
  background: transparent; cursor: pointer; font-family: inherit;
  transition: all 0.15s; text-align: center;
}
.uni-prep-tab.active { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.uni-prep-tab:hover:not(.active) { color: var(--text); }

.uni-resource-card {
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  text-decoration: none; color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.uni-resource-card:hover {
  border-color: #6C3FA0; box-shadow: 0 2px 12px rgba(108,63,160,0.08);
}

.uni-progress-bar {
  background: var(--border); border-radius: 8px; height: 8px; overflow: hidden;
}
.uni-progress-fill {
  background: linear-gradient(90deg, #22c55e, #3b82f6);
  height: 100%; border-radius: 8px; transition: width 0.5s;
}

/* ========== Responsive ========== */
@media (min-width: 700px) {
  .resources-grid { grid-template-columns: repeat(3, 1fr); }
  .today-resources-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  .resources-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  .header { padding: 18px 14px 14px; }
  .header-title { font-size: 16px; }
  .content { padding: 14px 12px; }
  .cal-day { grid-template-columns: 1fr; gap: 2px; }
  .score-grid { grid-template-columns: 1fr; }
  .papers-sources-grid { grid-template-columns: 1fr; }
  .papers-year-row { flex-direction: column; align-items: flex-start; }
  .papers-year-actions { width: 100%; }
  .timer-countdown { font-size: 52px; }
  .tab { padding: 10px 10px; font-size: 12px; }

  /* Flashcard sizing */
  .flashcard-text { font-size: 14px; }
  .flashcard-front, .flashcard-back { min-height: 200px; padding: 18px 16px; }
  .flashcard-inner { min-height: 200px; }
  .flashcard { min-height: 200px; }

  /* Notes layout: stack on mobile */
  .notes-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .notes-sidebar {
    max-height: 200px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
  }
  .notes-textarea { min-height: 300px; }

  /* Timer controls */
  .timer-controls { flex-wrap: wrap; }
  .timer-btn { padding: 10px 24px; font-size: 14px; }
  .timer-presets { gap: 6px; }
  .timer-preset-btn { padding: 6px 12px; font-size: 12px; }

  /* Flashcard controls */
  .flashcard-controls { gap: 6px; }
  .fc-btn { padding: 8px 16px; font-size: 12px; }

  /* Exam responsive */
  .exam-take-header { flex-direction: column; gap: 8px; text-align: center; }
  .exam-timer-value { font-size: 22px; }
  .exam-results-num { font-size: 24px; }

  /* University responsive */
  .uni-countdown-num { font-size: 40px; }
  .uni-countdown-label { font-size: 14px; }
  .uni-phone { font-size: 14px; }
  .uni-scenario-card { padding: 14px 16px; }
  .uni-prep-tabs { gap: 2px; }
  .uni-prep-tab { min-width: 60px; padding: 6px 8px; font-size: 11px; }
  .uni-nav-btn { padding: 6px 10px; font-size: 11px; }
}
