/* ===== ONBOARDING ===== */
.onboarding-page {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.onboarding-progress {
  padding: 20px 32px 0;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}
.onboarding-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}
.onboarding-step {
  width: 100%;
  display: none;
  animation: fadeIn 0.3s ease;
}
.onboarding-step.active {
  display: flex;
  flex-direction: column;
}
.onboarding-logo {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-align: center;
  margin-bottom: 32px;
}
.onboarding-logo span {
  color: var(--gold);
}
.onboarding-headline {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.2;
}
.onboarding-sub {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 40px;
}
.onboarding-question {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 24px;
  line-height: 1.3;
}
.onboarding-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 40px;
  gap: 12px;
}
.step-back {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
  padding: 8px 0;
}
.step-back:hover {
  color: var(--text);
}
.step-counter {
  font-size: 0.8125rem;
  color: var(--text-faint);
}
.onboarding-hero-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 40px;
}
.hero-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}
.hero-feature-icon {
  width: 36px;
  height: 36px;
  background: var(--gold-light);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.success-screen {
  text-align: center;
  padding: 20px 0;
}
.success-icon {
  width: 72px;
  height: 72px;
  background: var(--gold-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 24px;
}
.success-summary {
  background: var(--bg-subtle);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
  text-align: left;
  margin-top: 20px;
  font-style: italic;
}
.success-summary::before {
  content: '"';
  color: var(--gold);
  font-size: 1.25rem;
  font-style: normal;
}
.success-summary::after {
  content: '"';
  color: var(--gold);
  font-size: 1.25rem;
  font-style: normal;
}

/* ===== AUTH PAGES ===== */
.auth-page {
  min-height: 100vh;
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-logo {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 32px;
  text-align: center;
}
.auth-logo span { color: var(--gold); }
.auth-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.auth-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.auth-subtitle {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}
.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.auth-footer a {
  color: var(--gold);
  font-weight: 600;
  transition: var(--transition);
}
.auth-footer a:hover {
  color: var(--gold-dark);
  text-decoration: underline;
}
.auth-terms {
  font-size: 0.75rem;
  color: var(--text-faint);
  text-align: center;
  margin-top: 16px;
  line-height: 1.5;
}
.auth-terms a {
  color: var(--text-muted);
  text-decoration: underline;
  transition: var(--transition);
}
.auth-terms a:hover { color: var(--gold); }

/* ===== DASHBOARD SHELL ===== */
.dashboard-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  flex-direction: column;
}
.dashboard-header {
  height: var(--header-height);
  border-bottom: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  background: var(--bg);
  flex-shrink: 0;
}
.header-logo {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  text-decoration: none;
}
.header-logo span { color: var(--gold); }
.header-spacer { flex: 1; }
.header-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gold-light);
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--gold-dark);
  cursor: pointer;
  transition: var(--transition);
}
.header-avatar:hover {
  box-shadow: 0 0 0 3px var(--gold-light);
}

.dashboard-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}
.dashboard-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.dashboard-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
}

/* ===== SECTION HEADERS ===== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-action {
  font-size: 0.8125rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
}
.section-action:hover { color: var(--gold); }

/* ===== NOTES PAGE ===== */
.suggested-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

/* ===== FLASHCARDS PAGE ===== */
.flashcard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.flashcard-deck-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: var(--transition);
}
.flashcard-deck-card:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.deck-title {
  font-size: 0.9375rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.deck-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.deck-progress-label {
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}

/* ===== TESTS PAGE ===== */
.test-form-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 680px;
}
.question-block {
  background: var(--bg-subtle);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  transition: var(--transition);
}
.question-block:hover { border-color: var(--gold-light); }
.question-number {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-faint);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.question-text {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 14px;
  line-height: 1.4;
}
.answer-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.875rem;
  color: var(--text-secondary);
  border: 1.5px solid transparent;
}
.answer-option:hover {
  background: var(--gold-light);
  border-color: rgba(212,175,55,0.2);
}
.answer-option.correct {
  background: var(--success-light);
  border-color: var(--success);
  color: #15803D;
  font-weight: 600;
}
.answer-option.incorrect {
  background: var(--error-light);
  border-color: var(--error);
  color: #DC2626;
}
.answer-option input[type="radio"] {
  accent-color: var(--gold);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ===== GRAMMAR PAGE ===== */
.grammar-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
}
.grammar-text-area {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.grammar-format-toolbar {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
}
.grammar-format-toolbar .nb-text-bar {
  margin: 0;
  max-width: 100%;
}
.grammar-input {
  width: 100%;
  min-height: 300px;
  padding: 18px;
  font-size: 1rem;
  line-height: 1.7;
  border: none;
  outline: none;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  display: block;
  box-sizing: border-box;
}
.grammar-input:empty::before {
  content: attr(data-placeholder);
  color: var(--text-faint);
  pointer-events: none;
  display: block;
}
.grammar-input ul {
  list-style-type: disc;
  padding-left: 24px;
  margin: 4px 0;
}
.grammar-input ol {
  list-style-type: decimal;
  padding-left: 24px;
  margin: 4px 0;
}
.grammar-input li { margin: 2px 0; line-height: 1.7; }
.grammar-output {
  padding: 18px;
  font-size: 1rem;
  line-height: 1.7;
  min-height: 300px;
  display: none;
}
.grammar-actions {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.grammar-score {
  display: flex;
  align-items: center;
  gap: 16px;
}
.score-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.score-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* ===== PLANNER PAGE ===== */
.planner-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
  align-items: start;
}
.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  transition: var(--transition);
  cursor: pointer;
}
.task-item:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-xs);
}
.task-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  transition: var(--transition);
  cursor: pointer;
}
.task-check:hover {
  border-color: var(--gold);
}
.task-check.done {
  background: var(--gold);
  border-color: var(--gold);
}
.task-info { flex: 1; }
.task-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  transition: var(--transition);
}
.task-item.done .task-title {
  text-decoration: line-through;
  color: var(--text-faint);
}
.task-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.task-type-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.task-day-header {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 16px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}

/* ===== NOTE EDITOR PAGE ===== */
.editor-page {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.editor-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1.5px solid var(--border);
  background: var(--bg);
}
.editor-title-input {
  flex: 1;
  font-size: 1.125rem;
  font-weight: 700;
  border: none;
  outline: none;
  color: var(--text);
  background: transparent;
  font-family: var(--font);
}
.editor-meta {
  font-size: 0.8125rem;
  color: var(--text-faint);
}
.editor-canvas {
  flex: 1;
  padding: 28px 40px;
  overflow-y: auto;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text);
  outline: none;
}
.editor-canvas:empty::before {
  content: attr(data-placeholder);
  color: var(--text-faint);
  pointer-events: none;
}
.autosave-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--text-faint);
}
.autosave-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

/* ===== PANEL VISIBILITY UTILITIES ===== */
.dashboard-shell.no-sidebar { --sidebar-width: 0px; }
.dashboard-shell.no-sidebar .sidebar { display: none; }
.dashboard-shell.no-right-panel { --right-panel-width: 0px; }
.dashboard-shell.no-right-panel .right-panel { display: none; }

/* ===== FLASHCARD / TEST LANDING ===== */
.tool-landing {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 32px 32px;
  min-height: calc(100vh - var(--header-height) - var(--topnav-height));
  overflow-y: auto;
}
.tool-landing-actions {
  display: flex;
  gap: 20px;
  margin-bottom: 48px;
  flex-wrap: wrap;
  justify-content: center;
}
.tool-action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 36px 48px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  border: 2px solid var(--border);
  background: var(--bg);
  min-width: 220px;
  text-align: center;
  text-decoration: none;
  color: inherit;
}
.tool-action-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.tool-action-card.gold-card {
  background: linear-gradient(135deg, var(--gold-light) 0%, #fffbe6 100%);
  border-color: var(--gold);
  box-shadow: 0 4px 20px rgba(212,175,55,0.2);
}
.tool-action-card.gold-card:hover {
  box-shadow: 0 8px 32px rgba(212,175,55,0.35);
}
.tool-action-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-subtle);
}
.tool-action-card.gold-card .tool-action-icon {
  background: var(--gold);
}
.tool-action-card.gold-card .tool-action-icon svg { color: white; }
.tool-action-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text);
}
.tool-action-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 180px;
}
.tool-landing-section {
  width: 100%;
  max-width: 900px;
}
.tool-landing-section-header {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ===== CARD BUILDER ===== */
.card-builder {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height) - var(--topnav-height));
}
.card-builder-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1.5px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}
.card-builder-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}
.card-builder-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: start;
  transition: box-shadow 0.15s;
}
.card-builder-card:hover { box-shadow: var(--shadow-sm); }
.card-builder-card .card-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.card-builder-card .card-field label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}
.card-builder-card textarea.input-field {
  resize: vertical;
  min-height: 60px;
}
.card-builder-add {
  display: flex;
  justify-content: center;
  padding: 20px 0 40px;
}

/* ===== SCAN MODAL STEPS ===== */
.scan-step { display: none; }
.scan-step.active { display: block; }
.scan-options-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.scan-option-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--bg);
  transition: var(--transition);
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 500;
}
.scan-option-btn:hover, .scan-option-btn.selected {
  border-color: var(--gold);
  background: var(--gold-light);
  color: var(--gold-dark);
}
.scan-option-btn .scan-option-label { font-size: 0.75rem; }

/* ===== ACHIEVEMENT PROGRESS BAR ===== */
.achievement-progress-wrap {
  padding: 16px 20px;
  background: var(--gold-light);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.achievement-progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gold-dark);
  margin-bottom: 8px;
}
.achievement-progress-bar {
  height: 8px;
  background: rgba(212,175,55,0.2);
  border-radius: 4px;
  overflow: hidden;
}
.achievement-progress-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 4px;
  transition: width 0.6s ease;
}
.achievement-sparkle {
  font-size: 1.125rem;
  opacity: 0.8;
}

/* ===== EXISTING TESTS LIST ===== */
.test-item-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 8px;
}
.test-item-card:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-sm);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 620px) {
  :root {
    --sidebar-width: 0px;
    --right-panel-width: 0px;
  }
  .sidebar       { display: none; }
  .right-panel   { display: none; }

  /* ── Header ── */
  .dashboard-header     { padding: 0 10px; gap: 6px; }
  .header-logo          { font-size: 1.05rem; }
  /* Hide "Search" label, keep icon only */
  .search-btn-label     { display: none; }
  #search-btn           { padding: 6px 8px; min-width: 34px; }

  /* ── Content ── */
  .dashboard-content    { padding: 16px 14px; }
  #notes-list-view      { padding: 16px 14px !important; }
  .notes-section-heading { flex-wrap: wrap; gap: 8px; }
  .notes-section-heading > div { flex-wrap: wrap; gap: 4px; }

  /* ── Tab bar ── */
  .topnav-tab span      { display: none; }
  .topnav-tab           { padding: 0 10px; }

  /* ── Note editor toolbar ── */
  .nb-scroll-track      { max-width: calc(100vw - 70px); }
  .grammar-format-toolbar { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* ── Layouts ── */
  .suggested-grid       { grid-template-columns: 1fr; }
  .grammar-layout       { grid-template-columns: 1fr; }
  .planner-layout       { grid-template-columns: 1fr; }

  /* ── Planner ── */
  .planner-events-row   { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 8px; }
  .planner-event-card   { min-width: 130px; }
  .weekly-view          { overflow-x: auto; }

  /* ── Flashcards ── */
  .flashcard-grid       { grid-template-columns: 1fr; }
  .tool-action-grid     { grid-template-columns: 1fr; }

  /* ── Onboarding ── */
  .onboarding-headline  { font-size: 1.625rem; }
  .onboarding-card      { padding: 28px 20px; }
  .pricing-cards        { grid-template-columns: 1fr; }

  /* ── Auth ── */
  .auth-card            { padding: 24px 18px; margin: 16px; }

  /* ── Touch targets: ensure minimum 44px tap area ── */
  .btn-sm               { min-height: 36px; }
  .nb-btn               { width: 42px; height: 42px; }
  .topnav-tab           { min-height: 44px; }
}

@media (max-width: 600px) {
  .auth-card {
    padding: 24px 20px;
  }
  .flashcard-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== FULL-SCREEN NOTE MODE ===== */
.dashboard-shell.note-fullscreen .sidebar,
.dashboard-shell.note-fullscreen .right-panel {
  display: none !important;
}
.dashboard-shell.note-fullscreen .topnav {
  display: none !important;
}
.dashboard-shell.note-fullscreen .dashboard-main {
  flex: 1;
}

/* ===== NOTES DRAWER (left slide-in within fullscreen) ===== */
.note-sheet-container {
  position: relative; /* anchor for the drawer */
}

/* The vertical tab on the left edge — always visible while note is open */
.notes-drawer-tab {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  display: none; /* shown only when fullscreen */
  width: 28px;
  height: 64px;
  border-radius: 0 8px 8px 0;
  border: 1px solid var(--border);
  border-left: none;
  background: var(--bg-subtle);
  color: var(--text-muted);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  padding: 0;
}
.notes-drawer-tab:hover {
  background: var(--gold-subtle);
  color: var(--gold);
}
.dashboard-shell.note-fullscreen .notes-drawer-tab {
  display: flex;
}

/* The drawer panel itself */
.notes-drawer {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 260px;
  background: var(--bg);
  border-right: 1px solid var(--border);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 4px 0 24px rgba(0,0,0,0.08);
}
.notes-drawer.open {
  transform: translateX(0);
}
.notes-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.notes-drawer-title {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.notes-drawer-close {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color 0.12s;
}
.notes-drawer-close:hover { color: var(--text); }
.notes-drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0 24px;
}

/* Drawer subject group */
.drawer-subject-group { margin-bottom: 4px; }
.drawer-subject-label {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 16px 4px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: default;
  user-select: none;
}
.drawer-subject-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.drawer-note-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px 7px 28px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  margin: 0 6px;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drawer-note-item:hover {
  background: var(--bg-subtle);
  color: var(--text);
}
.drawer-note-item.active {
  background: var(--gold-subtle);
  color: var(--gold-dark);
  font-weight: 600;
}
.drawer-note-item svg { flex-shrink: 0; opacity: 0.5; }
.drawer-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 8px 16px;
}

/* ===== NOTE EDITOR TAKES OVER CENTER ===== */
#notes-list-view {
  animation: fadeIn 0.25s ease;
}
#note-sheet-view {
  display: none;
  height: 100%;
  flex-direction: column;
}
#note-sheet-view.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

/* ===== SIDEBAR REFRESH ===== */
.sidebar {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ===== CONFIRMATION DIALOG ===== */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}
.confirm-card {
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  max-width: 360px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.18s ease;
  text-align: center;
}
.confirm-icon { font-size: 2rem; margin-bottom: 12px; }
.confirm-title { font-size: 1.0625rem; font-weight: 700; margin-bottom: 8px; }
.confirm-desc { font-size: 0.875rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 20px; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }

/* ===== ADD SUBJECT/UNIT MODALS ===== */
.quick-input-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,0.2);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.12s ease;
}
.quick-input-card {
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.15s ease;
}
.quick-input-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 14px;
}

/* ===== EXPORT / IMPORT MODALS ===== */

/* Radio option rows used in export format + scope pickers */
.exp-radio-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-subtle);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.exp-radio-row:hover { border-color: var(--gold); background: var(--gold-subtle); }
.exp-radio-row input[type="radio"] { margin-top: 3px; accent-color: var(--gold); flex-shrink: 0; }
.exp-radio-row:has(input:checked) { border-color: var(--gold); background: var(--gold-subtle); }

/* Import drag-and-drop zone */
.imp-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
  cursor: default;
}
.imp-dropzone.drag-over {
  border-color: var(--gold);
  background: var(--gold-subtle);
}

/* ===== MOVE NOTE MODAL ===== */
.move-subject-list { max-height: 240px; overflow-y: auto; margin-bottom: 4px; }
.move-subject-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9375rem;
}
.move-subject-option:hover { background: var(--gold-light); color: var(--gold); }

/* ===== NEW PLANNER LAYOUT ===== */
.planner-coach-sidebar {
  background: var(--bg);
  border-right: 1.5px solid var(--border);
  display: flex;
  flex-direction: column;
}
.planner-coach-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.planner-coach-field {
  background: var(--bg-subtle);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 0.8125rem;
  color: var(--text);
  width: 100%;
}
.planner-coach-select {
  cursor: pointer;
  appearance: auto;
}
.planner-add-exam-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 10px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.planner-add-exam-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}
.planner-attention-card {
  background: var(--gold-light);
  border: 1.5px solid rgba(212,175,55,0.35);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
/* Event countdown row */
.planner-events-row {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.planner-event-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  min-width: 160px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.planner-event-card:hover {
  border-color: rgba(212,175,55,0.4);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.planner-event-days {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.planner-event-days-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 10px;
}
.planner-event-info {
  display: flex;
  align-items: center;
  gap: 6px;
}
.planner-event-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.planner-event-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}
.planner-event-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 120px;
  padding: 16px 20px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-faint);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.planner-event-add:hover {
  border-color: var(--gold);
  color: var(--gold);
}
/* Study plan section */
.planner-plan-section {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px 8px;
}
.planner-plan-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.planner-total-time {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--gold-light);
  border: 1px solid rgba(212,175,55,0.3);
  border-radius: var(--radius-full);
  padding: 5px 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gold-dark);
}
/* New task item style */
.planner-task-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-subtle, rgba(0,0,0,0.06));
  cursor: default;
}
.planner-task-item:last-child { border-bottom: none; }
.planner-task-check {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--text-muted);
  transition: color 0.15s;
}
.planner-task-check:hover { color: var(--gold); }
.planner-task-check:hover circle { stroke: var(--gold); }
.planner-task-body { flex: 1; min-width: 0; }
.planner-task-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.planner-task-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.planner-task-sep { color: var(--text-faint); }
.planner-weekly-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s;
  background: none;
  border: none;
  width: 100%;
  font-family: var(--font);
}
.planner-weekly-link:hover { color: var(--gold); }

/* Weekly schedule expanded view */
#weekly-view { margin-top: 4px; animation: fadeIn 0.2s ease; }
.weekly-day-section {
  padding: 12px 0;
  border-top: 1px solid var(--border-subtle);
}
.weekly-day-section.weekly-day-empty { opacity: 0.6; }
.weekly-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.weekly-day-label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.weekly-day-label.today { color: var(--gold); }
.weekly-day-count {
  font-size: 0.75rem;
  color: var(--text-faint);
}
.weekly-task-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 0.875rem;
}
.weekly-task-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.weekly-task-title { flex: 1; color: var(--text); }
.weekly-task-type { font-size: 0.75rem; color: var(--text-faint); flex-shrink: 0; }
.weekly-task-free {
  font-size: 0.8125rem;
  color: var(--text-faint);
  font-style: italic;
  padding: 2px 0;
}

/* ===== TEST BUILDER ANSWER SECTION ===== */
.tb-answer-section {
  background: var(--bg-subtle);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

/* ===== NOTE SHEET TOP-RIGHT UTILITY BAR ===== */
.ns-utility-bar {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  flex-shrink: 0;
}
.ns-util-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
}
.ns-util-btn:hover { background: var(--bg-subtle); color: var(--text); }
.ns-util-btn:active { background: var(--bg-hover); }
.ns-pages-btn { width: auto; padding: 0 10px; gap: 4px; }
.ns-util-sep {
  width: 1px; height: 20px;
  background: var(--border);
  margin: 0 4px;
  flex-shrink: 0;
}
/* Popup container */
.ns-util-wrap {
  position: relative;
  flex-shrink: 0;
}
.ns-popup {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  min-width: 210px;
  z-index: 200;
  padding: 8px;
  display: none;
}
.ns-popup.open { display: block; animation: popup-in 0.15s ease; }
@keyframes popup-in {
  from { opacity:0; transform:translateY(-6px) scale(0.97); }
  to   { opacity:1; transform:translateY(0) scale(1); }
}
.ns-popup-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  padding: 4px 8px 6px;
}
.ns-popup-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
}
.ns-popup-item:hover { background: var(--bg-subtle); }
.ns-popup-divider { height: 1px; background: var(--border); margin: 6px 0; }
/* Wide popup for pages */
.ns-popup-wide { min-width: 280px; }
/* Template grid */
.ns-template-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 4px 4px 8px;
}
.ns-template-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 6px 4px 5px;
  background: transparent;
  cursor: pointer;
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: border-color 0.12s, color 0.12s;
}
.ns-template-opt:hover { border-color: var(--gold); color: var(--gold); }
.ns-template-opt.active { border-color: var(--gold); color: var(--gold); background: var(--gold-light); }
.ns-template-preview {
  width: 30px;
  height: 22px;
  border-radius: 3px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  overflow: hidden;
}
.ns-tpl-lined { background: repeating-linear-gradient(to bottom, transparent, transparent 5px, rgba(0,0,0,0.08) 5px, rgba(0,0,0,0.08) 6px); }
.ns-tpl-grid  { background: repeating-linear-gradient(to bottom, transparent, transparent 4px, rgba(0,0,0,0.08) 4px, rgba(0,0,0,0.08) 5px), repeating-linear-gradient(to right, transparent, transparent 4px, rgba(0,0,0,0.08) 4px, rgba(0,0,0,0.08) 5px); }
.ns-tpl-dots  { background-image: radial-gradient(circle, rgba(0,0,0,0.2) 1px, transparent 1px); background-size: 5px 5px; }
.ns-tpl-cornell { background: linear-gradient(to right, rgba(0,0,0,0.06) 30%, transparent 30%), repeating-linear-gradient(to bottom, transparent, transparent 5px, rgba(0,0,0,0.06) 5px, rgba(0,0,0,0.06) 6px); }
/* Pages list */
.ns-pages-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
  padding: 2px 0;
}
.ns-page-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 0.875rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.1s;
}
.ns-page-item:hover { background: var(--bg-subtle); }
.ns-page-item.current { background: var(--gold-light); color: var(--gold-dark); font-weight: 600; }

/* ===== DARK MODE: PREMIUM SCAN CARD ===== */
body.dark-mode .tool-action-card.gold-card {
  background: linear-gradient(135deg,
    rgba(212,175,55,0.18) 0%,
    rgba(212,175,55,0.06) 60%,
    rgba(30,24,10,0.95)  100%
  );
  border-color: rgba(212,175,55,0.55);
  box-shadow: 0 0 0 1px rgba(212,175,55,0.12),
              0 6px 28px rgba(212,175,55,0.18);
}
body.dark-mode .tool-action-card.gold-card:hover {
  box-shadow: 0 0 0 1px rgba(212,175,55,0.25),
              0 10px 40px rgba(212,175,55,0.3);
  transform: translateY(-3px);
}
body.dark-mode .tool-action-card.gold-card .tool-action-title {
  color: #fff;
}
body.dark-mode .tool-action-card.gold-card .tool-action-desc {
  color: rgba(255,255,255,0.65);
}

/* ===== PRINT / PDF EXPORT ===== */
@media print {
  /* Hide everything except the note content */
  .sidebar, .right-panel, .topnav, .header-bar,
  .notability-toolbar, .note-sheet-header, .notes-drawer,
  .notes-drawer-tab, .scroll-top-btn, #rp-expand-btn { display: none !important; }

  /* Remove background colors, show the note cleanly */
  body, .dashboard-shell, .dashboard-content, .note-sheet-container,
  #note-canvas-wrap { background: white !important; box-shadow: none !important; }

  /* Ensure canvas and text layer fill the page */
  .note-sheet-container { padding: 0 !important; }
  #note-canvas-wrap { margin: 0 !important; border-radius: 0 !important; overflow: visible !important; }
  #drawing-canvas { max-width: 100%; }
  #note-text-layer { color: #000 !important; padding: 24px 32px !important; }

  /* Note title at top */
  .note-title-edit { font-size: 1.5rem !important; font-weight: 700; display: block !important; padding: 16px 32px 0 !important; }
}
