/* studybuddy — Notion. clean. */

:root {
  --page:           #ffffff;
  --page-tint:      #fbfbfa;
  --page-soft:      #f7f6f3;
  --page-hover:     #f1f1ef;
  --page-press:     #ebebe9;

  --ink:            #37352f;
  --ink-strong:     #1f1d18;
  --ink-soft:       rgba(55, 53, 47, 0.72);
  --ink-mute:       rgba(55, 53, 47, 0.50);
  --ink-whisper:    rgba(55, 53, 47, 0.32);
  --ink-faint:      rgba(55, 53, 47, 0.16);

  --hairline:       rgba(55, 53, 47, 0.09);
  --hairline-soft:  rgba(55, 53, 47, 0.06);
  --hairline-bold:  rgba(55, 53, 47, 0.16);

  --accent:         #2540d9;
  --accent-tint:    #ecefff;
  --accent-faint:   #f5f7ff;

  --brick:          #b0473d;
  --brick-tint:     #f6e6e2;
  --slate:          #5070a0;
  --slate-tint:     #e8eef6;
  --moss:           #5a7d4f;
  --moss-tint:      #e9efe5;
  --amber:          #a26d1f;
  --amber-tint:     #f5ecd9;

  --serif: "Source Serif 4", "Iowan Old Style", "Apple Garamond", Georgia, serif;
  --sans:  "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, sans-serif;
  --mono:  "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;

  /* Notepad surface — warm paper to distinguish from the rest of the app. */
  --note-paper:       #fdfdfc;
  --note-paper-tint:  #f7f6f3;
  --note-paper-edge:  rgba(55, 53, 47, 0.10);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

html { background: var(--page); overscroll-behavior: none; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--page);
  overscroll-behavior: none;             /* kill page-level rubber-band so the
                                            cream note surface can't peek above
                                            the topbar on overscroll */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
}

#root { height: 100%; }

/* — Type primitives — */
.serif       { font-family: var(--serif); }
.mono        { font-family: var(--mono); }

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

/* — Layout — */
.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100vh;
  background: var(--page);
}
.app.no-chrome { grid-template-columns: 1fr !important; }
.app.no-sidebar { grid-template-columns: 1fr !important; }

.app-main {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--page);
  position: relative;
}

.scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* — Subtle entry — */
.fade-in > * {
  opacity: 0;
  animation: fade-up 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.fade-in > *:nth-child(1) { animation-delay: 0.04s; }
.fade-in > *:nth-child(2) { animation-delay: 0.10s; }
.fade-in > *:nth-child(3) { animation-delay: 0.16s; }
.fade-in > *:nth-child(4) { animation-delay: 0.22s; }
.fade-in > *:nth-child(5) { animation-delay: 0.28s; }
.fade-in > *:nth-child(6) { animation-delay: 0.34s; }
.fade-in > *:nth-child(7) { animation-delay: 0.40s; }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* — Sidebar — */
.sidebar {
  background: var(--page-soft);
  display: flex;
  flex-direction: column;
  height: 100vh;
  font-size: 14.5px;
  position: relative;
}

/* Drag handle on the sidebar's right edge — invisible until hover/drag, then
   lights up as a hairline. Persists to localStorage via useSidebarWidth. */
.sidebar-resizer {
  position: absolute;
  top: 0; right: -3px; bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 20;
  background: transparent;
  transition: background 0.12s;
}
.sidebar-resizer:hover,
.sidebar-resizer.dragging {
  background: var(--hairline-bold);
}

.sidebar-head {
  padding: 14px 14px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--r-sm);
}
.brand:hover { background: var(--page-hover); }

.brand-mark {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 19px;
  color: var(--ink-strong);
  letter-spacing: -0.01em;
}
.brand-logo {
  width: 36px; height: 36px;
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
  display: block;
}

.icon-btn {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: var(--r-xs);
  border: none;
  background: transparent;
  color: var(--ink-mute);
  cursor: pointer;
  font-size: 12px;
}
.icon-btn:hover { background: var(--page-hover); color: var(--ink); }

.search-box {
  margin: 4px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--page);
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  color: var(--ink-mute);
  font-size: 13.5px;
  cursor: pointer;
}
.search-box:hover { background: var(--page-tint); }
.search-box .kbd { margin-left: auto; }

.kbd {
  display: inline-block;
  padding: 1px 5px;
  background: var(--page-tint);
  border: 1px solid var(--hairline);
  border-bottom-width: 1.5px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-mute);
  line-height: 1.4;
}

.nav-section { padding: 10px 6px 4px; }
.nav-section-label {
  padding: 8px 12px 6px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--ink-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 11px;
  margin: 1px 4px;
  border-radius: var(--r-sm);
  color: var(--ink);
  font-size: 14.5px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
}
.nav-item:hover { background: var(--page-hover); color: var(--ink-strong); }
.nav-item.active {
  background: var(--page-hover);
  color: var(--ink-strong);
  font-weight: 600;
}

.nav-item .glyph {
  width: 18px; height: 18px;
  display: grid; place-items: center;
  font-size: 14px;
  color: var(--ink-soft);
  flex-shrink: 0;
}
.nav-item .label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .badge {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-mute);
}

.sidebar-spacer { flex: 1; }

/* 2-up grid of section panels on the subject page (Upcoming / Study guides /
   Files / Notes). Each section flows independently inside its grid cell. */
.subject-sections-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px 28px;
  align-items: start;
}
.subject-section {
  min-width: 0;
}
.subject-section .section-row {
  margin-top: 0;
}
@media (max-width: 1100px) {
  .subject-sections-grid {
    grid-template-columns: 1fr;
  }
}

.sidebar-foot {
  padding: 8px 8px 12px;
  border-top: 1px solid var(--hairline);
  margin-top: 4px;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.user-card:hover { background: var(--page-hover); }

.avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--ink-strong);
  color: white;
  display: grid; place-items: center;
  font-size: 10.5px;
  font-weight: 600;
  flex-shrink: 0;
  letter-spacing: 0.02em;
  overflow: hidden;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* — Settings — */
.settings-card {
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--page);
  padding: 22px 24px;
  margin-bottom: 18px;
}
.settings-card .card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.settings-card .card-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink-strong);
  margin: 0;
}
.settings-card .card-sub {
  font-size: 12.5px;
  color: var(--ink-mute);
}
.avatar-large {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--ink-strong);
  color: white;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 500;
  letter-spacing: 0.01em;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid var(--hairline-bold);
}
.avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avatar-drop {
  flex: 1;
  border: 1.5px dashed var(--hairline-bold);
  border-radius: var(--r-md);
  padding: 16px 18px;
  background: var(--page-tint);
  cursor: pointer;
  transition: all 0.12s;
}
.avatar-drop:hover { background: var(--accent-faint); border-color: var(--accent); }
.avatar-drop.dragover { background: var(--accent-faint); border-color: var(--accent); }
.avatar-drop .head {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-strong);
}
.avatar-drop .sub {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  margin-top: 4px;
}

/* — Top bar — */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 28px;
  border-bottom: 1px solid var(--hairline);
  min-height: 46px;
  background: var(--page);
  position: sticky;
  top: 0;
  z-index: 10;
}

.bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.bar-leading {
  display: flex;
  align-items: center;
  gap: 4px;
}
.icon-btn.sidebar-toggle {
  width: 26px;
  height: 26px;
  border-radius: var(--r-xs);
  font-size: 14px;
  color: var(--ink-soft);
}
.icon-btn.sidebar-toggle:hover {
  background: var(--page-hover);
  color: var(--ink-strong);
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-mute);
  min-width: 0;
}
.crumbs .crumb { padding: 1px 4px; border-radius: 3px; }
.crumbs .crumb:not(.last) { cursor: pointer; }
.crumbs .crumb:not(.last):hover { background: var(--page-hover); color: var(--ink); }
.crumbs .crumb.last { color: var(--ink-strong); font-weight: 500; }
.crumbs .sep { color: var(--ink-whisper); }

.bar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* — Buttons — flat Notion — */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline-bold);
  background: var(--page);
  color: var(--ink);
  font: 500 13px/1 var(--sans);
  cursor: pointer;
  transition: background 0.08s, border-color 0.08s;
}
.btn:hover { background: var(--page-hover); }
.btn:active { background: var(--page-press); }

.btn.ghost { border-color: transparent; }
.btn.ghost:hover { background: var(--page-hover); }

.btn.primary,
.btn.accent {
  background: var(--ink-strong);
  border-color: var(--ink-strong);
  color: white;
}
.btn.primary:hover, .btn.accent:hover { background: var(--ink); border-color: var(--ink); }

.btn.sm { padding: 3px 9px; font-size: 12px; }
.btn.danger { color: var(--brick); border-color: var(--brick); background: var(--page); }
.btn.danger:hover { background: var(--brick-tint); }

/* Toggle button — used by the Wide-page button in the note topbar. */
.btn.active:not(.accent):not(.primary):not(.danger) {
  background: var(--ink-strong);
  border-color: var(--ink-strong);
  color: white;
}
.btn.active:not(.accent):not(.primary):not(.danger):hover {
  background: var(--ink);
  border-color: var(--ink);
}

/* Wider hit-area for the Wide-page toggle so it reads as deliberate, not a chip. */
.btn.wide-toggle {
  padding: 5px 16px;
  min-width: 120px;
  justify-content: center;
  font-size: 12.5px;
}

/* — Page chrome — */
.page-pad { padding: 28px 56px; }

.page-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 36px;
  letter-spacing: -0.022em;
  line-height: 1.1;
  color: var(--ink-strong);
  margin: 0 0 6px;
}
.page-title em {
  font-style: italic;
  color: var(--ink-strong);
  font-weight: 500;
}

.page-subtitle {
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* — Section heads — */
.section-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 26px 0 12px;
}
.section-row h2 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink-strong);
  margin: 0;
}
.section-row h2 .num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-mute);
  font-weight: 500;
}
.section-row .right {
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
}
.section-row .right:hover { color: var(--ink-strong); }

/* — KPI cards (one block per metric, separated by gap) — */
.kpi-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.kpi {
  background: rgba(251, 251, 250, 0.82); /* var(--page-tint) at 82% so the bg doodles peek through */
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 12px 16px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  backdrop-filter: blur(2px);
}

/* Background doodles ease in after the dashboard content has settled. */
.dashboard-doodles {
  animation: doodle-fade 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  opacity: 0;
}
@keyframes doodle-fade {
  to { opacity: 1; }
}
.kpi .label {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
}
.kpi .num {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink-strong);
  line-height: 1;
  margin-left: auto;
}
.kpi .num.accent { color: var(--accent); }
.kpi .sub {
  font-size: 11.5px;
  color: var(--ink-soft);
}

/* Compact upcoming-events panel that sits under the dashboard mini-calendar.
   Smaller padding and type than the full Calendar screen list. */
.upcoming-mini {
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(2px);
  overflow: hidden;
}
.upcoming-mini-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--hairline-soft);
}
.upcoming-mini-head h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-strong);
  letter-spacing: -0.01em;
}
.upcoming-mini-head a {
  font-size: 11.5px;
  color: var(--ink-soft);
  text-decoration: none;
  cursor: pointer;
}
.upcoming-mini-head a:hover { color: var(--ink-strong); }
.upcoming-mini-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--hairline-soft);
  cursor: pointer;
  font-size: 13px;
}
.upcoming-mini-row:last-child { border-bottom: none; }
.upcoming-mini-row:hover { background: var(--page-hover); }
.upcoming-mini-row .title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  color: var(--ink-strong);
}
.upcoming-mini-row .when {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-mute);
  white-space: nowrap;
}
.upcoming-mini-empty {
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--ink-mute);
}

/* — List rows — */
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--hairline-soft);
  font-size: 13.5px;
  cursor: pointer;
  margin: 0 -14px;
  border-radius: var(--r-sm);
}
.row:hover { background: var(--page-tint); }
.row:last-child { border-bottom: none; }

.row .row-emoji { width: 18px; text-align: center; font-size: 14px; }
.row .row-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .row-meta { font-family: var(--mono); font-size: 11.5px; color: var(--ink-mute); }
.row .row-num { font-family: var(--mono); font-size: 11.5px; color: var(--ink-mute); width: 50px; text-align: right; }

/* — Chip — */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--r-xs);
  background: var(--page-tint);
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 500;
  border: 1px solid var(--hairline);
}
.chip.exam       { background: var(--brick-tint); color: var(--brick); border-color: rgba(176,71,61,0.18); }
.chip.assignment { background: var(--slate-tint); color: var(--slate); border-color: rgba(80,112,160,0.20); }
.chip.study      { background: var(--moss-tint);  color: var(--moss);  border-color: rgba(90,125,79,0.20); }
.chip.other      { background: var(--page-soft);  color: var(--ink-soft); }

.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.dot.exam       { background: var(--brick); }
.dot.assignment { background: var(--slate); }
.dot.study      { background: var(--moss); }
.dot.other      { background: var(--ink-mute); }

/* — Term card — */
.term {
  border-left: 2px solid var(--ink-faint);
  padding: 5px 12px;
  margin: 6px 0;
}
.term .t-term { font-weight: 600; color: var(--ink-strong); }
.term .t-def  { color: var(--ink-soft); margin-top: 2px; line-height: 1.55; }

/* — Editable guide (inline-edit-in-place) ─────────────────────────────────
   Inputs/textareas are styled to look like rendered text. The parent tag
   (h1, h2, h3, .term, etc.) provides typography; .bare-input / .bare-textarea
   strip the input chrome and inherit the parent's font/color/size. Focus
   shows a subtle tint so the editable region is discoverable on hover/edit.
*/
.bare-input,
.bare-textarea {
  display: block;
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  resize: none;
  font-family: inherit;
}
.bare-textarea {
  overflow: hidden;
  min-height: 1em;
}
.bare-input::placeholder,
.bare-textarea::placeholder {
  color: var(--ink-whisper);
  font-style: italic;
}
.editable-guide .bare-input:hover,
.editable-guide .bare-textarea:hover {
  background: var(--page-tint);
  border-radius: 3px;
}
.editable-guide .bare-input:focus,
.editable-guide .bare-textarea:focus {
  background: var(--page-tint);
  border-radius: 3px;
  box-shadow: 0 0 0 4px var(--page-tint);
}

/* Section body textarea — match the reader paragraph look. */
.editable-guide .reader-body {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--ink);
}

/* Editable term row: term input | def textarea | × remove */
.editable-term {
  display: grid;
  grid-template-columns: 180px 1fr 22px;
  gap: 12px;
  align-items: start;
  border-left: 2px solid var(--ink-faint);
  padding: 6px 12px;
  margin: 6px 0;
}
.editable-term .t-term { font-weight: 600; color: var(--ink-strong); }
.editable-term .t-def  { color: var(--ink-soft); line-height: 1.55; }

/* Editable flashcard row */
.editable-card {
  display: grid;
  grid-template-columns: 24px 1fr 1fr 22px;
  gap: 12px;
  padding: 10px 12px;
  background: var(--page-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  align-items: start;
}
.editable-card .card-num   { font-size: 10px; color: var(--ink-mute); padding-top: 2px; }
.editable-card .card-front { font-size: 13px; font-weight: 500; }
.editable-card .card-back  { font-size: 12.5px; color: var(--ink-soft); }

/* Compact × remove button used inline in editable rows. */
.row-x {
  width: 22px; height: 22px;
  border: none;
  background: transparent;
  color: var(--ink-whisper);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--r-xs);
  padding: 0;
}
.row-x:hover {
  background: var(--brick-tint);
  color: var(--brick);
}

/* — Login — */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--page);
}
.login-left {
  padding: 64px 72px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--page-soft);
  border-right: 1px solid var(--hairline);
  position: relative;
}
.login-right {
  padding: 64px 72px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 520px;
}
.login-display {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 56px;
  letter-spacing: -0.03em;
  line-height: 1.0;
  color: var(--ink-strong);
}
.login-display em {
  font-style: italic;
  color: var(--accent);
  font-weight: 500;
}

/* — Drop zone — */
.drop {
  border: 1.5px dashed var(--hairline-bold);
  border-radius: var(--r-md);
  padding: 44px 24px;
  text-align: center;
  background: var(--page-tint);
  cursor: pointer;
  transition: all 0.12s;
}
.drop:hover { background: var(--accent-faint); border-color: var(--accent); }
.drop .drop-mark {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-whisper);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}
.drop .drop-cta {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  color: var(--ink-strong);
  letter-spacing: -0.01em;
}
.drop .drop-sub { font-size: 12.5px; color: var(--ink-mute); margin-top: 6px; }

/* — Reader — */
.reader-grid {
  display: grid;
  grid-template-columns: 220px 1fr 240px;
  height: 100%;
  overflow: hidden;
}

.toc {
  border-right: 1px solid var(--hairline);
  padding: 28px 16px;
  overflow-y: auto;
  background: var(--page-tint);
}
.toc-label {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  padding: 0 8px 8px;
}
.toc-item {
  display: flex;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--r-xs);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  margin-bottom: 1px;
}
.toc-item:hover { background: var(--page-hover); color: var(--ink-strong); }
.toc-item .num { font-family: var(--mono); font-size: 11px; color: var(--ink-mute); width: 18px; }

.reader {
  overflow-y: auto;
  padding: 56px 80px 120px;
  background: var(--page);
}
.reader-inner { max-width: 640px; margin: 0 auto; }

.reader h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 40px;
  letter-spacing: -0.022em;
  line-height: 1.05;
  color: var(--ink-strong);
  margin: 6px 0 4px;
}
.reader .eyebrow-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 14px;
}

.reader h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.01em;
  margin: 36px 0 8px;
  color: var(--ink-strong);
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.reader h2 .num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-mute);
  font-weight: 500;
}

.reader h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-strong);
  margin: 24px 0 6px;
}

.reader p {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--ink);
  margin: 0 0 14px;
}

.big-idea {
  margin: 18px 0 28px;
  padding: 18px 22px;
  background: var(--page-soft);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
}
.big-idea .label {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 8px;
}
.big-idea .body {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink-strong);
  letter-spacing: -0.005em;
}

.quick-check {
  margin-top: 28px;
  padding: 18px 20px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--page-tint);
}
.quick-check .qc-label {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.quick-check .qc-q { font-size: 14.5px; font-weight: 500; margin-bottom: 10px; color: var(--ink-strong); }

.qc-opt {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  font-size: 13px;
  margin-bottom: 4px;
  background: var(--page);
  cursor: pointer;
}
.qc-opt:hover { background: var(--page-hover); border-color: var(--hairline-bold); }
.qc-opt .letter { font-family: var(--mono); font-size: 11px; color: var(--ink-mute); width: 14px; }

.meta-rail {
  border-left: 1px solid var(--hairline);
  padding: 28px 22px;
  background: var(--page-tint);
  font-size: 13px;
  overflow-y: auto;
}
.meta-rail .row-pair {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--hairline-soft);
}
.meta-rail .row-pair:last-of-type { border-bottom: none; }
.meta-rail .row-pair .num { font-family: var(--mono); color: var(--ink-mute); }

/* — Flashcard mode picker — */
.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 8px;
}
.mode-tile {
  text-align: left;
  background: var(--page);
  border: 1.5px solid var(--hairline-bold);
  border-radius: var(--r-lg);
  padding: 28px 26px 22px;
  cursor: pointer;
  font-family: var(--sans);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 280px;
  transition: border-color 0.12s, transform 0.08s, background 0.08s;
}
.mode-tile:hover {
  border-color: var(--ink-strong);
  background: var(--page-tint);
}
.mode-tile:active { transform: translateY(1px); }
.mode-tile .mode-glyph {
  font-size: 40px;
  line-height: 1;
  color: var(--ink-strong);
}
.mode-tile .mode-name {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 28px;
  letter-spacing: -0.02em;
  color: var(--ink-strong);
  line-height: 1.05;
}
.mode-tile .mode-tag {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
}
.mode-tile .mode-desc {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-soft);
  flex: 1;
}
.mode-tile .mode-meta {
  display: flex;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-top: 1px solid var(--hairline);
  padding-top: 10px;
  margin-top: auto;
}

/* — Cram session — */
.cram-stage {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 32px 32px;
  background: var(--page-soft);
  position: relative;
}
.cram-progress {
  width: 100%;
  max-width: 540px;
  height: 4px;
  background: var(--hairline);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 32px;
}
.cram-progress-bar {
  height: 100%;
  background: var(--ink-strong);
  transition: width 0.25s ease;
}
.cram-rate {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  width: 100%;
  max-width: 540px;
}
.cram-rate-btn {
  flex: 1;
  position: relative;
  background: var(--page);
  border: 1.5px solid var(--hairline-bold);
  border-radius: var(--r-md);
  padding: 16px 18px;
  cursor: pointer;
  font-family: var(--sans);
  text-align: center;
  transition: background 0.08s, border-color 0.08s;
}
.cram-rate-btn:hover { background: var(--page-hover); }
.cram-rate-btn .lbl {
  display: block;
  font-weight: 600;
  font-size: 16px;
  color: var(--ink-strong);
}
.cram-rate-btn .hint {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-mute);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.cram-rate-btn .k { position: absolute; top: 6px; right: 8px; font-size: 9px; }
.cram-rate-btn.fail .lbl { color: var(--brick); }
.cram-rate-btn.fail:hover { border-color: var(--brick); }
.cram-rate-btn.pass .lbl { color: var(--moss); }
.cram-rate-btn.pass:hover { border-color: var(--moss); }

.cram-durations {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 14px;
}
.cram-dur {
  background: var(--page);
  border: 1.5px solid var(--hairline-bold);
  border-radius: var(--r-md);
  padding: 14px 8px;
  cursor: pointer;
  font-family: var(--sans);
  text-align: center;
}
.cram-dur:hover { background: var(--page-hover); }
.cram-dur.on {
  border-color: var(--accent);
  background: var(--accent-faint);
}
.cram-dur .num {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  color: var(--ink-strong);
  line-height: 1;
}
.cram-dur .lbl {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

/* — Flashcards — */
.flash-stage {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--page-soft);
  padding: 32px;
  position: relative;
}

.flash-deck {
  position: relative;
  width: 540px;
  height: 320px;
  cursor: pointer;
}
.flash-shadow {
  position: absolute;
  inset: 0;
  background: var(--page);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
}
.flash-shadow.s1 { transform: translate(7px, 9px) rotate(1.6deg); opacity: 0.55; }
.flash-shadow.s2 { transform: translate(3px, 4px) rotate(-1deg); opacity: 0.78; }

.flash-card {
  position: absolute;
  inset: 0;
  background: var(--page);
  border: 1px solid var(--hairline-bold);
  border-radius: var(--r-lg);
  box-shadow: 0 4px 16px -4px rgba(55, 53, 47, 0.12), 0 2px 4px rgba(55, 53, 47, 0.06);
  padding: 28px 34px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
}

.flash-front-label {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-mute);
}
.flash-body {
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--ink-strong);
}
.flash-rate {
  display: flex;
  gap: 8px;
  margin-top: 28px;
}
.flash-rate-btn {
  background: var(--page);
  border: 1px solid var(--hairline-bold);
  border-radius: var(--r-md);
  padding: 9px 20px;
  cursor: pointer;
  text-align: center;
  min-width: 92px;
  position: relative;
  font-family: var(--sans);
  transition: all 0.1s;
}
.flash-rate-btn:hover { background: var(--page-hover); }
.flash-rate-btn .lbl { display: block; font-weight: 600; font-size: 12.5px; color: var(--ink-strong); }
.flash-rate-btn .ivl { font-family: var(--mono); font-size: 10px; color: var(--ink-mute); margin-top: 2px; display: block; }
.flash-rate-btn .k { position: absolute; top: 3px; right: 5px; font-size: 9px; }
.flash-rate-btn.again .lbl { color: var(--brick); }
.flash-rate-btn.hard .lbl  { color: var(--amber); }
.flash-rate-btn.good .lbl  { color: var(--moss); }
.flash-rate-btn.easy .lbl  { color: var(--accent); }

/* — Quiz — */
.quiz-progress {
  display: flex;
  gap: 3px;
  margin-bottom: 24px;
}
.quiz-progress .seg {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--hairline);
}
.quiz-progress .seg.cur   { background: var(--ink); }
.quiz-progress .seg.right { background: var(--moss); }
.quiz-progress .seg.wrong { background: var(--brick); }

.quiz-q {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.3;
  color: var(--ink-strong);
  margin: 6px 0 24px;
}

.quiz-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--hairline-bold);
  border-radius: var(--r-md);
  margin-bottom: 8px;
  cursor: pointer;
  background: var(--page);
  font-size: 14.5px;
  color: var(--ink);
}
.quiz-opt:hover { background: var(--page-hover); }
.quiz-opt.sel   { background: var(--accent-faint); border-color: var(--accent); }
.quiz-opt.right { background: var(--moss-tint);  border-color: var(--moss); }
.quiz-opt.wrong { background: var(--brick-tint); border-color: var(--brick); }

.quiz-opt .letter {
  width: 24px; height: 24px;
  border: 1px solid var(--hairline-bold);
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  flex-shrink: 0;
  background: var(--page);
}
.quiz-opt.sel .letter   { background: var(--accent); color: white; border-color: var(--accent); }
.quiz-opt.right .letter { background: var(--moss);   color: white; border-color: var(--moss); }
.quiz-opt.wrong .letter { background: var(--brick);  color: white; border-color: var(--brick); }

/* — Calendar — */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  overflow: hidden;
}
.cal-dow {
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  border-right: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  background: var(--page-tint);
}
.cal-dow:last-child { border-right: none; }
.cal-cell {
  min-height: 96px;
  padding: 8px 10px;
  border-right: 1px solid var(--hairline-soft);
  border-bottom: 1px solid var(--hairline-soft);
  background: var(--page);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cal-cell:hover { background: var(--page-tint); }
.cal-cell.dim { color: var(--ink-whisper); background: var(--page-tint); opacity: 0.65; }
.cal-cell.today .day-num {
  background: var(--ink-strong);
  color: white;
  border-radius: 999px;
  padding: 1px 7px;
}

.cal-cell .day-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  align-self: flex-start;
  padding: 1px 4px;
}
.cal-event {
  font-size: 11.5px;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--page-tint);
  border-left: 2px solid var(--ink-mute);
  color: var(--ink-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-event.exam       { border-left-color: var(--brick); background: var(--brick-tint); color: var(--brick); }
.cal-event.assignment { border-left-color: var(--slate); background: var(--slate-tint); color: var(--slate); }
.cal-event.study      { border-left-color: var(--moss);  background: var(--moss-tint);  color: var(--moss); }

/* — Library — */
.lib-table {
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}
.lib-row {
  display: grid;
  grid-template-columns: 28px 140px 1fr 80px 70px 90px;
  gap: 12px;
  align-items: center;
  padding: 10px 8px;
  border-bottom: 1px solid var(--hairline-soft);
  cursor: pointer;
  font-size: 13.5px;
}
.lib-row:hover { background: var(--page-tint); }
.lib-row.head {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: default;
  border-bottom: 1px solid var(--hairline);
  background: var(--page-tint);
}
.lib-row.head:hover { background: var(--page-tint); }
.lib-row .lib-title { font-weight: 500; color: var(--ink-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-row .num { font-family: var(--mono); font-size: 12px; color: var(--ink-mute); }

/* — Up-next — dark inverted Notion card — */
.upnext {
  background: var(--ink-strong);
  color: white;
  border-radius: var(--r-lg);
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.upnext::before {
  content: "";
  position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(37, 64, 217, 0.35), transparent 70%);
  pointer-events: none;
}
.upnext .label {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.55;
}
.upnext .title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin: 8px 0 4px;
  color: white;
}
.upnext .meta { font-size: 12.5px; opacity: 0.65; }
.upnext .days {
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-top: 14px;
  color: white;
}
.upnext .days span { font-size: 13px; opacity: 0.55; margin-left: 6px; font-family: var(--sans); }

/* — File row — */
.file-row {
  display: grid;
  grid-template-columns: 32px 1fr 80px 60px 24px;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline-soft);
  font-size: 13px;
}
.file-row:last-child { border-bottom: none; }
.file-glyph {
  width: 28px; height: 34px;
  border-radius: var(--r-xs);
  background: var(--page-tint);
  border: 1px solid var(--hairline);
  display: grid; place-items: center;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  color: var(--ink-mute);
  position: relative;
}
.file-glyph::after {
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 8px; height: 8px;
  background: var(--page);
  border-left: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}
.file-glyph.pdf { color: var(--brick); }
.file-glyph.doc { color: var(--slate); }
.file-glyph.img { color: var(--moss); }

.file-status { font-family: var(--mono); font-size: 10.5px; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.08em; }
.file-status.done { color: var(--moss); }
.file-status.error { color: var(--brick); }

/* — Stat cluster — */
.stat-cluster {
  display: flex;
  margin-left: auto;
  background: var(--page-tint);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 8px 4px;
}
.stat {
  text-align: center;
  padding: 0 18px;
  border-right: 1px solid var(--hairline);
}
.stat:last-child { border-right: none; }
.stat .lbl {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}
.stat .val {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink-strong);
  line-height: 1.05;
}

/* — Inputs — */
.input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--hairline-bold);
  border-radius: var(--r-sm);
  background: var(--page);
  font: 400 14px/1 var(--sans);
  color: var(--ink-strong);
  outline: none;
  transition: border-color 0.08s, box-shadow 0.08s;
}
.input:hover { border-color: var(--ink-mute); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-faint); }

textarea.input { height: auto; padding: 10px 12px; line-height: 1.55; resize: vertical; }

label.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}
label.field > span {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
}

/* — Filter chips — */
.filter-chip {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--hairline-bold);
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}
.filter-chip:hover { background: var(--page-hover); }
.filter-chip.active {
  background: var(--ink-strong);
  color: white;
  border-color: var(--ink-strong);
}

/* — Mode buttons — */
.mode-btn {
  flex: 1;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--hairline-bold);
  background: var(--page);
  border-radius: var(--r-md);
  cursor: pointer;
  font-family: var(--sans);
}
.mode-btn:hover { background: var(--page-hover); }
.mode-btn.active {
  background: var(--accent-faint);
  border-color: var(--accent);
}
.mode-btn .t { font-weight: 600; font-size: 13px; color: var(--ink-strong); }
.mode-btn.active .t { color: var(--accent); }
.mode-btn .s { font-size: 11.5px; color: var(--ink-mute); margin-top: 2px; }

/* — Quick menu tiles — */
.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.quick-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border: 1px solid var(--hairline-bold);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(2px);
  cursor: pointer;
  text-align: left;
  font-family: var(--sans);
  transition: all 0.1s;
  position: relative;
  min-height: 92px;
  justify-content: space-between;
}
.quick-tile:hover {
  background: rgba(251, 251, 250, 0.92);
  border-color: var(--hairline-bold);
  transform: translateY(-1px);
}
.quick-tile .qt-glyph {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  background: var(--page-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--ink-strong);
}
.quick-tile .qt-label {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  color: var(--ink-strong);
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.quick-tile .qt-sub {
  font-size: 11.5px;
  color: var(--ink-mute);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.quick-tile.primary {
  background: var(--ink-strong);
  border-color: var(--ink-strong);
  color: white;
}
.quick-tile.primary .qt-label { color: white; }
.quick-tile.primary .qt-sub   { color: rgba(255, 255, 255, 0.55); }
.quick-tile.primary .qt-glyph {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.16);
  color: white;
}
.quick-tile.primary:hover { background: var(--ink); }

/* — Inline destructive row button (Events list, etc.) — */
.row-delete {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-whisper);
  border-radius: var(--r-xs);
  cursor: pointer;
  font-size: 14px;
  font-family: var(--mono);
  line-height: 1;
  padding: 0;
  transition: all 0.08s;
}
.row-delete:hover {
  background: var(--brick-tint);
  color: var(--brick);
  border-color: var(--brick);
}
.row-delete:active {
  background: var(--brick);
  color: white;
}

/* — Document row in subject map — */
.doc-row {
  transition: background 0.08s, border-color 0.08s;
}
.doc-row:hover {
  background: var(--page-tint) !important;
  border-color: var(--hairline-bold) !important;
}

/* — Mini calendar — */
.mini-cal {
  border: 1px solid var(--hairline-bold);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(2px);
}
.mini-cal-head {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--hairline);
  background: var(--page-tint);
}
.mini-cal-head .month {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink-strong);
  letter-spacing: -0.01em;
}
.mini-cal-head .ctrls { display: flex; gap: 4px; }
.mini-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.mini-dow {
  padding: 8px 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  text-align: center;
  border-bottom: 1px solid var(--hairline);
}
.mini-cell {
  min-height: 78px;
  padding: 6px 8px;
  border-right: 1px solid var(--hairline-soft);
  border-bottom: 1px solid var(--hairline-soft);
  background: var(--page);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.mini-cell:nth-child(7n) { border-right: none; }
.mini-cell:hover { background: var(--page-tint); }
.mini-cell.dim { background: var(--page-tint); opacity: 0.55; }
.mini-cell.today { background: var(--accent-faint); }
.mini-cell.today .day-num {
  background: var(--ink-strong);
  color: white;
  border-radius: 999px;
  padding: 1px 7px;
  font-weight: 600;
}
.mini-cell .day-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  align-self: flex-start;
}
.mini-event {
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--page-tint);
  border-left: 2px solid var(--ink-mute);
  color: var(--ink-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-event.exam       { border-left-color: var(--brick); background: var(--brick-tint); color: var(--brick); }
.mini-event.assignment { border-left-color: var(--slate); background: var(--slate-tint); color: var(--slate); }
.mini-event.study      { border-left-color: var(--moss);  background: var(--moss-tint);  color: var(--moss); }

/* — Scrollbars — */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--ink-faint); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-mute); }
::-webkit-scrollbar-track { background: transparent; }

/* — Pulse — */
@keyframes pulse-d { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }
.pulse { animation: pulse-d 1.4s ease-in-out infinite; }

/* — Collab connection status pill — */
.collab-status-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  border: 1px solid var(--hairline-bold);
  background: var(--page);
  color: var(--ink-soft);
  cursor: help;
  user-select: none;
}
.collab-status-tip {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--ink-strong);
  color: var(--page);
  padding: 7px 11px;
  border-radius: var(--r-sm);
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.4;
  white-space: normal;
  width: max-content;
  max-width: 240px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 120ms ease, transform 120ms ease;
  z-index: 100;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
}
.collab-status-pill:hover .collab-status-tip,
.collab-status-pill:focus-within .collab-status-tip {
  opacity: 1;
  transform: translateY(0);
}
.collab-status-pill .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
  background: var(--ink-mute);
  flex-shrink: 0;
}
.collab-status-pill.live .dot         { background: var(--moss); box-shadow: 0 0 0 3px rgba(90,125,79,0.18); }
.collab-status-pill.connecting .dot   { background: var(--amber); animation: pulse-d 1.4s infinite; }
.collab-status-pill.failed .dot       { background: var(--brick); }
.collab-status-pill.solo .dot         { background: var(--ink-mute); }
.collab-status-pill.live              { color: var(--moss);  border-color: rgba(90,125,79,0.35); background: var(--moss-tint); }
.collab-status-pill.connecting        { color: var(--amber); border-color: rgba(162,109,31,0.35); background: var(--amber-tint); }
.collab-status-pill.failed            { color: var(--brick); border-color: rgba(176,71,61,0.35); background: var(--brick-tint); }
.collab-status-pill .retry {
  margin-left: 4px;
  padding: 1px 7px;
  border-radius: 3px;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.collab-status-pill .retry:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* — Collab caret (Liveblocks + Tiptap CollaborationCaret) — */
/* Thin vertical line in the user's color. Label is hover-only. */
.collab-caret {
  position: relative;
  border-left: 2px solid;
  border-color: currentColor;
  margin-left: -1px;
  margin-right: -1px;
  word-break: normal;
  pointer-events: auto;
  height: 1.2em;
  display: inline-block;
  vertical-align: text-bottom;
}
.collab-caret-label {
  position: absolute;
  top: -1.6em;
  left: -2px;
  padding: 1px 6px;
  border-radius: 4px 4px 4px 0;
  color: white;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  pointer-events: none;
  user-select: none;
  z-index: 50;
}
.collab-caret:hover .collab-caret-label {
  opacity: 1;
  transform: translateY(0);
}
/* Belt + suspenders: also kill any default y-prosemirror selection
   background classes in case something slips past selectionRender. */
.collab-caret-selection,
.ProseMirror .ProseMirror-yjs-selection,
.ProseMirror [class*="yRemoteSelection"],
.ProseMirror [class*="collaboration-carets__selection"] {
  background-color: transparent !important;
}

/* — Notes — */
.note-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border: 1px solid var(--note-paper-edge);
  border-bottom: none;
  border-radius: var(--r-md) var(--r-md) 0 0;
  background: var(--note-paper);
  position: sticky;
  top: 0;
  z-index: 5;
}
.note-toolbar .tb-btn {
  height: 26px;
  min-width: 28px;
  padding: 0 8px;
  border-radius: var(--r-xs);
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font: 500 12px/1 var(--sans);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.note-toolbar .tb-btn:hover { background: var(--page-hover); color: var(--ink); }
.note-toolbar .tb-btn.active { background: var(--page-press); color: var(--ink-strong); }
.note-toolbar .tb-btn.italic { font-style: italic; font-family: var(--serif); }
.note-toolbar .tb-btn.bold { font-weight: 700; }
.note-toolbar .tb-btn.code { font-family: var(--mono); font-size: 11.5px; }
.note-toolbar .tb-btn.aa {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  min-width: 44px;
}
.note-toolbar .tb-btn.aa .tb-pop-caret {
  font-size: 8px;
  color: var(--ink-mute);
  margin-top: 1px;
}

.tb-pop-anchor { position: relative; }
.tb-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 80;
  min-width: 280px;
  background: var(--page);
  border: 1px solid var(--hairline-bold);
  border-radius: var(--r-md);
  box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.18), 0 4px 8px rgba(0, 0, 0, 0.06);
  padding: 14px 14px 12px;
}
.note-toolbar .tb-sep {
  width: 1px;
  height: 16px;
  background: var(--hairline-bold);
  margin: 0 4px;
}

.note-editor {
  border: 1px solid var(--note-paper-edge);
  border-radius: 0 0 var(--r-md) var(--r-md);
  background: var(--note-paper);
  padding: 22px 26px 80px;
  min-height: 60vh;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
}
.note-editor .ProseMirror { outline: none; }
.note-editor .ProseMirror > * + * { margin-top: 12px; }
.note-editor .ProseMirror h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 26px;
  letter-spacing: -0.015em;
  color: var(--ink-strong);
  margin-top: 28px;
}
.note-editor .ProseMirror h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 20px;
  letter-spacing: -0.01em;
  color: var(--ink-strong);
  margin-top: 22px;
}
.note-editor .ProseMirror h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-strong);
  margin-top: 18px;
}
.note-editor .ProseMirror p { margin: 0; }
.note-editor .ProseMirror ul,
.note-editor .ProseMirror ol { padding-left: 24px; }
.note-editor .ProseMirror li { margin: 4px 0; }
.note-editor .ProseMirror code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--page-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xs);
  padding: 1px 5px;
  color: var(--ink-strong);
}
.note-editor .ProseMirror pre {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  background: var(--page-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 12px 14px;
  overflow-x: auto;
  color: var(--ink-strong);
}
.note-editor .ProseMirror pre code {
  background: transparent;
  border: none;
  padding: 0;
  font-size: inherit;
}
.note-editor .ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  color: var(--ink-whisper);
  float: left;
  height: 0;
  pointer-events: none;
}
.note-editor .ProseMirror strong { color: var(--ink-strong); }

.note-title-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 36px;
  letter-spacing: -0.022em;
  line-height: 1.1;
  color: var(--ink-strong);
  padding: 0;
}
.note-title-input::placeholder { color: var(--ink-whisper); }

.note-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: baseline;
  padding: 11px 14px;
  border-bottom: 1px solid var(--hairline-soft);
  cursor: pointer;
  margin: 0 -14px;
  border-radius: var(--r-sm);
}
.note-row:hover { background: var(--page-tint); }
.note-row .note-row-title {
  font-weight: 500;
  color: var(--ink-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.note-row .note-row-snippet {
  font-size: 12.5px;
  color: var(--ink-mute);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.note-row .note-row-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-mute);
}

.save-status {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.save-status.saving { color: var(--ink-soft); }
.save-status.error { color: var(--brick); }

/* — Fullscreen note layout (TOC rail + editor) — */
.note-fullscreen {
  flex: 1;
  display: grid;
  grid-template-columns: 240px 1fr;
  overflow: hidden;
  height: 100%;
  background: var(--page);                /* solid white behind both rails so
                                             nothing cream can ever leak through
                                             a sub-pixel gap or rubber-band */
}
.note-toc-rail {
  border-right: 1px solid var(--hairline);
  background: var(--page-soft);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 12px 32px;
}
.note-main {
  overflow-y: auto;
  overscroll-behavior: contain;           /* stop bounce from exposing the
                                             cream editor surface above the topbar */
  /* No top padding on the scroll container — `position: sticky; top: 0` on the
     editor toolbar pins to the padding-box top, so a top padding here would
     leave a visible gap between the page topbar and the stuck toolbar. The
     top padding lives on .note-main-inner instead. */
  padding: 0 64px 200px;
  background: var(--page);                /* white "paper" surface */
}
.note-main-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding-top: 36px;
}
.note-main-inner.wide {
  max-width: none;
}

/* Tint the notepad paper surface (toolbar + editor) warm cream — the rest
   of the chrome (sidebar, topbar, TOC rail, surrounding margin) stays white.
   Toolbar and editor share the same cream so the page reads as one sheet.
   Top edge is squared + borderless so the stuck toolbar merges flush with the
   page topbar instead of leaving white triangles in the rounded-corner gap. */
.note-main .note-toolbar {
  background: var(--note-paper);
  border-color: var(--note-paper-edge);
  border-top: none;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.note-main .note-toolbar .tb-btn:hover {
  background: rgba(120, 90, 40, 0.10);
  color: var(--ink-strong);
}
.note-main .note-toolbar .tb-btn.active {
  background: rgba(120, 90, 40, 0.18);
  color: var(--ink-strong);
}
.note-main .note-toolbar .tb-sep {
  background: var(--note-paper-edge);
}
.note-main .note-editor {
  background: var(--note-paper);
  border-color: var(--note-paper-edge);
}
.note-main .note-editor .ProseMirror code {
  background: rgba(120, 90, 40, 0.10);
  border-color: var(--note-paper-edge);
}
.note-main .note-editor .ProseMirror pre {
  background: rgba(120, 90, 40, 0.08);
  border-color: var(--note-paper-edge);
}

/* Apply font-size + color CSS vars set inline by NoteScreen on .note-main-inner */
.note-main-inner .note-editor .ProseMirror,
.note-main-inner .note-editor .ProseMirror p,
.note-main-inner .note-editor .ProseMirror li {
  font-size: var(--note-font-size, 15px);
  color: var(--note-text-color, var(--ink));
}
.note-main-inner .note-editor .ProseMirror h1 {
  font-size: calc(var(--note-font-size, 15px) * 1.75);
  color: var(--note-text-color, var(--ink-strong));
}
.note-main-inner .note-editor .ProseMirror h2 {
  font-size: calc(var(--note-font-size, 15px) * 1.4);
  color: var(--note-text-color, var(--ink-strong));
}
.note-main-inner .note-editor .ProseMirror h3 {
  font-size: calc(var(--note-font-size, 15px) * 1.05);
  color: var(--note-text-color, var(--ink-strong));
}
.note-main-inner .note-editor .ProseMirror strong {
  color: var(--note-text-color, var(--ink-strong));
}
.note-main-inner .note-title-input {
  color: var(--note-text-color, var(--ink-strong));
}

/* — Outline rail — */
.note-toc {
  display: flex;
  flex-direction: column;
}
.note-toc-head {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  padding: 0 10px 10px;
}
.note-toc-empty {
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink-mute);
}
.note-toc-empty .kbd { font-size: 10px; }

.toc-tree {
  display: flex;
  flex-direction: column;
  gap: 1px;
  position: relative;
}
.toc-tree-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--r-xs);
  font-family: var(--sans);
  cursor: pointer;
  color: var(--ink-soft);
  line-height: 1.4;
  position: relative;
}
.toc-tree-item:hover {
  background: var(--page-hover);
  color: var(--ink-strong);
}
.toc-tree-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.toc-tree-dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--ink-whisper);
  flex-shrink: 0;
}
.toc-tree-item:hover .toc-tree-dot { background: var(--ink-mute); }

.toc-tree-item.lvl-1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 14px;
  color: var(--ink-strong);
  letter-spacing: -0.005em;
}
.toc-tree-item.lvl-1 .toc-tree-dot { display: none; }
.toc-tree-item.lvl-1 + .toc-tree-item { margin-top: 2px; }

.toc-tree-item.lvl-2 {
  margin-left: 14px;
  padding-left: 12px;
  font-size: 12.5px;
  color: var(--ink-soft);
  border-left: 1px solid var(--hairline-bold);
}

.toc-tree-item.lvl-3 {
  margin-left: 28px;
  padding-left: 12px;
  font-size: 12px;
  color: var(--ink-mute);
  border-left: 1px solid var(--hairline-bold);
}
.toc-tree-item.lvl-3 .toc-tree-dot { width: 3px; height: 3px; }

/* — Note view menu popover — */
.view-menu {
  position: relative;
  display: inline-block;
}
.view-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 80;
  min-width: 280px;
  background: var(--page);
  border: 1px solid var(--hairline-bold);
  border-radius: var(--r-md);
  box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.18), 0 4px 8px rgba(0, 0, 0, 0.06);
  padding: 14px 14px 12px;
}
.view-pop-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
}
.view-pop-label {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
}
.view-pop-divider {
  height: 1px;
  background: var(--hairline);
  margin: 6px 0;
}
.view-pop-toggles {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.toggle-pill {
  padding: 5px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline-bold);
  background: var(--page);
  color: var(--ink-soft);
  font: 500 12.5px/1 var(--sans);
  cursor: pointer;
}
.toggle-pill:hover { background: var(--page-hover); color: var(--ink); }
.toggle-pill.on {
  background: var(--ink-strong);
  border-color: var(--ink-strong);
  color: white;
}
.view-pop-sizes {
  display: flex;
  gap: 6px;
}
.size-btn {
  flex: 1;
  height: 36px;
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline-bold);
  background: var(--page);
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
}
.size-btn:hover { background: var(--page-hover); }
.size-btn.on {
  border-color: var(--accent);
  background: var(--accent-faint);
  color: var(--accent);
}
.size-glyph {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1;
}
.view-pop-colors {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.color-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--hairline-bold);
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
  background: transparent;
}
.color-swatch:hover { transform: scale(1.08); }
.color-swatch.on {
  outline: 2px solid var(--ink-strong);
  outline-offset: 2px;
}
.color-swatch.default {
  background: var(--page-tint);
  color: var(--ink-strong);
}
.color-swatch .default-glyph {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 14px;
  line-height: 1;
}

/* — Search palette (⌘K) — */
.palette-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 33, 0.4);
  backdrop-filter: blur(4px);
  z-index: 250;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 96px 20px 20px;
}
.palette {
  width: 100%;
  max-width: 560px;
  background: var(--page);
  border: 1px solid var(--hairline-bold);
  border-radius: var(--r-lg);
  box-shadow: 0 24px 60px -10px rgba(0, 0, 0, 0.30), 0 8px 16px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.palette-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--hairline);
}
.palette-glyph {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink-mute);
}
.palette-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink-strong);
  padding: 4px 0;
}
.palette-input::placeholder { color: var(--ink-whisper); }

.palette-results {
  max-height: 50vh;
  overflow-y: auto;
  padding: 6px 6px;
}
.palette-empty {
  padding: 28px 18px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-mute);
}
.palette-empty em {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-strong);
}
.palette-row {
  display: grid;
  grid-template-columns: 22px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13.5px;
}
.palette-row.active {
  background: var(--page-hover);
}
.palette-row-glyph {
  width: 22px;
  text-align: center;
  font-size: 14px;
  color: var(--ink-soft);
}
.palette-row-body {
  min-width: 0;
}
.palette-row-title {
  font-weight: 500;
  color: var(--ink-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.palette-row-sub {
  font-size: 11.5px;
  color: var(--ink-mute);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.palette-row-kind {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-whisper);
  padding: 2px 6px;
  border: 1px solid var(--hairline);
  border-radius: 3px;
}
.palette-row.active .palette-row-kind {
  color: var(--ink-soft);
  border-color: var(--hairline-bold);
}
.palette-row-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-mute);
}
.palette-foot {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 14px;
  border-top: 1px solid var(--hairline);
  background: var(--page-tint);
  font-size: 11px;
  color: var(--ink-mute);
}
.palette-foot .kbd { margin-right: 4px; }


/* — AI panel — left-edge resize handle (docked mode) — */
.ai-panel-resize-w {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -3px;
  width: 7px;
  cursor: ew-resize;
  background: transparent;
  z-index: 1;
  transition: background 0.12s;
}
.ai-panel-resize-w:hover { background: rgba(37, 64, 217, 0.10); }
.ai-panel-resize-w:active { background: rgba(37, 64, 217, 0.18); }



/* Notes section heading: deepest ink so the darkness ladder reads
   heading > folder > note (folder rows + note rows colored inline). */
.nav-section-label.notes-label { color: var(--ink-strong); }


/* — Dashboard grid (react-grid-layout) — */
.dashboard-grid { position: relative; }
.dashboard-grid .react-grid-item {
  background: var(--page);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: box-shadow 0.15s ease;
}
.dashboard-grid .react-grid-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}
.dashboard-grid .react-grid-item.react-draggable-dragging {
  z-index: 100;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  transition: none;
}
.dashboard-grid .react-grid-item.resizing {
  z-index: 100;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.10);
  opacity: 0.96;
}
.dashboard-grid .react-grid-placeholder {
  background: rgba(37, 64, 217, 0.10) !important;
  border: 2px dashed var(--accent) !important;
  border-radius: var(--r-md) !important;
  opacity: 1 !important;
  transition: all 120ms ease !important;
}
.dashboard-grid .grid-drag-handle {
  position: absolute;
  top: 0; left: 0; right: 28px;
  height: 14px;
  cursor: grab;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.dashboard-grid .grid-drag-handle::before {
  content: '⋮⋮';
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-mute);
  letter-spacing: -2px;
  line-height: 1;
}
.dashboard-grid .react-grid-item:hover .grid-drag-handle { opacity: 0.8; }
.dashboard-grid .grid-drag-handle:active { cursor: grabbing; }
.dashboard-grid .grid-box-content {
  padding: 14px;
  height: 100%;
  overflow: auto;
}
.dashboard-grid .grid-box-content.no-pad { padding: 0; height: 100%; overflow: visible; }

/* Resize handle: replace RGL's pixel image with a clean corner indicator */
.dashboard-grid .react-resizable-handle {
  background-image: none !important;
  width: 16px;
  height: 16px;
  bottom: 4px;
  right: 4px;
  opacity: 0.25;
  transition: opacity 0.12s ease;
}
.dashboard-grid .react-resizable-handle::after {
  content: '';
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--ink-mute);
  border-bottom: 2px solid var(--ink-mute);
}
.dashboard-grid .react-grid-item:hover .react-resizable-handle { opacity: 0.7; }
.dashboard-grid .react-resizable-handle:hover { opacity: 1 !important; }

.grid-loading {
  padding: 40px;
  text-align: center;
  color: var(--ink-mute);
  font-size: 13px;
  font-family: var(--mono);
}

/* Inside the dashboard grid, child cards should not duplicate the grid box's
   own border/background — strip their chrome so the grid item is the box. */
.dashboard-grid .kpi,
.dashboard-grid .upnext,
.dashboard-grid .upcoming-mini,
.dashboard-grid .quick-tile {
  border: none;
  background: transparent;
  border-radius: 0;
  margin: 0;
  height: 100%;
  width: 100%;
  box-sizing: border-box;
  backdrop-filter: none;
}
.dashboard-grid .quick-tile.primary {
  background: var(--ink-strong);
  color: white;
}
.dashboard-grid .quick-tile.primary:hover { background: var(--ink); }
.dashboard-grid .quick-tile { padding: 14px 16px; }
.dashboard-grid .upnext { padding: 14px 16px; }
.dashboard-grid .upcoming-mini { padding: 14px 16px; }
.dashboard-grid .kpi { padding: 14px 16px; }
/* MiniCalendar has its own outer styling — preserve, but neutralize border. */
.dashboard-grid .mini-cal {
  border: none;
  background: transparent;
  height: 100%;
  width: 100%;
  box-sizing: border-box;
  padding: 14px;
  margin: 0;
}
