.notes-flow-page,
.note-reader {
  --notes-ink: #172033;
  --notes-copy: #617087;
  --notes-soft: #f5f7fa;
  --notes-panel: #ffffff;
  --notes-panel-raised: #ffffff;
  --notes-line: #dfe5ed;
  --notes-line-strong: #cbd4e0;
  --notes-accent: var(--primary-color, #f97316);
  --notes-accent-soft: color-mix(in srgb, var(--notes-accent) 10%, var(--notes-panel));
  --notes-shadow: 0 18px 48px rgba(25, 37, 56, .09);
  color: var(--notes-copy);
}

[data-theme="dark"] .notes-flow-page,
[data-theme="dark"] .note-reader {
  --notes-ink: #eef3fa;
  --notes-copy: #aab7c9;
  --notes-soft: #0a1321;
  --notes-panel: #111c2d;
  --notes-panel-raised: #152238;
  --notes-line: #29384d;
  --notes-line-strong: #3a4b63;
  --notes-shadow: 0 18px 52px rgba(0, 0, 0, .24);
}

.notes-flow-page *,
.notes-flow-page *::before,
.notes-flow-page *::after,
.note-reader *,
.note-reader *::before,
.note-reader *::after { box-sizing: border-box; }

.notes-hub-page [hidden],
.notes-flow-page [hidden],
.note-reader [hidden] { display: none !important; }

.notes-flow-page { min-height: 100vh; background: var(--notes-soft); }
.notes-flow-page a { text-decoration: none; }

.notes-flow-hero,
.notes-subject-hero {
  position: relative;
  padding-block: clamp(42px, 6vw, 78px) clamp(45px, 6vw, 76px);
  overflow: hidden;
  border-bottom: 1px solid var(--notes-line);
  background:
    radial-gradient(circle at 85% 10%, color-mix(in srgb, var(--notes-accent) 13%, transparent), transparent 24rem),
    linear-gradient(180deg, var(--notes-panel), color-mix(in srgb, var(--notes-soft) 76%, var(--notes-panel)));
}

.notes-subject-hero { padding-block: clamp(36px, 5vw, 65px) clamp(42px, 5vw, 68px); }

.notes-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: clamp(27px, 4vw, 43px);
  color: var(--notes-copy);
  font-size: .7rem;
  font-weight: 650;
}

.notes-breadcrumb a { color: inherit; }
.notes-breadcrumb a:hover { color: var(--notes-accent); }
.notes-breadcrumb .material-symbols-outlined { font-size: 16px; }

.notes-flow-hero-grid,
.notes-subject-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: clamp(28px, 6vw, 78px);
}

.notes-subject-hero-grid { align-items: center; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); }

.notes-flow-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 11px;
  color: var(--notes-accent);
  font-size: .69rem;
  font-weight: 800;
  letter-spacing: .095em;
}

.notes-flow-eyebrow .material-symbols-outlined { font-size: 19px; }

.notes-flow-hero h1,
.notes-subject-hero h1 {
  max-width: 760px;
  margin: 0;
  color: var(--notes-ink);
  font-size: clamp(2.2rem, 4.4vw, 4.25rem);
  font-weight: 760;
  line-height: 1.04;
  letter-spacing: -.052em;
}

.notes-subject-hero h1 { font-size: clamp(2.2rem, 4vw, 3.75rem); }

.notes-flow-hero-grid > div:first-child > p:last-child,
.notes-subject-hero-grid > div:first-child > p:last-of-type {
  max-width: 760px;
  margin: 20px 0 0;
  font-size: .94rem;
  line-height: 1.75;
}

.notes-flow-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(105px, 1fr));
  min-width: 350px;
  overflow: hidden;
  border: 1px solid var(--notes-line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--notes-panel) 90%, transparent);
  box-shadow: var(--notes-shadow);
}

.notes-flow-stats article { padding: 20px 18px; text-align: center; }
.notes-flow-stats article + article { border-inline-start: 1px solid var(--notes-line); }
.notes-flow-stats strong { display: block; color: var(--notes-ink); font-size: 1.4rem; line-height: 1.2; }
.notes-flow-stats span { display: block; margin-top: 5px; font-size: .63rem; font-weight: 650; }

.notes-collection-switch {
  display: inline-flex;
  gap: 5px;
  margin-top: 36px;
  padding: 5px;
  border: 1px solid var(--notes-line);
  border-radius: 14px;
  background: var(--notes-panel);
}

.notes-collection-switch a {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 9px;
  color: var(--notes-copy);
  font-size: .72rem;
  font-weight: 700;
}

.notes-collection-switch a.is-active { background: var(--notes-accent-soft); color: var(--notes-accent); }
.notes-collection-switch .material-symbols-outlined { font-size: 18px; }

.notes-continue-section,
.notes-subjects-section,
.notes-documents-section { padding-block: clamp(48px, 6vw, 78px); }

.notes-continue-section { border-bottom: 1px solid var(--notes-line); background: var(--notes-panel); }
.notes-subjects-section + .notes-subjects-section { padding-top: 0; }

.notes-section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 27px;
}

.notes-section-title p {
  margin: 0 0 5px;
  color: var(--notes-accent);
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .095em;
}

.notes-section-title h2 { margin: 0; color: var(--notes-ink); font-size: clamp(1.5rem, 2.5vw, 2.1rem); letter-spacing: -.035em; }

.notes-sync-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border: 1px solid var(--notes-line);
  border-radius: 999px;
  background: var(--notes-soft);
  color: var(--notes-copy);
  font-size: .65rem;
  font-weight: 650;
}

.notes-sync-label .material-symbols-outlined { color: #12a878; font-size: 17px; }

.notes-search-field {
  display: flex;
  width: min(360px, 100%);
  min-height: 44px;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid var(--notes-line);
  border-radius: 12px;
  background: var(--notes-panel);
  color: var(--notes-copy);
}

.notes-search-field:focus-within { border-color: var(--notes-accent); box-shadow: 0 0 0 3px var(--notes-accent-soft); }
.notes-search-field .material-symbols-outlined { font-size: 20px; }
.notes-search-field input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--notes-ink); font: inherit; font-size: .75rem; }
.notes-search-field input::placeholder { color: var(--notes-copy); opacity: .82; }

.notes-subject-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; }

.notes-subject-card {
  display: flex;
  min-height: 295px;
  flex-direction: column;
  padding: 22px;
  border: 1px solid var(--notes-line);
  border-radius: 18px;
  background: var(--notes-panel);
  color: var(--notes-copy);
  box-shadow: 0 9px 24px rgba(25, 37, 56, .035);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.notes-subject-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--notes-accent) 55%, var(--notes-line)); box-shadow: var(--notes-shadow); }
.notes-subject-card-top { display: flex; align-items: center; justify-content: space-between; }
.notes-subject-icon { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 13px; background: var(--notes-accent-soft); color: var(--notes-accent); font-size: 24px; }
.notes-subject-card-top small { color: var(--notes-line-strong); font-size: .65rem; font-weight: 800; letter-spacing: .08em; }
.notes-subject-card h2 { margin: 27px 0 8px; color: var(--notes-ink); font-size: 1.15rem; letter-spacing: -.025em; }
.notes-subject-card > p { display: -webkit-box; margin: 0; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; font-size: .72rem; line-height: 1.65; }
.notes-subject-card-footer { display: flex; align-items: center; gap: 11px; margin-top: auto; padding-top: 20px; border-top: 1px solid var(--notes-line); font-size: .65rem; }
.notes-subject-card-footer span:first-child b { color: var(--notes-ink); }
.notes-subject-card-footer .has-progress { color: #0f9e71; }
.notes-subject-card-footer .material-symbols-outlined { margin-inline-start: auto; color: var(--notes-accent); font-size: 19px; transition: transform .18s ease; }
.notes-subject-card:hover .notes-subject-card-footer .material-symbols-outlined { transform: translateX(3px); }
.notes-subject-progress { height: 4px; margin: 19px 0 -1px; overflow: hidden; border-radius: 999px; background: var(--notes-soft); }
.notes-subject-progress i { display: block; height: 100%; border-radius: inherit; background: var(--notes-accent); }

.notes-continue-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.notes-continue-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 13px; padding: 16px; border: 1px solid var(--notes-line); border-radius: 15px; background: var(--notes-soft); color: var(--notes-copy); transition: border-color .18s ease, transform .18s ease; }
.notes-continue-card:hover { transform: translateY(-2px); border-color: var(--notes-accent); }
.notes-continue-icon { display: grid; width: 39px; height: 47px; place-items: center; border-radius: 9px; background: var(--notes-panel); color: var(--notes-accent); box-shadow: 0 5px 15px rgba(20, 34, 54, .08); }
.notes-continue-card small { display: block; color: var(--notes-accent); font-size: .55rem; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.notes-continue-card h3 { margin: 3px 0 3px; overflow: hidden; color: var(--notes-ink); font-size: .77rem; text-overflow: ellipsis; white-space: nowrap; }
.notes-continue-card div > span { font-size: .61rem; }
.notes-continue-card > .material-symbols-outlined { color: var(--notes-accent); }
.notes-inline-progress { height: 4px; margin-top: 8px; overflow: hidden; border-radius: 999px; background: var(--notes-line); }
.notes-inline-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--notes-accent), color-mix(in srgb, var(--notes-accent) 55%, #ffcf7a)); }

.notes-empty-state { max-width: 650px; margin: 20px auto; padding: 55px 28px; border: 1px dashed var(--notes-line-strong); border-radius: 20px; background: var(--notes-panel); text-align: center; }
.notes-empty-state > .material-symbols-outlined { display: grid; width: 58px; height: 58px; margin: 0 auto 18px; place-items: center; border-radius: 17px; background: var(--notes-accent-soft); color: var(--notes-accent); font-size: 30px; }
.notes-empty-state h2 { margin: 0; color: var(--notes-ink); font-size: 1.25rem; }
.notes-empty-state p { max-width: 480px; margin: 10px auto 22px; font-size: .76rem; line-height: 1.7; }

.notes-action-primary {
  display: inline-flex;
  min-height: 43px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border: 1px solid var(--notes-accent);
  border-radius: 11px;
  background: var(--notes-accent);
  color: #fff;
  font-size: .72rem;
  font-weight: 730;
}

.notes-action-primary:hover { filter: brightness(.96); }
.notes-action-primary .material-symbols-outlined { font-size: 18px; }

.notes-subject-meta { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 27px; }
.notes-subject-meta > span { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border: 1px solid var(--notes-line); border-radius: 999px; background: color-mix(in srgb, var(--notes-panel) 82%, transparent); font-size: .64rem; }
.notes-subject-meta .material-symbols-outlined { color: var(--notes-accent); font-size: 17px; }
.notes-subject-meta b { color: var(--notes-ink); }

.notes-owner-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 17px;
  border: 1px solid var(--notes-line);
  border-radius: 17px;
  background: color-mix(in srgb, var(--notes-panel) 92%, transparent);
  box-shadow: var(--notes-shadow);
}
.notes-owner-card > img { width: 54px; height: 54px; border: 2px solid var(--notes-panel); border-radius: 16px; object-fit: cover; outline: 1px solid var(--notes-line); }
.notes-owner-card small { display: block; color: var(--notes-accent); font-size: .51rem; font-weight: 800; letter-spacing: .07em; }
.notes-owner-card strong { display: block; margin: 2px 0; color: var(--notes-ink); font-size: .88rem; }
.notes-owner-card div > span { display: flex; align-items: center; gap: 5px; font-size: .61rem; }
.notes-owner-card div > span i { width: 7px; height: 7px; border-radius: 50%; background: #15b981; box-shadow: 0 0 0 3px rgba(21, 185, 129, .12); }
.notes-owner-card div > span b { color: var(--notes-ink); }
.notes-owner-card > a { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid var(--notes-line); border-radius: 10px; color: var(--notes-accent); }
.notes-owner-card > a:hover { border-color: var(--notes-accent); }
.notes-owner-card > a .material-symbols-outlined { font-size: 18px; }

.notes-list-tools { display: flex; align-items: center; gap: 9px; }
.notes-list-tools select { min-height: 44px; padding-block: 0; padding-inline: 12px 34px; border: 1px solid var(--notes-line); border-radius: 12px; outline: 0; background: var(--notes-panel); color: var(--notes-ink); font: inherit; font-size: .7rem; }

.notes-document-grid { display: grid; gap: 17px; }
.notes-document-card { display: grid; grid-template-columns: 190px minmax(0, 1fr); min-height: 275px; overflow: hidden; border: 1px solid var(--notes-line); border-radius: 19px; background: var(--notes-panel); box-shadow: 0 9px 26px rgba(25, 37, 56, .04); }
.notes-document-cover { position: relative; display: flex; min-height: 100%; flex-direction: column; justify-content: flex-end; padding: 23px; overflow: hidden; border-inline-end: 1px solid var(--notes-line); background: linear-gradient(150deg, color-mix(in srgb, var(--notes-accent) 14%, var(--notes-panel)), var(--notes-panel)); color: var(--notes-copy); }
.notes-document-cover::before { position: absolute; width: 170px; height: 170px; top: -72px; inset-inline-end: -80px; border: 1px solid color-mix(in srgb, var(--notes-accent) 30%, transparent); border-radius: 50%; content: ""; }
.notes-document-cover > .material-symbols-outlined { position: absolute; top: 24px; inset-inline-start: 23px; color: var(--notes-accent); font-size: 32px; }
.notes-document-index { position: absolute; top: 23px; inset-inline-end: 21px; color: var(--notes-line-strong); font-size: .62rem; font-weight: 800; }
.notes-document-cover small { color: var(--notes-accent); font-size: .55rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.notes-document-cover strong { display: -webkit-box; margin: 7px 0 22px; overflow: hidden; color: var(--notes-ink); font-size: 1rem; line-height: 1.38; -webkit-box-orient: vertical; -webkit-line-clamp: 4; }
.notes-document-cover em { padding-top: 11px; border-top: 1px solid var(--notes-line); color: var(--notes-copy); font-size: .5rem; font-style: normal; font-weight: 800; letter-spacing: .12em; }
.notes-document-info { display: flex; min-width: 0; flex-direction: column; padding: 23px 25px; }
.notes-document-badges { display: flex; flex-wrap: wrap; gap: 7px; }
.notes-document-badges > span { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 999px; background: var(--notes-accent-soft); color: var(--notes-accent); font-size: .55rem; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
.notes-document-badges > span i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.notes-document-badges .is-complete { background: rgba(16, 172, 119, .1); color: #0f9e71; }
.notes-document-badges .material-symbols-outlined { font-size: 13px; }
.notes-document-info h2 { margin: 15px 0 6px; color: var(--notes-ink); font-size: 1.24rem; letter-spacing: -.026em; }
.notes-document-info > p { margin: 0; font-size: .71rem; line-height: 1.65; }
.notes-document-author { display: inline-flex; width: max-content; max-width: 100%; align-items: center; gap: 8px; margin-top: 16px; color: var(--notes-copy); }
.notes-document-author img { width: 31px; height: 31px; border: 1px solid var(--notes-line); border-radius: 9px; object-fit: cover; }
.notes-document-author small { display: block; font-size: .5rem; }
.notes-document-author strong { display: block; overflow: hidden; color: var(--notes-ink); font-size: .64rem; text-overflow: ellipsis; white-space: nowrap; }
.notes-document-author > b { padding: 4px 7px; border-radius: 999px; background: var(--notes-accent-soft); color: var(--notes-accent); font-size: .48rem; text-transform: uppercase; }
.notes-document-progress { margin-top: 15px; }
.notes-document-progress > div:first-child { display: flex; align-items: center; justify-content: space-between; font-size: .57rem; }
.notes-document-progress b { color: var(--notes-ink); }
.notes-document-actions { display: flex; align-items: center; gap: 7px; margin-top: auto; padding-top: 16px; }
.notes-document-actions > button,
.notes-document-actions > a:not(.notes-action-primary) { display: grid; width: 43px; height: 43px; padding: 0; place-items: center; border: 1px solid var(--notes-line); border-radius: 11px; background: var(--notes-panel); color: var(--notes-copy); cursor: pointer; }
.notes-document-actions > button:hover,
.notes-document-actions > a:not(.notes-action-primary):hover { border-color: var(--notes-accent); color: var(--notes-accent); }
.notes-document-actions .material-symbols-outlined { font-size: 19px; }

.notes-contribute-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 18px; margin-top: 30px; padding: 23px; border: 1px solid var(--notes-line); border-radius: 17px; background: var(--notes-panel); }
.notes-contribute-card > .material-symbols-outlined { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 14px; background: var(--notes-accent-soft); color: var(--notes-accent); }
.notes-contribute-card p { margin: 0 0 3px; color: var(--notes-accent); font-size: .54rem; font-weight: 800; letter-spacing: .08em; }
.notes-contribute-card h2 { margin: 0 0 3px; color: var(--notes-ink); font-size: .92rem; }
.notes-contribute-card div > span { font-size: .65rem; }
.notes-contribute-card > a { display: flex; align-items: center; gap: 7px; color: var(--notes-accent); font-size: .67rem; font-weight: 700; }
.notes-contribute-card > a .material-symbols-outlined { font-size: 18px; }

.notes-flow-toast { position: fixed; z-index: 80; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); max-width: min(420px, calc(100vw - 24px)); padding: 11px 15px; border: 1px solid var(--notes-line, #dfe5ed); border-radius: 11px; background: var(--notes-panel-raised, #fff); box-shadow: var(--notes-shadow, 0 18px 48px rgba(25, 37, 56, .15)); color: var(--notes-ink, #172033); font-size: .67rem; font-weight: 650; opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: opacity .18s ease, transform .18s ease; }
.notes-flow-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* PDF reader */
.note-reader-body { display: flex; height: 100dvh; min-height: 0; flex-direction: column; overflow: hidden; background: #111827; }
.note-reader-body > header { flex: 0 0 auto; }
.note-reader { display: grid; min-height: 0; flex: 1 1 auto; grid-template-rows: auto auto minmax(0, 1fr); overflow: hidden; background: var(--notes-soft); }

.reader-document-bar { display: flex; min-height: 57px; align-items: center; gap: 9px; padding: 7px clamp(10px, 2vw, 22px); border-bottom: 1px solid var(--notes-line); background: var(--notes-panel); }
.reader-icon-button,
.reader-toolbar button { display: inline-flex; min-width: 36px; min-height: 36px; align-items: center; justify-content: center; padding: 0 8px; border: 1px solid transparent; border-radius: 9px; outline: 0; background: transparent; color: var(--notes-copy); cursor: pointer; }
.reader-icon-button:hover,
.reader-toolbar button:hover { border-color: var(--notes-line); background: var(--notes-soft); color: var(--notes-ink); }
.reader-icon-button .material-symbols-outlined,
.reader-toolbar button .material-symbols-outlined { font-size: 20px; }
.reader-document-heading { min-width: 0; flex: 1; }
.reader-document-heading > span { display: block; overflow: hidden; color: var(--notes-accent); font-size: .5rem; font-weight: 800; letter-spacing: .07em; text-overflow: ellipsis; white-space: nowrap; }
.reader-document-heading h1 { margin: 1px 0 0; overflow: hidden; color: var(--notes-ink); font-size: .77rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.reader-owner { display: flex; align-items: center; gap: 7px; padding-right: 12px; border-right: 1px solid var(--notes-line); color: var(--notes-copy); }
.reader-owner img { width: 30px; height: 30px; border-radius: 9px; object-fit: cover; }
.reader-owner small,.reader-owner strong { display: block; line-height: 1.15; }
.reader-owner small { font-size: .45rem; }
.reader-owner strong { max-width: 110px; overflow: hidden; color: var(--notes-ink); font-size: .57rem; text-overflow: ellipsis; white-space: nowrap; }
.reader-owner > b { padding: 3px 5px; border-radius: 999px; background: var(--notes-accent-soft); color: var(--notes-accent); font-size: .42rem; }
.reader-save-state { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 999px; background: var(--notes-soft); color: var(--notes-copy); font-size: .52rem; font-weight: 600; }
.reader-save-state .material-symbols-outlined { color: #12a878; font-size: 15px; }
.reader-save-state.is-pending .material-symbols-outlined { color: #d99416; }
.reader-mobile-more { display: none; }

.reader-toolbar { display: flex; min-height: 49px; align-items: center; gap: 9px; padding: 5px clamp(10px, 2vw, 22px); border-bottom: 1px solid var(--notes-line); background: var(--notes-panel-raised); }
.reader-toolbar-group { display: flex; align-items: center; gap: 2px; }
.reader-toolbar-group + .reader-toolbar-group { padding-left: 9px; border-left: 1px solid var(--notes-line); }
.reader-toolbar-end { margin-left: auto; }
.reader-page-field { display: flex; min-height: 34px; align-items: center; gap: 5px; padding: 0 7px; border: 1px solid var(--notes-line); border-radius: 8px; color: var(--notes-copy); font-size: .58rem; }
.reader-page-field input { width: 39px; border: 0; outline: 0; background: transparent; color: var(--notes-ink); font: inherit; font-size: .63rem; font-weight: 650; text-align: center; appearance: textfield; }
.reader-page-field input::-webkit-inner-spin-button { appearance: none; }
.reader-page-field b { color: var(--notes-ink); }
.reader-toolbar .reader-zoom-value { min-width: 74px; font-size: .56rem; font-weight: 650; }
.reader-control-label { margin-left: 5px; font-size: .56rem; font-weight: 650; }
.reader-toolbar button.is-active { border-color: color-mix(in srgb, var(--notes-accent) 40%, var(--notes-line)); background: var(--notes-accent-soft); color: var(--notes-accent); }
.reader-toolbar button:disabled { cursor: default; opacity: .38; }

.reader-workspace { display: grid; min-height: 0; grid-template-columns: 238px minmax(0, 1fr); overflow: hidden; }
.reader-workspace.sidebar-closed { grid-template-columns: 0 minmax(0, 1fr); }
.reader-sidebar { min-width: 0; overflow: hidden; border-right: 1px solid var(--notes-line); background: var(--notes-panel); transition: transform .2s ease, opacity .2s ease; }
.reader-workspace.sidebar-closed .reader-sidebar { pointer-events: none; opacity: 0; transform: translateX(-100%); }
.reader-sidebar-tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--notes-line); }
.reader-sidebar-tabs button { display: flex; min-width: 0; min-height: 52px; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--notes-copy); font: inherit; font-size: .47rem; cursor: pointer; }
.reader-sidebar-tabs button .material-symbols-outlined { font-size: 18px; }
.reader-sidebar-tabs button[aria-selected="true"] { border-bottom-color: var(--notes-accent); color: var(--notes-accent); }
.reader-sidebar-panel { display: none; height: calc(100% - 52px); overflow: auto; }
.reader-sidebar-panel.is-active { display: block; }
.reader-panel-empty { padding: 24px 18px; font-size: .62rem; line-height: 1.6; text-align: center; }

.reader-thumbnail-list { display: grid; gap: 14px; padding: 14px; }
.reader-thumbnail { display: grid; grid-template-columns: 68px minmax(0, 1fr); align-items: center; gap: 11px; width: 100%; padding: 8px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--notes-copy); font: inherit; text-align: left; cursor: pointer; }
.reader-thumbnail:hover { background: var(--notes-soft); }
.reader-thumbnail.is-active { border-color: color-mix(in srgb, var(--notes-accent) 44%, var(--notes-line)); background: var(--notes-accent-soft); color: var(--notes-accent); }
.reader-thumbnail-canvas { display: grid; width: 68px; height: 88px; place-items: center; overflow: hidden; border: 1px solid var(--notes-line); border-radius: 4px; background: #fff; box-shadow: 0 4px 10px rgba(20, 29, 44, .11); }
.reader-thumbnail-canvas canvas { display: block; max-width: 100%; max-height: 100%; }
.reader-thumbnail span { font-size: .58rem; font-weight: 650; }
.reader-thumbnail small { display: block; margin-top: 3px; color: var(--notes-copy); font-size: .48rem; }

.reader-outline-list,.reader-bookmark-list { padding: 10px; }
.reader-outline-list button,.reader-bookmark-list button { display: flex; width: 100%; align-items: center; gap: 8px; padding: 10px; border: 0; border-radius: 9px; background: transparent; color: var(--notes-copy); font: inherit; font-size: .59rem; line-height: 1.45; text-align: left; cursor: pointer; }
.reader-outline-list button:hover,.reader-bookmark-list button:hover { background: var(--notes-soft); color: var(--notes-ink); }
.reader-outline-list button[data-depth="1"] { padding-left: 20px; }
.reader-outline-list button[data-depth="2"] { padding-left: 30px; }
.reader-bookmark-list .material-symbols-outlined { color: var(--notes-accent); font-size: 17px; }

.reader-stage { position: relative; display: grid; min-width: 0; min-height: 0; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; background: #dfe4eb; }
[data-theme="dark"] .reader-stage { background: #070d17; }
.reader-search-panel { display: flex; min-height: 47px; align-items: center; gap: 7px; padding: 6px 12px; border-bottom: 1px solid var(--notes-line); background: var(--notes-panel); }
.reader-search-panel > .material-symbols-outlined { color: var(--notes-copy); font-size: 19px; }
.reader-search-panel input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--notes-ink); font: inherit; font-size: .68rem; }
.reader-search-panel > span:not(.material-symbols-outlined) { min-width: 70px; font-size: .53rem; text-align: right; }
.reader-search-panel button { display: grid; width: 31px; height: 31px; padding: 0; place-items: center; border: 1px solid var(--notes-line); border-radius: 8px; background: var(--notes-panel); color: var(--notes-copy); cursor: pointer; }
.reader-search-panel button:hover { color: var(--notes-accent); }
.reader-search-panel button .material-symbols-outlined { font-size: 18px; }

.reader-scroller { position: relative; min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; outline: 0; scrollbar-gutter: stable; }
.reader-page-shell { min-width: max-content; min-height: 100%; padding: clamp(18px, 3vw, 38px); }
.reader-page { --scale-factor: 1; --user-unit: 1; --total-scale-factor: calc(var(--scale-factor) * var(--user-unit)); position: relative; width: max-content; height: max-content; margin: 0 auto; overflow: hidden; background: #fff; box-shadow: 0 12px 38px rgba(10, 19, 33, .25); }
.reader-page canvas { display: block; }

.pdf-text-layer { --min-font-size: 1; --text-scale-factor: calc(var(--total-scale-factor) * var(--min-font-size)); --min-font-size-inv: calc(1 / var(--min-font-size)); position: absolute; inset: 0; z-index: 2; overflow: clip; color-scheme: only light; line-height: 1; letter-spacing: normal; word-spacing: normal; opacity: 1; text-align: initial; text-size-adjust: none; transform-origin: 0 0; forced-color-adjust: none; caret-color: CanvasText; }
.pdf-text-layer :is(span, br) { position: absolute; margin: 0; padding: 0; color: transparent; white-space: pre; cursor: text; transform-origin: 0 0; user-select: text; }
.pdf-text-layer > :not(.markedContent),
.pdf-text-layer .markedContent span:not(.markedContent) { z-index: 1; --font-height: 0; --scale-x: 1; --rotate: 0deg; font-size: calc(var(--text-scale-factor) * var(--font-height)); transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv)); }
.pdf-text-layer .markedContent { display: contents; }
.pdf-text-layer span[role="img"] { cursor: default; user-select: none; }
.pdf-text-layer[data-main-rotation="90"] { transform: rotate(90deg) translateY(-100%); }
.pdf-text-layer[data-main-rotation="180"] { transform: rotate(180deg) translate(-100%, -100%); }
.pdf-text-layer[data-main-rotation="270"] { transform: rotate(270deg) translateX(-100%); }
.pdf-text-layer .endOfContent { position: absolute; display: block; inset: 100% 0 0; z-index: 0; cursor: default; user-select: none; }
.pdf-text-layer span::selection { background: rgba(46, 126, 255, .34); }
.pdf-text-layer span.is-search-hit { border-radius: 2px; background: rgba(255, 195, 32, .45); }
.pdf-text-layer span.is-current-hit { background: rgba(255, 133, 25, .58); }

.reader-loading-state,.reader-error-state { position: absolute; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 28px; background: var(--notes-soft); text-align: center; }
.reader-loading-mark { display: grid; width: 58px; height: 58px; place-items: center; border: 1px solid var(--notes-line); border-radius: 18px; background: var(--notes-panel); box-shadow: var(--notes-shadow); animation: reader-pulse 1.5s ease-in-out infinite; }
.reader-loading-mark img { width: 34px; height: 34px; object-fit: contain; }
.reader-loading-state h2,.reader-error-state h2 { margin: 18px 0 5px; color: var(--notes-ink); font-size: 1rem; }
.reader-loading-state p,.reader-error-state p { margin: 0; font-size: .65rem; }
.reader-loading-track { width: min(280px, 80%); height: 4px; margin-top: 18px; overflow: hidden; border-radius: 999px; background: var(--notes-line); }
.reader-loading-track i { display: block; width: 8%; height: 100%; border-radius: inherit; background: var(--notes-accent); transition: width .2s ease; }
.reader-error-state > .material-symbols-outlined { display: grid; width: 58px; height: 58px; place-items: center; border-radius: 18px; background: rgba(231, 67, 84, .1); color: #e74354; font-size: 30px; }
.reader-error-state div { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.reader-error-state button,.reader-error-state a { min-height: 39px; padding: 9px 13px; border: 1px solid var(--notes-line); border-radius: 9px; background: var(--notes-panel); color: var(--notes-ink); font: inherit; font-size: .62rem; font-weight: 650; cursor: pointer; }
.reader-error-state button { border-color: var(--notes-accent); background: var(--notes-accent); color: #fff; }

.reader-footer-status { display: grid; min-height: 29px; grid-template-columns: minmax(90px, 160px) auto 1fr; align-items: center; gap: 10px; padding: 5px 12px; border-top: 1px solid var(--notes-line); background: var(--notes-panel); font-size: .49rem; }
.reader-progress-track { height: 3px; overflow: hidden; border-radius: 999px; background: var(--notes-line); }
.reader-progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--notes-accent); transition: width .2s ease; }
#reader-keyboard-hint { justify-self: end; }
#reader-keyboard-hint kbd { min-width: 17px; padding: 1px 4px; border: 1px solid var(--notes-line); border-radius: 4px; background: var(--notes-soft); color: var(--notes-ink); font: inherit; text-align: center; }

.reader-toast { position: fixed; z-index: 50; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); max-width: min(420px, calc(100vw - 24px)); padding: 10px 14px; border: 1px solid var(--notes-line); border-radius: 11px; background: var(--notes-panel-raised); box-shadow: var(--notes-shadow); color: var(--notes-ink); font-size: .65rem; opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: opacity .18s ease, transform .18s ease; }
.reader-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@keyframes reader-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.04); } }

@media (max-width: 980px) {
  .notes-flow-hero-grid { grid-template-columns: 1fr; align-items: start; }
  .notes-flow-stats { width: min(500px, 100%); min-width: 0; }
  .notes-subject-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .notes-continue-grid { grid-template-columns: 1fr; }
  .reader-owner,.reader-save-state { display: none; }
  .reader-workspace { position: relative; grid-template-columns: minmax(0, 1fr); }
  .reader-sidebar { position: absolute; z-index: 12; inset: 0 auto 0 0; width: min(300px, 84vw); box-shadow: 16px 0 34px rgba(8, 17, 29, .2); }
  .reader-workspace.sidebar-closed .reader-sidebar { transform: translateX(-105%); }
}

@media (max-width: 760px) {
  .notes-flow-hero,.notes-subject-hero { padding-block: 34px 43px; }
  .notes-flow-hero-grid,.notes-subject-hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .notes-flow-hero h1,.notes-subject-hero h1 { font-size: clamp(2.1rem, 10vw, 3rem); }
  .notes-owner-card { width: 100%; }
  .notes-section-title,.notes-section-title-tools { align-items: flex-start; flex-direction: column; gap: 14px; }
  .notes-search-field { width: 100%; }
  .notes-list-tools { width: 100%; }
  .notes-list-tools .notes-search-field { flex: 1; }
  .notes-subject-grid { grid-template-columns: 1fr; }
  .notes-document-card { grid-template-columns: 112px minmax(0, 1fr); }
  .notes-document-cover { padding: 15px; }
  .notes-document-cover > .material-symbols-outlined { top: 16px; inset-inline-start: 15px; font-size: 26px; }
  .notes-document-index { top: 16px; inset-inline-end: 14px; }
  .notes-document-cover strong { font-size: .78rem; }
  .notes-document-info { padding: 18px; }
  .notes-contribute-card { grid-template-columns: auto 1fr; }
  .notes-contribute-card > a { grid-column: 1 / -1; }
  .reader-control-label,#reader-keyboard-hint { display: none; }
  .reader-toolbar { overflow-x: auto; scrollbar-width: none; }
  .reader-toolbar::-webkit-scrollbar { display: none; }
  .reader-toolbar-group { flex: 0 0 auto; }
  .reader-toolbar-end { margin-left: 0; }
  .reader-document-bar > #reader-share,.reader-document-bar > #reader-download { display: none; }
  .reader-mobile-more { display: inline-flex; }
  .reader-document-bar.is-more-open > #reader-share,.reader-document-bar.is-more-open > #reader-download { display: inline-flex; }
  .reader-document-heading h1 { max-width: calc(100vw - 145px); }
  .reader-page-shell { padding: 14px; }
}

@media (max-width: 540px) {
  .notes-flow-stats article { padding: 15px 8px; }
  .notes-flow-stats strong { font-size: 1.15rem; }
  .notes-collection-switch { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .notes-collection-switch a { justify-content: center; padding-inline: 8px; }
  .notes-list-tools { align-items: stretch; flex-direction: column; }
  .notes-list-tools select { width: 100%; }
  .notes-document-card { grid-template-columns: 1fr; }
  .notes-document-cover { min-height: 185px; border-inline-end: 0; border-bottom: 1px solid var(--notes-line); }
  .notes-document-cover strong { max-width: 80%; font-size: 1rem; }
  .notes-document-actions .notes-action-primary { flex: 1; }
  .reader-document-bar { gap: 3px; padding-inline: 7px; }
  .reader-document-heading > span { display: none; }
  .reader-toolbar { gap: 4px; padding-inline: 7px; }
  .reader-toolbar-group + .reader-toolbar-group { padding-left: 4px; }
  .reader-zoom-controls #fit-page,.reader-zoom-controls #rotate-page { display: none; }
  .reader-footer-status { grid-template-columns: 90px auto; }
}

@media (prefers-reduced-motion: reduce) {
  .notes-flow-page *, .note-reader * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
