/* ---- Notes ------------------------------------------------------------------
   Classes down the side, a class's items as cards, an item opened in place. */
.notes-side { width: 260px; flex-shrink: 0; border-right: 1px solid var(--glass-brd); background: var(--glass); overflow-y: auto; padding: 16px 12px 14px; display: flex; flex-direction: column; gap: 14px; }
.notes-side > * { flex-shrink: 0; }
.nb-side-item { padding: 8px 10px; gap: 10px; }
.notes-main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.nb-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--cls); flex-shrink: 0; display: inline-block; }
.nb-dot.lg { width: 14px; height: 14px; border-radius: 5px; }

.nb-lib { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.nb-head { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 10px 18px; border-bottom: 1px solid var(--border); background: var(--glass-2); flex-shrink: 0; }
.nb-scopes { display: none; gap: 6px; padding: 10px 14px 0; overflow-x: auto; flex-shrink: 0; scrollbar-width: none; }
.nb-scopes::-webkit-scrollbar { display: none; }
.nb-scopes .chip { white-space: nowrap; flex-shrink: 0; }
.nb-filters { display: flex; align-items: center; gap: 10px; padding: 12px 18px 4px; flex-wrap: wrap; flex-shrink: 0; }
.nb-filters .segmented { overflow-x: auto; max-width: 100%; }
.nb-count { margin-left: 5px; font-size: 10.5px; color: var(--text-3); font-weight: 600; }
.segmented .on .nb-count { color: inherit; opacity: .7; }
.nb-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 18px 40px; }
@media (max-width: 1000px) { .notes-side { display: none; } .nb-scopes { display: flex; } }
@media (max-width: 760px) { .nb-head { padding: 8px 12px; } .nb-filters { padding: 10px 12px 2px; } .nb-scroll { padding: 8px 12px 30px; } }

/* ---- Unit folders ---- */
.nb-section-head { display: flex; align-items: baseline; gap: 10px; margin: 4px 2px 8px; }
.nb-section-head + .nb-grid { margin-bottom: 4px; }
.nb-folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 22px; }
.nb-folder-wrap { position: relative; min-width: 0; }
.nb-folder { display: flex; align-items: center; gap: 12px; width: 100%; height: 64px; padding: 0 40px 0 12px; border-radius: 13px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); color: var(--text); transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s, background .2s; }
.nb-folder:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--cls) 55%, var(--border)); }
.nb-folder-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: color-mix(in srgb, var(--cls) 16%, transparent); color: var(--cls); }
.nb-folder-name { display: block; font-weight: 600; font-size: 13.5px; }
.nb-folder-menu { position: absolute; right: 6px; top: 50%; margin-top: -15px; opacity: .6; }
.nb-folder-wrap:hover .nb-folder-menu { opacity: 1; }
.nb-folder.add { justify-content: center; padding: 0 12px; border-style: dashed; box-shadow: none; background: none; color: var(--text-2); font-weight: 500; font-size: 13px; gap: 8px; }
.nb-folder.add:hover { color: var(--accent); border-color: var(--accent); transform: none; box-shadow: none; }
.nb-folder.drop-hot, .nb-crumb.drop-hot { border-color: var(--cls, var(--accent)); background: color-mix(in srgb, var(--cls, var(--accent)) 14%, var(--surface)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cls, var(--accent)) 30%, transparent); }
.nb-crumb { display: inline-flex; align-items: center; gap: 3px; max-width: 100%; border: 1px solid transparent; background: none; padding: 0 4px; margin-left: -4px; border-radius: 6px; font-size: 11.5px; font-weight: 600; color: var(--text-3); }
.nb-crumb:hover { color: var(--accent); }
.nb-side-folder { padding: 6px 10px 6px 30px; gap: 8px; font-size: 13px; }
.nb-side-folder svg { color: var(--cls); flex-shrink: 0; }
.nb-pick-folder { padding-left: 34px; gap: 9px; font-size: 13px; }
.nb-pick-folder svg:first-child { color: var(--cls); }
.nb-card.dragging { opacity: .45; }
@media (max-width: 520px) { .nb-folders { grid-template-columns: 1fr 1fr; gap: 8px; } .nb-folder { height: 58px; gap: 9px; padding-right: 34px; } .nb-folder-icon { width: 32px; height: 32px; } }

.nb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
@media (max-width: 520px) { .nb-grid { grid-template-columns: 1fr 1fr; gap: 10px; } }
.nb-card { display: flex; flex-direction: column; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden; cursor: pointer; transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s; min-width: 0; }
.nb-card:hover, .nb-card:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--cls) 55%, var(--border)); outline: none; }
.nb-thumb { height: 116px; position: relative; overflow: hidden; display: grid; place-items: center; background: color-mix(in srgb, var(--cls) 12%, var(--surface-2)); border-bottom: 1px solid var(--border); color: color-mix(in srgb, var(--cls) 70%, var(--text)); }
.nb-thumb::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--cls); z-index: 1; }
.nb-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nb-paper { position: absolute; inset: 12px 14px 0 18px; padding: 10px 12px; background: var(--surface); border-radius: 8px 8px 0 0; box-shadow: var(--shadow-sm); font-size: 10.5px; line-height: 1.55; color: var(--text-2); overflow: hidden;
  background-image: repeating-linear-gradient(transparent 0 15.5px, var(--border) 15.5px 16.5px); background-position: 0 9px; }
.nb-stack { position: relative; width: 110px; height: 72px; }
.nb-stack i, .nb-stack div { position: absolute; inset: 0; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.nb-stack i:nth-child(1) { transform: rotate(-7deg) translate(-6px, 2px); }
.nb-stack i:nth-child(2) { transform: rotate(4deg) translate(5px, -1px); }
.nb-stack div { display: grid; place-items: center; align-content: center; font-family: var(--font-display); font-weight: 650; font-size: 26px; color: var(--text); line-height: 1; }
.nb-stack small { font-family: var(--font); font-size: 10.5px; color: var(--text-3); margin-top: 3px; }
.nb-slide { width: 128px; aspect-ratio: 16 / 9; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); display: grid; place-items: center; align-content: center; gap: 4px; }
.nb-slide small, .nb-filethumb b { font-size: 10.5px; color: var(--text-3); font-weight: 600; letter-spacing: .04em; }
.nb-filethumb { display: grid; place-items: center; gap: 6px; }
.nb-card-body { padding: 10px 12px 11px; display: flex; flex-direction: column; flex: 1; min-width: 0; }
.nb-card-title { font-weight: 600; font-size: 13.5px; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.nb-card-menu { margin: -4px -6px 0 0; opacity: .6; }
.nb-card:hover .nb-card-menu { opacity: 1; }
.nb-card-preview { font-size: 12px; line-height: 1.45; color: var(--text-3); margin-top: 3px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.nb-card-meta { display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 9px; font-size: 11.5px; color: var(--text-3); min-width: 0; }
.nb-card-meta .tag { flex-shrink: 0; }
.nb-card-meta > :last-child { white-space: nowrap; flex-shrink: 0; }
@media (max-width: 520px) {
  .nb-card-meta .nb-card-class { display: none; }
  .nb-thumb { height: 96px; }
  .nb-card-meta .tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
}

.nb-welcome { max-width: 640px; margin: 30px auto; text-align: center; }
.nb-welcome p { line-height: 1.6; }
.nb-welcome-points { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 22px 0 24px; text-align: left; }
.nb-welcome-points > div { padding: 14px; border-radius: 13px; border: 1px solid var(--glass-brd); background: var(--glass-2); display: flex; flex-direction: column; gap: 4px; }
.nb-welcome-points svg { color: var(--accent); margin-bottom: 4px; }
.nb-welcome-points span { font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
@media (max-width: 600px) { .nb-welcome-points { grid-template-columns: 1fr; } }

.nb-drop { position: absolute; inset: 8px; z-index: 6; border: 2px dashed var(--accent); border-radius: 16px; background: color-mix(in srgb, var(--accent-soft) 80%, var(--bg)); display: grid; place-items: center; text-align: center; color: var(--accent); pointer-events: none; }
.nb-uploads { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.nb-upload { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }

/* ---- An open item ---- */
.nb-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.nb-pane-head { display: flex; align-items: center; gap: 8px; min-height: 60px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--glass-2); flex-shrink: 0; }
.nb-title-input { min-width: 0; border: 1px solid transparent; background: none; border-radius: 8px; padding: 4px 8px; font-family: var(--font-display); font-weight: 650; font-size: 21px; color: var(--text); outline: none; }
.nb-title-input:hover { border-color: var(--border); }
.nb-title-input:focus { border-color: var(--accent); box-shadow: var(--focus); background: var(--surface); }
.nb-save { color: var(--text-3); white-space: nowrap; }
.nb-save.err { color: var(--danger); font-weight: 600; }
@media (max-width: 600px) { .nb-save { display: none; } .nb-title-input { font-size: 18px; } }
.nb-pane-body { flex: 1; min-height: 0; overflow-y: auto; }
.nb-sheet { max-width: 820px; margin: 0 auto; padding: 22px 24px 60px; }
.nb-sheet.wide { max-width: 1100px; }
@media (max-width: 600px) { .nb-sheet { padding: 16px 14px 40px; } }
.nb-tools { display: flex; align-items: center; gap: 2px; padding: 4px; border: 1px solid var(--border); border-bottom: none; border-radius: 12px 12px 0 0; background: var(--surface-2); flex-wrap: wrap; }
.nb-tool { min-width: 32px; height: 30px; padding: 0 7px; border: none; background: none; border-radius: 7px; color: var(--text-2); display: grid; place-items: center; font-size: 14px; }
.nb-tool:hover { background: var(--hover); color: var(--text); }
.nb-editor { display: block; width: 100%; min-height: max(360px, calc(100dvh - 300px)); resize: none; overflow: hidden; border: none; border-radius: 0; background: transparent; color: var(--text); padding: 6px 0 0; font: inherit; font-size: 16.5px; line-height: 1.75; outline: none; caret-color: var(--accent); }
.nb-editor::placeholder { color: var(--text-3); }
/* A note is a page: the whole sheet is the writing surface, and a click
   anywhere on it puts the cursor in the note. */
.nb-page { max-width: 980px; min-height: calc(100% - 32px); margin: 16px auto; padding: 26px 44px 80px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-sm); }
.nb-page.writing { cursor: text; }
.nb-page.writing:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.nb-page .nb-tools { position: sticky; top: -1px; z-index: 2; margin: 0 -14px 6px; padding: 6px 8px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
@media (max-width: 760px) { .nb-page { margin: 0; border-radius: 0; border-left: none; border-right: none; padding: 16px 16px 60px; min-height: 100%; box-shadow: none; } .nb-page .nb-tools { margin: 0 -6px 6px; } }
.nb-read { font-size: 15.5px; line-height: 1.75; }
.nb-att-media { position: relative; }
.nb-att-x { position: absolute; top: 6px; right: 6px; background: rgba(0, 0, 0, .55); color: #fff; opacity: 0; transition: opacity .15s; }
.nb-att-media:hover .nb-att-x, .nb-att-x:focus-visible { opacity: 1; }
@media (hover: none) { .nb-att-x { opacity: 1; } }
.nb-preview-img { display: block; max-width: 100%; max-height: 72vh; border: none; padding: 0; border-radius: 12px; overflow: hidden; background: var(--surface-2); cursor: zoom-in; }
.nb-preview-img img { object-fit: contain !important; }
.nb-preview-video { width: 100%; max-height: 72vh; border-radius: 12px; background: #000; }
.nb-pdf { width: 100%; height: min(78vh, 1000px); border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.nb-text { white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font); font-size: 14px; line-height: 1.65; margin: 0; padding: 18px 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.import-row.picked { background: var(--accent-soft); }

/* ---- Flashcards ---- */
.fc-list { display: flex; flex-direction: column; gap: 8px; }
.fc-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) minmax(0, 1.4fr) auto auto; gap: 8px; align-items: start; padding: 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.fc-row.known { border-color: color-mix(in srgb, var(--success) 45%, var(--border)); }
.fc-row.known .fc-n { color: var(--success); }
.fc-row .textarea { min-height: 44px; resize: vertical; font-size: 14px; }
.fc-q { font-weight: 600; }
.fc-n { font-size: 12px; font-weight: 700; color: var(--text-3); padding-top: 12px; text-align: center; }
.fc-row .icon-btn { margin-top: 6px; }
@media (max-width: 600px) {
  .fc-row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .fc-n { display: none; }
  .fc-a { grid-column: 1 / -1; grid-row: 2; }
}

.study { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; background: var(--bg); animation: pop .16s var(--ease); }
.study-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--glass-2); flex-wrap: wrap; }
.study-stage { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 18px; }
.flash { width: min(680px, 100%); aspect-ratio: 16 / 10; max-height: 62vh; perspective: 1600px; border: none; background: none; padding: 0; cursor: pointer; color: var(--text); }
.flash-in { position: relative; width: 100%; height: 100%; transition: transform .5s var(--ease); transform-style: preserve-3d; }
.flash.flipped .flash-in { transform: rotateY(180deg); }
.flash-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); display: flex; padding: 40px 32px 28px; overflow-y: auto; }
.flash-face.back { transform: rotateY(180deg); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.flash-text { margin: auto; text-align: center; white-space: pre-wrap; overflow-wrap: anywhere; font-size: clamp(17px, 2.6vw, 26px); line-height: 1.45; }
.flash-face:not(.back) .flash-text { font-weight: 600; }
.flash-tag { position: absolute; top: 14px; left: 18px; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.study-actions { display: flex; gap: 12px; margin-top: 22px; width: min(680px, 100%); }
.study-actions .btn { flex: 1; justify-content: center; }
.study-yes { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 40%, transparent); }
.study-yes:hover { background: var(--success); color: #fff; }
.study-no { background: var(--surface); }
.study-done { text-align: center; max-width: 480px; }
@media (prefers-reduced-motion: reduce) { .flash-in { transition: none; } }

/* ---- Documents, laid out ---- */
.nb-doc { display: flex; flex-direction: column; gap: 14px; }
.nb-doc-sec { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); padding: 16px 20px 18px; box-shadow: var(--shadow-sm); min-width: 0; }
.nb-doc.k-slides .nb-doc-sec { border-left: 4px solid var(--accent); }
.nb-doc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.nb-doc-head h3 { margin: 0; font-family: var(--font-display); font-weight: 650; font-size: 19px; line-height: 1.3; min-width: 0; overflow-wrap: anywhere; }
.nb-doc-num { min-width: 28px; height: 28px; padding: 0 6px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 700; flex-shrink: 0; }
.nb-doc-sec .md { font-size: 14.5px; }
.nb-doc-picrow { display: grid; grid-template-columns: minmax(160px, 260px) minmax(0, 1fr); gap: 14px; align-items: start; margin-top: 12px; }
.nb-doc-picrow:not(:has(.nb-doc-reading)) { grid-template-columns: minmax(160px, 320px); }
.nb-doc-reading { min-width: 0; padding-left: 14px; border-left: 2px solid var(--border); }
.nb-doc-reading .nb-by { margin-bottom: 6px; }
@media (max-width: 700px) { .nb-doc-picrow { grid-template-columns: 1fr; } .nb-doc-reading { padding-left: 0; border-left: none; } }
.nb-by { flex-shrink: 0; display: inline-flex; gap: 4px; }
.nb-by.aria { background: var(--accent-soft); color: var(--accent); }
.nb-aria-read { align-items: flex-start; gap: 12px; margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.nb-aria-read .switch { margin-top: 2px; }
.nb-doc-pics { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-top: 12px; }
.nb-doc-pic { border: 1px solid var(--border); border-radius: 10px; padding: 0; background: var(--surface-2); overflow: hidden; cursor: zoom-in; aspect-ratio: 4 / 3; }
.nb-doc-pic img { width: 100%; height: 100%; object-fit: contain; display: block; }
.nb-doc-notes { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13px; line-height: 1.55; color: var(--text-2); white-space: pre-wrap; }
.nb-doc-notes b { display: block; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 3px; }
.nb-figure { margin: 14px 0; }
.nb-figure-img { display: block; max-width: 100%; max-height: 520px; border: 1px solid var(--border); border-radius: 12px; padding: 0; overflow: hidden; background: var(--surface-2); cursor: zoom-in; }
.nb-figure-img img { object-fit: contain !important; max-height: 520px; }
.nb-figure figcaption { font-size: 12.5px; color: var(--text-3); margin-top: 6px; }
.nb-read .md + .md, .nb-read .nb-figure + .md { margin-top: 12px; }
.nb-read hr { margin: 26px 0; }
/* Save as notes or files */
.nb-mode { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); color: var(--text); text-align: left; transition: border-color .15s, background .15s; }
.nb-mode:hover, .nb-mode:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.nb-mode.on { border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); }
.nb-mode-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; background: var(--accent-soft); color: var(--accent); }
.nb-read .md { font-size: 15.5px; line-height: 1.75; }
.nb-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0 2px; min-width: 0; }
.nb-crumbs .nb-crumb { max-width: 180px; }

/* ---- Checklists you can tick while reading ------------------------------------- */
.nb-read input.nb-check { cursor: pointer; width: 16px; height: 16px; vertical-align: -3px; accent-color: var(--accent); }
.nb-read li.task:has(input.nb-check:checked) { color: var(--text-3); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--text-3) 60%, transparent); }
.nb-progress { display: inline-flex; align-items: center; gap: 6px; }
.nb-progress i { display: inline-block; width: 46px; height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--success) var(--p), var(--border-strong) var(--p)); }

/* ---- Templates, and asking ARIA about a note -------------------------------------- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.tpl { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px; border-radius: 13px; text-align: left; color: var(--text);
  border: 1px solid var(--glass-brd); background: var(--glass-3); box-shadow: var(--inner);
  transition: border-color .15s ease, transform .16s cubic-bezier(.23, 1, .32, 1); }
.tpl:hover:not(:disabled) { border-color: var(--accent); }
.tpl:active:not(:disabled) { transform: scale(.97); }
.tpl:disabled { opacity: .5; cursor: not-allowed; }
.tpl-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 6px; }
.tpl-icon svg { width: 18px; height: 18px; }
.assist-out { max-height: min(56vh, 560px); overflow-y: auto; padding: 4px 2px; }
.nb-ask { gap: 6px; }
.nb-ask svg { color: var(--accent); }

/* ---- Review and the focus timer ------------------------------------------------------ */
.nb-study { display: flex; flex-direction: column; gap: 2px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.nb-study .list-item { gap: 10px; }
.nb-study .list-item:disabled { opacity: .5; cursor: default; }
.study-actions.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.study-actions .grade { flex-direction: column; gap: 2px; height: auto; padding: 10px 6px; line-height: 1.2; }
.study-actions .grade .tiny { opacity: .75; font-variant-numeric: tabular-nums; }
.grade.g0 { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.grade.g1 { color: var(--warn, #c98a12); }
.grade.g2 { color: var(--success); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.grade.g3 { color: var(--info); }
@media (hover: hover) and (pointer: fine) {
  .grade.g0:hover { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }
  .grade.g2:hover { background: var(--success-soft); }
}
@media (max-width: 520px) { .study-actions.grades { gap: 6px; } .study-actions .grade { padding: 8px 2px; font-size: 14px; } }

.focus-pill {
  position: fixed; right: 18px; bottom: 18px; z-index: 65; display: flex; align-items: center; gap: 8px;
  width: 280px; padding: 8px 8px 8px 10px; border-radius: 18px;
  background: var(--glass-2); border: 1px solid var(--glass-brd); box-shadow: var(--shadow-lg);
  transition: transform .2s cubic-bezier(.23, 1, .32, 1), opacity .2s cubic-bezier(.23, 1, .32, 1);
}
@starting-style { .focus-pill { opacity: 0; transform: translateY(8px) scale(.97); } }
.focus-ring { width: 36px; height: 36px; flex-shrink: 0; transform: rotate(-90deg); }
.focus-ring circle { fill: none; stroke: var(--border-strong); stroke-width: 3; }
.focus-ring circle.on { stroke: var(--accent); stroke-linecap: round; }
.focus-pill.rest .focus-ring circle.on { stroke: var(--success); }
.focus-pill.paused .focus-time { color: var(--text-3); }
.focus-time { font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; line-height: 1.1; }
.focus-sub { color: var(--text-3); }
.focus-lengths { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.focus-len { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-align: left; cursor: pointer; transition: border-color .15s ease, transform .12s cubic-bezier(.23, 1, .32, 1); }
.focus-len:active { transform: scale(.97); }
.focus-len.on { border-color: var(--accent); background: var(--accent-soft); }
@media (max-width: 760px) { .focus-pill { left: 12px; right: 12px; width: auto; bottom: calc(70px + env(safe-area-inset-bottom)); } }
@media (max-width: 520px) { .focus-lengths { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .focus-pill { transition: opacity .2s ease; } @starting-style { .focus-pill { transform: none; } } }
@media (prefers-reduced-transparency: reduce) { .focus-pill { background: var(--surface); } }
.nb-hit mark { background: color-mix(in srgb, var(--accent) 28%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.nb-page .nb-editor, .nb-page .nb-editor:focus, .nb-page .nb-editor:focus-visible { border: none !important; box-shadow: none !important; outline: none !important; background: transparent !important; }

/* =====================================================================================
   Notes, redesigned: a side panel with search, quick access and a folder tree of
   classes; an overview page; list or card views; a quick switcher; and a note page
   with breadcrumbs, a side-by-side preview and an outline.
   ===================================================================================== */
kbd { font-family: var(--font-mono); font-size: 10.5px; padding: 1px 5px; border-radius: 5px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-3); line-height: 1.5; }

/* ---- Side panel ---- */
.notes-side { width: 272px; background: var(--surface); padding: 14px 10px 12px; gap: 10px; }
.nb-search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 10px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-3); font-size: 13px; text-align: left; transition: border-color .15s ease, color .15s ease; }
.nb-search:hover { border-color: var(--border-strong); color: var(--text-2); }
.nb-navs { display: flex; flex-direction: column; gap: 1px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.nb-nav { padding: 7px 10px; gap: 10px; font-size: 13.5px; font-weight: 500; color: var(--text-2); border-radius: 8px; }
.nb-nav svg { color: var(--text-3); }
.nb-nav.active { color: var(--text); }
.nb-nav.active svg { color: var(--accent); }
.nb-n { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.nb-side-head { display: flex; align-items: center; padding: 2px 2px 0 10px; }
.nb-tree { display: flex; flex-direction: column; gap: 1px; }
.nb-tree-row { display: flex; align-items: center; padding-left: calc(var(--depth, 0) * 14px); min-width: 0; }
.nb-twist { width: 20px; height: 26px; flex-shrink: 0; display: grid; place-items: center; border: none; background: none; color: var(--text-3); border-radius: 6px; padding: 0; }
button.nb-twist:hover { color: var(--text); background: var(--hover); }
.nb-tree-item { flex: 1; min-width: 0; padding: 6px 8px; gap: 8px; font-size: 13.5px; border-radius: 8px; color: var(--text-2); }
.nb-tree-item svg { color: var(--cls, var(--text-3)); flex-shrink: 0; }
.nb-tree-item:hover { color: var(--text); }
.nb-tree-item.active { color: var(--text); font-weight: 600; }
.nb-tree-class { font-weight: 550; color: var(--text); }
.nb-code { font-size: 11px; font-weight: 500; margin-left: 2px; }
.nb-side-empty { display: flex; align-items: center; gap: 8px; margin: 4px 0 0 20px; padding: 8px 10px; border: 1px dashed var(--border-strong); border-radius: 9px; background: none; color: var(--text-2); font-size: 13px; }
.nb-side-empty:hover { color: var(--accent); border-color: var(--accent); }

/* ---- Heads ---- */
.nb-head { background: var(--surface); gap: 12px; padding: 12px 20px; }
.nb-head-class { background: linear-gradient(90deg, color-mix(in srgb, var(--cls) 9%, var(--surface)), var(--surface) 55%); }
.nb-head-ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex-shrink: 0; }
.nb-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 0 2px; min-width: 0; }
.nb-crumb { font-size: 12px; font-weight: 550; }
.nb-crumb svg { opacity: .6; }
.show-mobile-flex { display: none; }
@media (max-width: 1000px) { .show-mobile-flex { display: inline-flex; } }

/* ---- Overview ---- */
.nb-section-head { display: flex; align-items: center; gap: 8px; margin: 24px 2px 10px; color: var(--text-3); }
.nb-scroll > .nb-section-head:first-child, .nb-scroll > .nb-due + .nb-section-head { margin-top: 8px; }
.nb-due { display: flex; align-items: center; gap: 12px; width: 100%; margin: 6px 0 4px; padding: 12px 14px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); background: var(--accent-soft); color: var(--text); text-align: left; }
.nb-due > svg { color: var(--accent); }
.nb-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.nb-mini { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); min-width: 0; box-shadow: var(--shadow-sm); transition: border-color .15s ease, box-shadow .2s ease, transform .16s var(--ease-out); }
.nb-mini b { display: block; font-size: 13.5px; font-weight: 600; }
.nb-mini:active { transform: scale(.98); }
@media (hover: hover) and (pointer: fine) { .nb-mini:hover, .nb-class-card:hover { border-color: color-mix(in srgb, var(--cls, var(--accent)) 50%, var(--border)); box-shadow: var(--shadow); } }

/* What an item is, as a small coloured tile: notes blue, flashcards violet, slides amber, files grey. */
.nb-type { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; background: var(--hue-blue-bg); color: var(--hue-blue); }
.nb-type.sm { width: 26px; height: 26px; border-radius: 7px; }
.nb-type.t-cards { background: var(--hue-purple-bg); color: var(--hue-purple); }
.nb-type.t-deck { background: var(--hue-orange-bg); color: var(--hue-orange); }
.nb-type.t-file { background: var(--hue-slate-bg); color: var(--hue-slate); }

.nb-classes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.nb-class-card { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 16px 16px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-align: left; box-shadow: var(--shadow-sm); transition: border-color .15s ease, box-shadow .2s ease, transform .16s var(--ease-out); }
.nb-class-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--cls); }
.nb-class-card:active { transform: scale(.98); }
.nb-class-card > b { font-size: 15.5px; font-weight: 650; letter-spacing: -.01em; }
.nb-class-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.nb-class-badge { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; background: color-mix(in srgb, var(--cls) 18%, var(--surface)); color: var(--cls); font-size: 11px; font-weight: 750; letter-spacing: .02em; }
.nb-class-badge.lg { width: 42px; height: 42px; border-radius: 11px; font-size: 12px; }
.nb-class-parts { margin-top: 6px; }
.nb-class-card .progress { margin: 10px 0 8px; height: 4px; }
.nb-class-card.add { align-items: center; justify-content: center; gap: 8px; min-height: 168px; border-style: dashed; background: none; box-shadow: none; color: var(--text-2); font-weight: 550; }
.nb-class-card.add::before { display: none; }
.nb-class-card.add:hover { color: var(--accent); border-color: var(--accent); }

/* ---- The list ---- */
.nb-rows { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.nb-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) minmax(0, 210px) 130px 78px 32px; align-items: center; gap: 12px; padding: 9px 10px 9px 12px; cursor: pointer; border-top: 1px solid var(--border); transition: background-color .12s ease; }
.nb-row:first-child { border-top: none; }
.nb-row:hover { background: var(--hover); }
.nb-row:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--ring); }
.nb-row.dragging { opacity: .45; }
.nb-row-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.nb-row-title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-row-sub { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-row-sub mark, .nb-qs mark { background: color-mix(in srgb, var(--warning) 35%, transparent); color: var(--text); border-radius: 3px; padding: 0 1px; }
.nb-row-where { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); min-width: 0; }
.nb-row-where .nb-dot { width: 8px; height: 8px; }
.nb-row-kind { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.nb-row-bar { width: 38px; height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.nb-row-bar i { display: block; height: 100%; background: var(--success); }
.nb-row-when { font-size: 12px; color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nb-row .nb-card-menu { opacity: .5; }
.nb-row:hover .nb-card-menu, .nb-row:focus-within .nb-card-menu { opacity: 1; }
@media (max-width: 1200px) { .nb-row { grid-template-columns: 34px minmax(0, 1fr) minmax(0, 160px) 110px 70px 32px; } }
@media (max-width: 760px) { .nb-row { grid-template-columns: 34px minmax(0, 1fr) auto 32px; gap: 10px; } .nb-row-where, .nb-row-kind { display: none; } }

/* ---- The quick switcher ---- */
.nb-qs-scrim { align-items: flex-start; padding-top: 12vh; }
.nb-qs { width: min(640px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; display: flex; flex-direction: column; }
.nb-qs-input { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text-3); }
.nb-qs-input input { flex: 1; min-width: 0; border: none; background: none; outline: none; font-size: 16px; color: var(--text); height: 28px; }
.nb-qs-list { max-height: min(52vh, 440px); overflow-y: auto; padding: 6px; }
.nb-qs-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: none; background: none; border-radius: 9px; color: var(--text); text-align: left; font-size: 13.5px; min-width: 0; }
.nb-qs-row.on { background: var(--accent-soft); }
.nb-qs-foot { display: flex; align-items: center; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--border); background: var(--surface-2); }
.nb-qs-foot kbd { margin-right: 3px; }

/* ---- A note ---- */
.nb-pane-head { background: var(--surface); }
.nb-title-wrap { display: flex; flex-direction: column; min-width: 0; }
.nb-title-wrap .nb-crumbs { padding-left: 8px; margin-bottom: -2px; }
.nb-title-input { font-size: 19px; font-weight: 650; letter-spacing: -.015em; padding: 2px 8px; }
.nb-tool-sep { width: 1px; height: 18px; background: var(--border-strong); margin: 0 4px; flex-shrink: 0; }
.nb-page { border-radius: 14px; padding: 26px 48px 80px; }
@media (max-width: 760px) { .nb-page { padding: 16px 16px 60px; border-radius: 0; } }

/* Write and read side by side. */
.nb-pane-body.mode-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; padding: 0 16px; align-items: start; }
.nb-pane-body.mode-split .nb-page { max-width: none; margin: 16px 0; padding: 22px 30px 60px; }
.nb-live { background: var(--surface-2); position: sticky; top: 16px; max-height: calc(100% - 32px); overflow-y: auto; min-height: 0 !important; }

/* Reading, with the outline alongside when the note has headings. */
.nb-pane-body.mode-read:has(> .nb-outline) { display: grid; grid-template-columns: minmax(0, 1fr) 230px; align-items: start; }
.nb-pane-body.mode-read:has(> .nb-outline) > .nb-page { margin-right: 0; width: calc(100% - 32px); justify-self: end; }
.nb-outline { position: sticky; top: 16px; margin: 16px 16px 0 16px; padding: 12px 8px 12px 10px; border-left: 1px solid var(--border); max-height: calc(100vh - 140px); overflow-y: auto; }
.nb-outline-item { display: block; width: 100%; text-align: left; border: none; background: none; padding: 5px 8px; border-radius: 7px; color: var(--text-2); font-size: 13px; line-height: 1.35; }
.nb-outline-item:hover { color: var(--text); background: var(--hover); }
.nb-outline-item.on { color: var(--accent); font-weight: 600; }
@media (max-width: 1100px) { .nb-outline { display: none; } .nb-pane-body.mode-read:has(> .nb-outline) { display: block; } .nb-pane-body.mode-read:has(> .nb-outline) > .nb-page { margin: 16px auto; width: auto; } }

/* Typography for reading: a calm column, clear steps between heading levels. */
.nb-read, .nb-read .md { font-size: 15.5px; line-height: 1.72; color: var(--text); }
.nb-read .md > :first-child { margin-top: 0; }
.nb-read .md h1 { font-size: 27px; font-weight: 700; letter-spacing: -.025em; margin: 32px 0 12px; }
.nb-read .md h2 { font-size: 21px; font-weight: 650; letter-spacing: -.02em; margin: 30px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.nb-read .md h3 { font-size: 17px; font-weight: 650; letter-spacing: -.01em; margin: 24px 0 8px; }
.nb-read .md h1, .nb-read .md h2, .nb-read .md h3 { scroll-margin-top: 16px; }
.nb-read .md p { margin: 0 0 14px; }
.nb-read .md ul, .nb-read .md ol { margin: 0 0 14px; padding-left: 24px; }
.nb-read .md li { margin: 4px 0; }
.nb-read .md li::marker { color: var(--text-3); }
.nb-read .md strong { font-weight: 650; color: var(--text); }
.nb-read .md blockquote { margin: 0 0 16px; padding: 10px 16px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 10px 10px 0; color: var(--text); }
.nb-read .md blockquote p:last-child { margin-bottom: 0; }
.nb-read .md table { display: table; width: 100%; border: 1px solid var(--border); border-radius: 10px; border-collapse: separate; border-spacing: 0; overflow: hidden; margin: 4px 0 18px; }
.nb-read .md th, .nb-read .md td { border: none; border-top: 1px solid var(--border); padding: 9px 12px; }
.nb-read .md tr:first-child th { border-top: none; }
.nb-read .md th + th, .nb-read .md td + td { border-left: 1px solid var(--border); }
.nb-read .md th { background: var(--surface-2); font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.nb-read .md tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
.nb-read .md hr { border: none; height: 1px; background: var(--border-strong); margin: 28px 0; }
.nb-read .md code { background: var(--surface-2); border: 1px solid var(--border); }
.nb-read .md a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: 3px; }
.nb-read .md del { color: var(--text-3); }
.nb-qs-input input:focus, .nb-qs-input input:focus-visible { box-shadow: none; outline: none; }
@media (max-width: 600px) {
  .nb-shelf { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 74%; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; scrollbar-width: none; }
  .nb-shelf::-webkit-scrollbar { display: none; }
  .nb-shelf > * { scroll-snap-align: start; }
  .nb-classes { grid-template-columns: 1fr 1fr; gap: 10px; }
  .nb-class-card { padding: 14px 12px 12px; }
  .nb-class-card.add { min-height: 140px; }
}

/* Note version history */
.note-history { display: grid; grid-template-columns: 220px 1fr; gap: 12px; min-height: 320px; }
.nh-list { display: flex; flex-direction: column; gap: 2px; max-height: 60vh; overflow: auto; }
.nh-body { margin: 0; padding: 14px; border-radius: 12px; background: var(--glass-2); border: 1px solid var(--glass-brd); white-space: pre-wrap; word-break: break-word; font: 13px/1.6 var(--font-mono, ui-monospace, monospace); max-height: 60vh; overflow: auto; }
@media (max-width: 640px) { .note-history { grid-template-columns: 1fr; } .nh-list { max-height: 30vh; } }
