/* ══════════════ Base ══════════════ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { overflow-x: hidden; }

/* ══════════════ Scrollbar ══════════════ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

/* ══════════════ Sidebar ══════════════ */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 16rem;
  background: #fff; border-right: 1px solid #e5e7eb;
  z-index: 40; transform: translateX(-100%);
  transition: transform .2s ease;
  overflow-y: auto;
}
.sidebar.open { transform: translateX(0); }
@media (min-width: 768px) {
  .sidebar { transform: translateX(0); }
}

/* ══════════════ Bottom Nav ══════════════ */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff; border-top: 1px solid #e5e7eb;
  z-index: 40; display: flex;
}
@media (min-width: 768px) { .bottom-nav { display: none; } }

.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: .5rem 0; font-size: .65rem; color: #6b7280;
  text-decoration: none; transition: color .15s;
}
.bottom-nav a.active, .bottom-nav a:hover { color: #6366f1; }
.bottom-nav a svg { width: 20px; height: 20px; margin-bottom: 2px; }

/* ══════════════ Reading Column ══════════════ */
.reading-column {
  max-width: 70ch;
  margin-left: auto;
  margin-right: auto;
}

/* ══════════════ Markdown Content ══════════════ */
/*  Readability: 50-75 char measure via max-width:70ch,
    17px body text, 1.65 line-height, proportional spacing.
    Based on Bringhurst / Baymard / WCAG best practices.  */
.md-content {
  font-size: 1.0625rem;      /* 17px — comfortable for long-form */
  line-height: 1.65;
  color: #374151;            /* gray-700: softer than pure black */
  letter-spacing: -0.005em;  /* slight tightening for Inter */
  word-spacing: 0.02em;
}
/* — Headings: clear hierarchy, generous top margin = visual sections — */
.md-content h1 { font-size: 1.55rem; font-weight: 700; margin: 2rem 0 .75rem; letter-spacing: -0.02em; color: #111827; }
.md-content h2 { font-size: 1.3rem;  font-weight: 600; margin: 1.75rem 0 .5rem; letter-spacing: -0.015em; color: #1f2937; }
.md-content h3 { font-size: 1.125rem; font-weight: 600; margin: 1.5rem 0 .4rem; letter-spacing: -0.01em; color: #1f2937; }
.md-content h4 { font-size: 1rem;    font-weight: 600; margin: 1.25rem 0 .35rem; color: #374151; }
/* First heading after nothing needs no top gap */
.md-content > h1:first-child,
.md-content > h2:first-child,
.md-content > h3:first-child,
.md-content > h4:first-child { margin-top: 0; }
/* — Body blocks — */
.md-content p { margin: .75em 0; }
.md-content ul, .md-content ol { margin: .65em 0 .65em 1.5rem; }
.md-content ul { list-style-type: disc; }
.md-content ol { list-style-type: decimal; }
.md-content ul ul { list-style-type: circle; }
.md-content ul ul ul { list-style-type: square; }
.md-content li { margin: .3em 0; }
.md-content li > p { margin: .35em 0; } /* tighter inside list items */
/* — Inline elements — */
.md-content code {
  background: #f3f4f6; padding: .15rem .35rem;
  border-radius: 4px; font-size: .875em;   /* relative to parent */
}
.md-content pre {
  background: #1f2937; color: #e5e7eb; padding: 1rem;
  border-radius: 8px; overflow-x: auto; margin: 1em 0;
  max-width: none;  /* code blocks can be wider than prose */
}
.md-content pre code { background: none; color: inherit; padding: 0; font-size: .875rem; }
.md-content blockquote {
  border-left: 3px solid #6366f1; padding: .5rem 1rem;
  margin: 1em 0; background: #eef2ff; border-radius: 0 8px 8px 0;
}
.md-content a { color: #6366f1; text-decoration: underline; text-underline-offset: 2px; }
.md-content img { max-width: 100%; border-radius: 8px; margin: 1em 0; }

/* Force replaced/embedded elements to respect container width */
.md-content table,
.md-content img,
.md-content iframe,
.md-content video,
.md-content object,
.md-content embed { max-width: 100%; box-sizing: border-box; }
.md-content table { width: max-content; min-width: 100%; border-collapse: collapse; margin: 1em 0; display: block; overflow-x: auto; font-size: .9375rem; }
.md-content th, .md-content td { border: 1px solid #e5e7eb; padding: .45rem .65rem; text-align: left; vertical-align: top; word-break: normal; overflow-wrap: normal; }
.md-content th { background: #f9fafb; font-weight: 600; }
.md-content tbody, .md-content thead, .md-content tr { max-width: 100%; }
.md-content hr { border: none; border-top: 1px solid #e5e7eb; margin: 1.5em 0; }

/* ══════════════ Admonitions (Obsidian/Quartz-style) ══════════════ */
.admonition {
  border-radius: 0 8px 8px 0;
  margin: 1rem 0;
  padding: .75rem 1rem;
  border-left: 4px solid;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  transition: box-shadow .15s ease;
}
.admonition:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.admonition-title {
  display: flex; align-items: center; gap: .5rem;
  padding: 0; font-weight: 700; font-size: .75rem;
  text-transform: uppercase; letter-spacing: .04em;
  margin-bottom: .5rem;
}
.admonition-title svg { width: 16px; height: 16px; flex-shrink: 0; }
.admonition-content { padding: 0; font-size: inherit; line-height: 1.6; }
.admonition-content p:first-child { margin-top: 0; }
.admonition-content p:last-child { margin-bottom: 0; }

/* Note */
.admonition-note { border-color: #448aff; background: #448aff10; }
.admonition-note .admonition-title { color: #448aff; }
/* Info */
.admonition-info { border-color: #00b8d4; background: #00b8d410; }
.admonition-info .admonition-title { color: #00b8d4; }
/* Todo */
.admonition-todo { border-color: #00b8d4; background: #00b8d410; }
.admonition-todo .admonition-title { color: #00b8d4; }
/* Tip, Hint */
.admonition-tip, .admonition-hint { border-color: #00bfa5; background: #00bfa510; }
.admonition-tip .admonition-title, .admonition-hint .admonition-title { color: #00bfa5; }
/* Important */
.admonition-important { border-color: #a855f7; background: #a855f710; }
.admonition-important .admonition-title { color: #a855f7; }
/* Success, Check, Done */
.admonition-success, .admonition-check, .admonition-done { border-color: #09ad7a; background: #09ad7110; }
.admonition-success .admonition-title, .admonition-check .admonition-title, .admonition-done .admonition-title { color: #09ad7a; }
/* Question, Help, FAQ */
.admonition-question, .admonition-help, .admonition-faq { border-color: #dba642; background: #dba64210; }
.admonition-question .admonition-title, .admonition-help .admonition-title, .admonition-faq .admonition-title { color: #dba642; }
/* Warning, Attention, Caution */
.admonition-warning, .admonition-attention, .admonition-caution { border-color: #db8942; background: #db894210; }
.admonition-warning .admonition-title, .admonition-attention .admonition-title, .admonition-caution .admonition-title { color: #db8942; }
/* Failure, Danger, Error, Bug, Missing */
.admonition-failure, .admonition-danger, .admonition-error, .admonition-bug, .admonition-missing { border-color: #db4242; background: #db424210; }
.admonition-failure .admonition-title, .admonition-danger .admonition-title, .admonition-error .admonition-title, .admonition-bug .admonition-title, .admonition-missing .admonition-title { color: #db4242; }
/* Example */
.admonition-example { border-color: #7a43b5; background: #7a43b510; }
.admonition-example .admonition-title { color: #7a43b5; }
/* Abstract, Summary, TL;DR */
.admonition-abstract, .admonition-summary, .admonition-tldr { border-color: #00b0ff; background: #00b0ff10; }
.admonition-abstract .admonition-title, .admonition-summary .admonition-title, .admonition-tldr .admonition-title { color: #00b0ff; }
/* Quote, Cite */
.admonition-quote, .admonition-cite { border-color: #9e9e9e; background: #9e9e9e10; }
.admonition-quote .admonition-title, .admonition-cite .admonition-title { color: #9e9e9e; }

/* ══════════════ Calendar ══════════════ */
.cal-day {
  background: #fff; min-height: 4.5rem; padding: .25rem;
  cursor: pointer; transition: background .15s; position: relative;
}
.cal-day:hover { background: #f9fafb; }
.cal-day.today { background: #eef2ff; }
.cal-day.other-month { color: #d1d5db; }
.cal-day .day-num { font-size: .75rem; font-weight: 500; }
.cal-dots { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 2px; }
.cal-dot {
  width: 6px; height: 6px; border-radius: 50%;
}

/* ══════════════ Vote Widget ══════════════ */
.vote-widget {
  display: inline-flex; align-items: center; gap: 2px;
  margin-top: 6px;
}
.dl-vote-group {
  display: inline-flex; align-items: center; gap: 2px;
  background: #f3f4f6; border-radius: 6px; padding: 2px 4px;
}
.vote-btn-mini {
  display: flex; align-items: center; justify-content: center;
  width: 1.5rem; height: 1.5rem; border-radius: 4px; border: none;
  background: transparent; cursor: pointer; transition: all .15s;
  color: #9ca3af;
}
.vote-btn-mini:hover { background: #f3f4f6; color: #6b7280; }
.vote-btn-mini.active-up { color: #10b981; background: #ecfdf5; }
.vote-btn-mini.active-down { color: #ef4444; background: #fef2f2; }
.vote-score { font-size: 0.75rem; font-weight: 600; min-width: 1.25rem; text-align: center; color: #9ca3af; }
.vote-score.positive { color: #059669; }
.vote-score.negative { color: #dc2626; }

/* Vote pill for list cards */
.vote-pill {
  font-size: 0.65rem; font-weight: 600; padding: 0 5px; border-radius: 9999px;
  background: #f3f4f6; color: #9ca3af; line-height: 1.4;
}
.vote-pill.positive { background: #ecfdf5; color: #059669; }
.vote-pill.negative { background: #fef2f2; color: #dc2626; }

/* ══════════════ Cards ══════════════ */
.card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
  padding: 1rem; transition: box-shadow .15s;
}
.card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.06); }

/* ══════════════ Badge ══════════════ */
.badge {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .15rem .5rem; border-radius: 999px; font-size: .7rem;
  font-weight: 500; white-space: nowrap;
}

/* ══════════════ Toast ══════════════ */
.toast {
  padding: .5rem 1rem; border-radius: 8px; color: #fff;
  font-size: .85rem; font-weight: 500;
  animation: toast-in .3s ease, toast-out .3s ease 2.7s forwards;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.toast-success { background: #10b981; }
.toast-error { background: #ef4444; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; } }

/* ══════════════ Modal ══════════════ */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  z-index: 50; display: flex; align-items: center; justify-content: center;
  padding: 1rem; animation: fade-in .15s ease;
}
.modal-box {
  background: #fff; border-radius: 12px; padding: 1.5rem;
  max-width: 36rem; width: 100%; max-height: 90vh; overflow-y: auto;
  animation: slide-up .2s ease;
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes slide-up { from { opacity: 0; transform: translateY(20px); } }

/* ══════════════ Inputs ══════════════ */
.input {
  width: 100%; padding: .5rem .75rem; border: 1px solid #d1d5db;
  border-radius: 8px; font-size: .875rem; background: #fff;
  transition: border-color .15s;
}
.input:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
textarea.input { resize: vertical; min-height: 8rem; font-family: 'Cascadia Code','Fira Code',monospace; }
select.input { cursor: pointer; }

.btn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .5rem 1rem; border-radius: 8px; font-size: .85rem;
  font-weight: 500; cursor: pointer; border: none;
  transition: all .15s; text-decoration: none;
}
.btn-primary { background: #6366f1; color: #fff; }
.btn-primary:hover { background: #4f46e5; }
.btn-ghost { background: transparent; color: #6b7280; }
.btn-ghost:hover { background: #f3f4f6; }
.btn-danger { background: #fef2f2; color: #ef4444; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: .35rem .65rem; font-size: .75rem; }
.btn-outline { background: #fff; border: 1px solid #d1d5db; color: #374151; }
.btn-outline:hover { background: #f9fafb; }

/* ══════════════ Tabs ══════════════ */
.tabs { display: flex; gap: 0; border-bottom: 1px solid #e5e7eb; margin-bottom: 1rem; }
.tab {
  padding: .5rem 1rem; font-size: .85rem; font-weight: 500;
  color: #6b7280; cursor: pointer; border-bottom: 2px solid transparent;
  transition: all .15s;
}
.tab:hover { color: #374151; }
.tab.active { color: #6366f1; border-bottom-color: #6366f1; }

/* ══════════════ Chip/Tag ══════════════ */
.chip {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .25rem .6rem; border-radius: 999px; font-size: .75rem;
  border: 1px solid #e5e7eb; cursor: pointer; transition: all .15s;
}
.chip:hover { background: #f3f4f6; }
.chip.selected { background: #eef2ff; border-color: #6366f1; color: #6366f1; }

/* ══════════════ Skeleton ══════════════ */
.skeleton {
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite;
  border-radius: 8px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ══════════════ Overlay sidebar on mobile ══════════════ */
.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.3);
  z-index: 35; display: none;
}
.sidebar-overlay.show { display: block; }

/* ══════════════ Onboarding ══════════════ */
.onboard-wrapper {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 4rem 1rem 2rem;
  background: linear-gradient(135deg, #eef2ff, #fff, #eef2ff);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  align-items: center;
}
@media (max-width: 768px) {
  .onboard-wrapper .input { font-size: 16px; }
}
.onboarding-card {
  background: #fff; border-radius: 20px; padding: 2rem;
  max-width: 26rem; width: 100%;
  box-shadow: 0 8px 40px rgba(99,102,241,.08), 0 2px 8px rgba(0,0,0,.04);
}

/* Step progress dots */
.onboard-step-dot {
  width: 2rem; height: 2rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700;
  background: #f3f4f6; color: #9ca3af;
  border: 2px solid #e5e7eb; transition: all .25s ease;
}
.onboard-step-dot.active {
  background: #6366f1; color: #fff; border-color: #6366f1;
  box-shadow: 0 0 0 4px rgba(99,102,241,.15);
}
.onboard-step-dot.done {
  background: #10b981; color: #fff; border-color: #10b981;
}
.onboard-step-line {
  width: 2.5rem; height: 2px; background: #e5e7eb; border-radius: 1px;
  transition: background .25s;
}
.onboard-step-line.done { background: #10b981; }

/* Icon wraps */
.onboard-icon-wrap {
  width: 3.5rem; height: 3.5rem; border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  margin: 0 auto;
}
.onboard-icon-wrap.blue { background: #eef2ff; color: #6366f1; }
.onboard-icon-wrap.purple { background: #f3e8ff; color: #9333ea; }
.onboard-icon-wrap.green { background: #ecfdf5; color: #10b981; }

/* Suggestions list */
.onboard-suggestions {
  max-height: 14rem; overflow-y: auto; border-radius: 8px;
}
.onboard-suggestion-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.75rem; border-radius: 8px;
  cursor: pointer; font-size: 0.85rem; transition: background .1s;
}
.onboard-suggestion-item:hover { background: #f9fafb; }
.onboard-suggestion-item.create { color: #6366f1; font-weight: 500; }
.onboard-suggestion-item.create:hover { background: #eef2ff; }
.onboard-suggestion-icon {
  width: 1.75rem; height: 1.75rem; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; background: #f3f4f6; color: #6b7280;
}
.onboard-suggestion-icon.create { background: #eef2ff; color: #6366f1; }

/* Selected confirmation banner */
.onboard-selected-banner {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 0.75rem; border-radius: 8px;
  background: #ecfdf5; font-size: 0.85rem; font-weight: 500; color: #065f46;
}

/* Course chips in onboarding */
.onboard-course-chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.3rem 0.65rem; border-radius: 999px; font-size: 0.75rem;
  font-weight: 500; border: 1px solid;
}

/* Vertical course list (onboarding + settings) */
.course-list {
  display: flex; flex-direction: column; gap: 0;
  border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden;
}
.course-list-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid #f3f4f6;
  background: #fff; transition: background .1s;
}
.course-list-item:last-child { border-bottom: none; }
.course-list-item:hover { background: #fafafa; }
.course-list-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.course-list-remove {
  display: flex; align-items: center; justify-content: center;
  width: 1.5rem; height: 1.5rem; border: none; background: transparent;
  border-radius: 4px; cursor: pointer; color: #d1d5db; transition: all .15s;
}
.course-list-remove:hover { background: #fef2f2; color: #ef4444; }

/* ══════════════ Markdown Editor Toolbar ══════════════ */
.editor-toolbar {
  display: flex; flex-wrap: wrap; gap: 2px; padding: .35rem;
  background: #f9fafb; border: 1px solid #d1d5db;
  border-bottom: none; border-radius: 8px 8px 0 0;
}
.editor-toolbar button {
  display: flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border: none; background: transparent;
  border-radius: 4px; cursor: pointer; color: #6b7280;
}
.editor-toolbar button:hover { background: #e5e7eb; color: #374151; }
textarea.editor-input {
  border-radius: 0 0 8px 8px !important; border-top: none !important;
}

/* ══════════════ Overdue ══════════════ */
.overdue { color: #ef4444; }
.due-soon { color: #f59e0b; }

/* ══════════════ Transitions ══════════════ */
.fade-in { animation: fade-in .2s ease; }

/* ══════════════ Empty States ══════════════ */
.empty-state {
  text-align: center; padding: 3rem 1rem; color: #9ca3af;
}
.empty-state svg { width: 48px; height: 48px; margin: 0 auto .75rem; opacity: .5; }

/* Mobile spacing */
@media (max-width: 767px) {
  .cal-day { min-height: 3rem; }
  .cal-day .day-num { font-size: .65rem; }
}

/* ============== Improved Calendar Month ============== */
.calendar-page {
  width: min(1320px, calc(100vw - .8rem));
  margin-left: 50%;
  transform: translateX(-50%);
  min-height: calc(100dvh - 5.5rem);
}
@media (min-width: 1024px) {
  .calendar-page {
    width: min(1120px, calc(100vw - 2.5rem));
    margin-left: 50%;
    transform: translateX(-50%);
  }
}
.calendar-toolbar {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .5rem;
}
.calendar-toolbar-left {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .35rem;
}
.calendar-title {
  min-width: 0;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.calendar-view-toggle {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.cal-month-wrap {
  background: #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  min-height: calc(100dvh - 11.2rem);
  display: flex;
  flex-direction: column;
}
.cal-header-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: #e5e7eb;
}
.cal-header {
  background: #f9fafb; padding: .3rem .35rem; text-align: center;
  font-size: .7rem; font-weight: 600; color: #6b7280; text-transform: uppercase;
  line-height: 1;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(6rem, 1fr);
  gap: 1px;
  background: #e5e7eb;
  flex: 1;
}
.cal-day {
  min-height: 6rem !important;
  align-items: flex-start !important;
  padding: .25rem .12rem .35rem;
}
.cal-day-events {
  width: 100%;
  margin-top: .1rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: none;
  overflow: visible;
}
.cal-event-pill {
  display: block;
  width: 100%;
  font-size: 0.65rem;
  line-height: 1.2;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  border-left: none;
  background: #f3f4f6;
  color: #4b5563;
  font-weight: 500;
  text-decoration: none;
}
.cal-event-pill:hover { opacity: .88; }
.cal-event-pill.deadline { background: #fff7ed; color: #9a3412; }
.cal-event-pill.lecture { background: #eff6ff; color: #1e40af; }
.cal-event-pill-wrap {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
}
.cal-month-wrap .cal-day .day-num {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: .08rem;
  line-height: 1;
}
.cal-more {
  font-size: .65rem;
  color: #6b7280;
  font-weight: 600;
  padding: 0 2px;
}

/* ============== Calendar List View ============== */
.cal-list-wrap {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.cal-list-day {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
}
.cal-list-today {
  border-color: #6366f1;
  box-shadow: 0 0 0 1px #6366f130;
}
.cal-list-day-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem .85rem;
  background: #f9fafb;
  border-bottom: 1px solid #f1f5f9;
  font-size: .78rem;
  font-weight: 700;
  color: #374151;
}
.cal-list-today .cal-list-day-header {
  background: #eef2ff;
  color: #4338ca;
}
.cal-list-today-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6366f1;
  flex-shrink: 0;
}
.cal-list-day-items {
  display: flex;
  flex-direction: column;
}
.cal-list-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .55rem .85rem;
  border-bottom: 1px solid #f5f5f5;
  text-decoration: none;
  color: inherit;
  transition: background .15s;
}
.cal-list-item:last-child { border-bottom: none; }
.cal-list-item:hover { background: #f9fafb; }
a.cal-list-item:hover { background: #f0f4ff; }
.cal-list-icon {
  width: 2rem;
  height: 2rem;
  border-radius: .5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cal-list-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.cal-list-title {
  font-size: .82rem;
  font-weight: 600;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-list-course {
  font-size: .7rem;
  color: #8b919a;
}
.cal-list-sub {
  font-size: .7rem;
  color: #8b919a;
  display: flex;
  align-items: center;
  gap: 3px;
}
.cal-list-time {
  font-size: .72rem;
  font-weight: 600;
  color: #6b7280;
  white-space: nowrap;
  flex-shrink: 0;
}

/* TODO: Timetable / Week View (future implementation)
/* ============== Timetable (Week View) ============== */
/*
.timetable-shell {
  width: 100%;
  height: calc(100dvh - 8rem);
  min-height: 520px;
}
.timetable-scroll {
  width: 100%;
  overflow-x: hidden;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  height: 100%;
}
.timetable-container {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  width: 100%;
  height: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.timetable-header {
  display: grid;
  grid-template-columns: 2.2rem repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
}
.timetable-header-cell {
  padding: .25rem .1rem;
  text-align: center;
  border-left: 1px solid #eef2f7;
  color: #475569;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.timetable-header-cell:first-child { border-left: none; }
.timetable-header-cell.today { background: #eef2ff; color: #4338ca; }
.tt-day { font-size: .66rem; font-weight: 700; line-height: 1.05; }
.tt-date { font-size: .58rem; opacity: .85; line-height: 1.05; margin-top: 1px; }

.timetable-allday-row {
  display: grid;
  grid-template-columns: 2.2rem repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
}
.timetable-allday-label {
  font-size: .54rem;
  color: #94a3b8;
  font-weight: 700;
  padding: .25rem .1rem;
  border-right: 1px solid #eef2f7;
  text-align: right;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.timetable-allday-cell {
  border-left: 1px solid #f1f5f9;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: .18rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.timetable-body {
  display: grid;
  grid-template-columns: 2.2rem repeat(7, minmax(0, 1fr));
  position: relative;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}
.timetable-time-col {
  border-right: 1px solid #e5e7eb;
  background: #fff;
}
.timetable-time-slot {
  height: 3rem;
  position: relative;
}
.timetable-time-label {
  position: absolute;
  top: -0.5rem;
  right: .25rem;
  font-size: .62rem;
  color: #94a3b8;
  font-weight: 600;
}

.timetable-day-col {
  position: relative;
  border-left: 1px solid #f1f5f9;
  background-image: linear-gradient(#eef2f7 1px, transparent 1px);
  background-size: 100% 3rem;
}
.timetable-day-col.today { background-color: #f5f7ff; }

.timetable-event {
  position: absolute;
  left: 3px;
  right: 3px;
  padding: 3px 5px;
  font-size: .66rem;
  border-radius: 5px;
  z-index: 10;
  border-left-width: 3px;
  border-left-style: solid;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(15,23,42,.08);
  display: flex;
  flex-direction: column;
}
.timetable-event strong {
  font-weight: 700;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.timetable-event span {
  opacity: .9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.timetable-event-deadline {
  background: #ef444415;
  border-left: none;
  text-decoration: none;
  color: inherit;
  height: 1.5rem;
  min-height: 0;
  max-height: 1.5rem;
  left: 1px;
  right: 1px;
  padding: 1px 4px;
  align-items: center;
}
.timetable-event-deadline strong {
  color: #ef4444;
  font-size: .6rem;
  flex: 1;
  min-width: 0;
}
*/

@media (max-width: 767px) {
  .calendar-page { width: calc(100vw - .7rem); }
  .calendar-toolbar { gap: .35rem; }
  .calendar-toolbar-left {
    justify-content: space-between;
  }
  .calendar-title {
    font-size: .8rem;
    flex: 1;
  }
  .calendar-view-toggle { justify-self: end; }
  .calendar-view-toggle button {
    padding: .2rem .55rem;
    font-size: .7rem;
  }
  .cal-month-wrap { min-height: calc(100dvh - 10.5rem); }
  .cal-grid { grid-auto-rows: minmax(5.2rem, 1fr); }
  .cal-day { min-height: 5.2rem !important; }
  .cal-day-events { max-height: 3.8rem; }
  /* TODO: Week view responsive (future implementation)
  .timetable-shell { height: calc(100dvh - 7.9rem); min-height: 420px; }
  .tt-day { font-size: .6rem; }
  .tt-date { font-size: .54rem; }
  */
}

