@font-face {
  font-family: Wanted;
  src: url("/fonts/WantedSansVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
:root {
  --bg: #f6f6f3;
  --surface: #fff;
  --soft: #f1f1ee;
  --text: #171716;
  --muted: #70706a;
  --line: #e7e7e2;
  --strong: #d8d8d2;
  --green: #287557;
  --red: #ab483b;
  --notes-width: 340px;
  font-family:
    Wanted,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
  font-size: 16px;
  line-height: 1.55;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-width: 320px;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  border: 0;
  background: transparent;
  white-space: nowrap;
  line-height: 1.3;
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
a {
  color: inherit;
  text-decoration: none;
}
input,
select,
textarea {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--strong);
  border-radius: 8px;
  min-height: 42px;
  padding: 9px 12px;
  font-size: 14px;
}
input:focus,
select:focus {
  border-color: var(--text);
}
:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}
button:hover:not(:disabled) {
  background: var(--soft);
}
[hidden] {
  display: none !important;
}
svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.65;
  flex-shrink: 0;
}
h1,
h2,
p {
  margin: 0;
}
h1 {
  font-size: 28px;
  font-weight: 660;
  letter-spacing: -0.8px;
  line-height: 1.3;
}
h2 {
  font-size: 17px;
  font-weight: 640;
  letter-spacing: -0.35px;
}
.muted {
  color: var(--muted);
}
.icon {
  width: 36px;
  height: 36px;
  border-radius: 7px;
  flex-shrink: 0;
}
.primary,
.secondary {
  height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 560;
}
.primary {
  background: var(--text);
  color: #fff;
}
.primary:hover:not(:disabled) {
  background: #353532;
}
.secondary {
  border: 1px solid var(--strong);
  background: var(--surface);
}
.danger {
  color: var(--red);
}
.text-button {
  font-size: 14px;
  padding: 6px 0;
  white-space: normal;
}
.text-button:hover:not(:disabled) {
  background: none;
  text-decoration: underline;
}
.active {
  color: var(--green);
  background: #edf5f1;
}
.skip {
  position: fixed;
  left: 16px;
  top: -80px;
  z-index: 100;
  background: white;
  padding: 12px;
}
.skip:focus {
  top: 12px;
}
.brand {
  display: inline-flex;
  align-items: center;
  font-size: 16px;
  font-weight: 680;
  letter-spacing: -0.45px;
  gap: 16px;
  white-space: nowrap;
}
.brand > span:last-child {
  font-weight: 500;
  color: var(--muted);
}
.brand-divider,
.vertical-line {
  height: 18px;
  width: 1px;
  background: var(--strong);
  flex-shrink: 0;
}
.auth-view {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.auth-header {
  height: 88px;
  padding: 0 48px;
  display: flex;
  align-items: center;
}
.auth-card {
  width: min(100% - 40px, 376px);
  margin: auto;
  padding: 42px 0 56px;
}
.auth-mark {
  height: 44px;
  width: 44px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 24px;
}
.auth-mark svg {
  width: 23px;
  height: 23px;
}
.auth-card h1 {
  font-size: 26px;
}
.auth-description {
  font-size: 14px;
  color: var(--muted);
  margin-top: 12px;
  margin-bottom: 32px;
}
.auth-card form {
  display: grid;
  gap: 20px;
}
label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  font-weight: 550;
}
label input {
  width: 100%;
  font-weight: 450;
  height: 46px;
}
.password-input {
  position: relative;
  display: flex;
}
.password-input input {
  padding-right: 48px;
}
.password-input button {
  position: absolute;
  right: 5px;
  top: 5px;
}
.field-hint {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}
.auth-submit {
  width: 100%;
  height: 46px;
  margin-top: 4px;
}
.auth-links {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-top: 24px;
}
.auth-links button {
  font-size: 13px;
}
.auth-footer {
  padding: 26px 48px;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
}
.form-error {
  color: var(--red);
  font-size: 14px;
  padding: 10px 12px;
  background: #fbf0ee;
  border-radius: 7px;
}
.app-header {
  height: 76px;
  border-bottom: 1px solid var(--line);
  padding: 0 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
}
.account-button {
  font-size: 14px;
  border-radius: 8px;
  padding: 6px 8px;
  max-width: 240px;
}
.account-button > span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-button > svg {
  width: 16px;
}
.avatar {
  width: 30px;
  height: 30px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 650;
  flex-shrink: 0;
}
.workspace {
  display: flex;
  min-height: calc(100dvh - 76px);
}
.sidebar {
  width: 216px;
  flex-shrink: 0;
  padding: 28px 16px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}
.sidebar nav {
  display: grid;
  gap: 6px;
}
.nav-button {
  justify-content: flex-start;
  padding: 0 16px;
  height: 44px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--muted);
}
.nav-button.active {
  background: #eaeae5;
  color: var(--text);
  font-weight: 580;
}
.sidebar-bottom {
  margin-top: auto;
  padding: 40px 12px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}
.sidebar-bottom svg {
  width: 16px;
}
.library {
  width: 100%;
  min-width: 0;
  max-width: 1440px;
  padding: 44px 44px 64px;
  margin: 0 auto;
  align-self: flex-start;
}
.library-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
}
.heading-actions {
  display: flex;
  gap: 8px;
}
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.breadcrumbs:empty {
  display: none;
}
.breadcrumbs button {
  font-size: 13px;
  padding: 0;
}
.breadcrumbs svg {
  width: 13px;
  height: 13px;
}
.library-controls {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 28px;
}
.search-field {
  position: relative;
  max-width: 360px;
  width: 100%;
}
.search-field svg {
  position: absolute;
  left: 12px;
  top: 12px;
  width: 18px;
  height: 18px;
  color: var(--muted);
}
.search-field input {
  width: 100%;
  padding-left: 40px;
  background: transparent;
  border-color: var(--line);
}
.library-controls select {
  margin-left: auto;
  background: transparent;
  border-color: var(--line);
  width: 144px;
}
.section-line {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding: 20px 0 18px;
  font-size: 13px;
  color: var(--muted);
}
.document-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 24px 20px;
}
.document-card {
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.document-card:hover {
  border-color: #bdbdb6;
}
.document-open {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0;
  white-space: normal;
}
.document-open:hover:not(:disabled) {
  background: transparent;
}
.cover {
  height: 210px;
  background: #edede8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.cover img {
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  box-shadow: 0 2px 5px #17171616;
  background: #fff;
}
.card-text {
  padding: 16px 16px 10px;
  display: block;
}
.card-text strong {
  font-size: 15px;
  font-weight: 600;
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  padding-right: 14px;
  line-height: 1.45;
}
.card-preview {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: block;
  margin-top: 7px;
  min-height: 20px;
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 12px 16px;
  color: var(--muted);
  font-size: 12px;
  justify-content: space-between;
}
.card-meta > .icon {
  width: 28px;
  height: 28px;
}
.card-meta > .icon svg {
  width: 18px;
}
.reading-progress {
  height: 2px;
  background: #f0f0ec;
}
.reading-progress span {
  display: block;
  height: 100%;
  background: #a4b7a9;
}
.empty-state {
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 40px 20px;
  gap: 12px;
}
.empty-state > svg {
  width: 32px;
  height: 32px;
  color: #92928b;
  margin-bottom: 8px;
}
.empty-state h2 {
  font-size: 18px;
}
.empty-state p {
  color: var(--muted);
  font-size: 14px;
  max-width: 340px;
  line-height: 1.8;
}
.empty-state button {
  margin-top: 12px;
}
.load-more {
  display: flex;
  margin: 32px auto 0;
}
.upload-progress {
  padding: 14px 16px;
  background: #edf5f1;
  border: 1px solid #d7e8de;
  border-radius: 8px;
  font-size: 14px;
  color: var(--green);
  margin-bottom: 20px;
}
.library.drag-over {
  outline: 2px dashed var(--green);
  outline-offset: -10px;
  background: #edf5f155;
}
.reader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.reader-header {
  height: 68px;
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.reader-title {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.reader-title strong {
  font-size: 15px;
  font-weight: 590;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reader-title > span {
  font-size: 12px;
  color: var(--muted);
}
.reader-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.save-button {
  font-size: 12px;
  color: var(--muted);
  padding: 8px;
  border-radius: 6px;
}
.save-button svg {
  width: 15px;
  height: 15px;
}
.save-button.error {
  color: var(--red);
  background: #fbf0ee;
}
.reader-body {
  display: flex;
  flex: 1;
  min-height: 0;
  min-width: 0;
}
.pdf-area {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  position: relative;
}
.pdf-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 32px;
  position: relative;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.page-stage {
  position: relative;
  background: #fff;
  box-shadow: 0 2px 12px #1717160d;
  margin: 0 auto;
  flex-shrink: 0;
}
.page-stage > canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}
#pdf-canvas {
  z-index: 0;
}
#ink-canvas {
  z-index: 2;
  pointer-events: none;
  touch-action: none;
}
.page-stage.drawing #ink-canvas {
  pointer-events: auto;
  cursor: crosshair;
}
.page-stage.drawing .textLayer {
  pointer-events: none;
}
.render-status {
  position: absolute;
  left: 50%;
  top: 48px;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
  z-index: 5;
  white-space: nowrap;
}
.textLayer {
  position: absolute;
  inset: 0;
  overflow: clip;
  opacity: 1;
  line-height: 1;
  text-align: initial;
  text-size-adjust: none;
  forced-color-adjust: none;
  transform-origin: 0 0;
  z-index: 1;
  caret-color: CanvasText;
}
.textLayer :is(span, br) {
  color: transparent;
  position: absolute;
  white-space: pre;
  cursor: text;
  transform-origin: 0 0;
}
.textLayer span.markedContent {
  top: 0;
  height: 0;
}
.textLayer ::selection {
  background: #28755740;
}
.textLayer br::selection {
  background: transparent;
}
.drawing-toolbar {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  align-self: center;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  margin: 12px 12px 0;
  max-width: calc(100% - 24px);
}
.tool-group {
  display: flex;
  gap: 2px;
}
.drawing-toolbar .icon {
  width: 34px;
  height: 34px;
}
.drawing-toolbar .icon svg {
  width: 18px;
  height: 18px;
}
.drawing-toolbar select {
  border: 0;
  width: 66px;
  padding: 4px;
  font-size: 13px;
  min-height: 34px;
  height: 34px;
  background: transparent;
}
.color-label {
  height: 34px;
  width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.color-label input {
  border: 0;
  padding: 4px;
  width: 28px;
  height: 28px;
  min-height: 0;
  cursor: pointer;
  background: none;
}
.color-label input::-webkit-color-swatch-wrapper {
  padding: 0;
}
.color-label input::-webkit-color-swatch {
  border: 0;
  border-radius: 50%;
}
.page-navigation {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 24px 16px;
}
.page-controls,
.zoom-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}
.page-controls input {
  width: 48px;
  text-align: center;
  min-height: 32px;
  height: 32px;
  padding: 4px;
  border: 1px solid var(--line);
  appearance: textfield;
  -moz-appearance: textfield;
}
.page-controls input::-webkit-inner-spin-button {
  appearance: none;
}
.zoom-controls > span {
  min-width: 40px;
  text-align: center;
}
.notes-panel {
  width: var(--notes-width);
  min-width: 260px;
  max-width: 50vw;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  padding: 22px 24px 16px;
  flex-shrink: 0;
}
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  margin-bottom: 16px;
}
.panel-heading h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-heading h2 span {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}
.format-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.format-toolbar .icon {
  width: 32px;
  height: 32px;
}
.format-toolbar .icon svg {
  width: 17px;
  height: 17px;
}
.toolbar-spacer {
  flex: 1;
}
.note-editor {
  flex: 1;
  min-height: 0;
  overflow: auto;
  outline: none;
  padding: 24px 0 16px;
  font-size: 16px;
  line-height: 1.9;
  overflow-wrap: anywhere;
  scrollbar-width: thin;
}
.note-editor:focus-visible {
  outline: none;
}
.note-editor p,
.note-editor div {
  margin: 0 0 12px;
}
.note-editor h1,
.note-editor h2,
.note-editor h3 {
  font-size: 20px;
  margin: 16px 0 12px;
  font-weight: 650;
  line-height: 1.5;
}
.note-editor ul,
.note-editor ol {
  padding-left: 22px;
}
.note-editor blockquote {
  border-left: 2px solid var(--strong);
  margin-left: 0;
  padding-left: 16px;
  color: var(--muted);
}
.notes-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  color: var(--muted);
  font-size: 12px;
}
.notes-footer button {
  font-size: 12px;
}
.notes-footer svg {
  width: 14px;
  height: 14px;
}
.panel-resizer {
  width: 5px;
  cursor: col-resize;
  flex-shrink: 0;
  border-left: 1px solid var(--line);
  background: var(--surface);
}
.panel-resizer:hover,
.panel-resizer:focus {
  background: var(--strong);
}
.pdf-search {
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  padding: 8px 20px;
  background: var(--surface);
}
.pdf-search > input {
  border: none;
  flex: 1;
  max-width: 400px;
}
.pdf-search > span {
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
}
.pdf-search > svg {
  width: 18px;
  color: var(--muted);
}
.outline-panel {
  width: 260px;
  background: var(--surface);
  padding: 20px 16px;
  border-right: 1px solid var(--line);
  overflow: auto;
  flex-shrink: 0;
}
.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  gap: 12px;
  margin-bottom: 16px;
}
.tabs button {
  font-size: 13px;
  border-bottom: 2px solid transparent;
  padding: 10px 4px;
  color: var(--muted);
}
.tabs button[aria-selected="true"] {
  border-color: var(--text);
  color: var(--text);
}
.outline-list {
  display: grid;
  gap: 4px;
}
.outline-item {
  text-align: left;
  justify-content: flex-start;
  white-space: normal;
  font-size: 14px;
  padding: 10px 8px;
  border-radius: 6px;
  overflow-wrap: anywhere;
}
.outline-item > span {
  font-size: 12px;
  color: var(--muted);
  min-width: 20px;
}
.outline-empty {
  color: var(--muted);
  font-size: 14px;
  padding: 12px 4px;
}
.reader-alert {
  padding: 10px 20px;
  background: #fbf0ee;
  color: var(--red);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.reader-alert button {
  text-decoration: underline;
  color: var(--red);
  font-size: 13px;
}
dialog {
  color: var(--text);
  width: min(440px, calc(100% - 32px));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 70px #17171624;
  max-height: calc(100dvh - 40px);
  overflow: auto;
  background: var(--surface);
}
dialog::backdrop {
  background: #17171652;
  backdrop-filter: blur(2px);
}
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.dialog-heading h2 {
  min-width: 0;
  overflow-wrap: anywhere;
}
.dialog-heading .icon {
  margin: -6px -6px -6px 0;
}
.dialog-form {
  display: grid;
  gap: 18px;
}
.dialog-description {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 18px;
  overflow-wrap: anywhere;
}
.dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}
.dialog-actions button {
  min-width: 80px;
}
.menu-list {
  display: grid;
  gap: 4px;
}
.menu-list button {
  justify-content: flex-start;
  padding: 12px;
  border-radius: 7px;
  font-size: 14px;
}
.menu-list button > span {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  white-space: normal;
  text-align: left;
}
.menu-list small {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
  line-height: 1.6;
}
.recovery-code {
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 8px;
  word-break: break-all;
  font-family: monospace;
  font-size: 17px;
  user-select: all;
  margin: 16px 0;
}
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  padding: 12px 20px;
  border-radius: 9px;
  z-index: 100;
  box-shadow: 0 4px 20px #0002;
  font-size: 14px;
  max-width: calc(100% - 32px);
  width: max-content;
  white-space: normal;
}
.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  font-size: 18px;
  color: var(--muted);
}
.history-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  white-space: normal;
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  gap: 8px;
  width: 100%;
  font-size: 14px;
}
.history-item small {
  color: var(--muted);
  font-size: 12px;
}
.error-block {
  padding: 24px;
  border: 1px solid #eccac5;
  background: #fbf0ee;
  border-radius: 8px;
  color: var(--red);
  font-size: 14px;
  grid-column: 1/-1;
}
@media (min-width: 1500px) {
  .document-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .cover {
    height: 240px;
  }
}
@media (max-width: 1100px) {
  .library {
    padding: 32px 28px;
  }
  .sidebar {
    width: 184px;
  }
  .sidebar .nav-button {
    padding: 0 12px;
  }
  .notes-panel {
    width: 300px;
    padding: 18px;
  }
  .reader-header {
    gap: 8px;
    padding: 0 12px;
  }
  .reader-title > span {
    display: none;
  }
  .outline-panel {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 8;
    box-shadow: 8px 0 20px #17171610;
  }
  .reader-body {
    position: relative;
  }
  .pdf-scroll {
    padding: 24px;
  }
  .save-button span {
    display: none;
  }
}
@media (max-width: 800px) {
  .app-header {
    padding: 0 20px;
    height: 64px;
  }
  .workspace {
    min-height: calc(100dvh - 64px);
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    padding: 12px 20px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .sidebar nav {
    display: flex;
    gap: 4px;
  }
  .nav-button {
    height: 38px;
    font-size: 13px;
    padding: 0 12px;
  }
  .nav-button svg {
    width: 17px;
    height: 17px;
  }
  .sidebar-bottom {
    display: none;
  }
  .library {
    padding: 28px 20px;
  }
  .library-heading h1 {
    font-size: 25px;
  }
  .reader-body {
    flex-direction: column;
  }
  .pdf-area {
    min-height: 200px;
  }
  .notes-panel {
    width: 100%;
    max-width: none;
    min-width: 0;
    height: 34%;
    min-height: 180px;
    padding: 10px 20px 8px;
    border-top: 1px solid var(--line);
    position: relative;
  }
  .notes-panel > .panel-heading {
    margin-bottom: 6px;
    height: 32px;
    min-height: 32px;
  }
  .notes-panel > .panel-heading h2 {
    font-size: 15px;
  }
  .format-toolbar {
    position: absolute;
    top: 10px;
    left: 110px;
    right: 58px;
    height: 32px;
    border: 0;
    padding: 0;
    gap: 0;
    justify-content: flex-end;
  }
  .format-toolbar > .toolbar-spacer {
    flex: 0;
  }
  .format-toolbar > .icon {
    width: 30px;
    height: 30px;
  }
  .format-toolbar > .vertical-line {
    margin: 0 3px;
  }
  .note-editor {
    padding: 8px 0;
    font-size: 15px;
    line-height: 1.7;
  }
  .notes-footer {
    padding-top: 4px;
    min-height: 24px;
  }
  .notes-footer button {
    padding: 2px;
  }
  .panel-resizer {
    display: none;
  }
  .reader-header {
    height: 58px;
    min-height: 58px;
    padding: 0 8px;
    gap: 6px;
  }
  .reader-actions {
    gap: 0;
  }
  .reader-actions > .secondary {
    height: 36px;
    padding: 0 9px;
    border: 0;
  }
  .reader-actions > .secondary span {
    display: none;
  }
  .reader-header > .vertical-line {
    display: none;
  }
  .reader-title strong {
    font-size: 14px;
  }
  .reader-header > .save-button {
    padding: 4px;
  }
  .page-navigation {
    padding: 6px 12px 8px;
  }
  .drawing-toolbar {
    margin-top: 8px;
    padding: 3px;
    gap: 4px;
  }
  .pdf-scroll {
    padding: 16px;
  }
  .pdf-search {
    padding: 4px 8px;
  }
  .pdf-search > input {
    width: 80px;
    min-width: 60px;
  }
  .pdf-search > span {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .pdf-search .icon {
    width: 30px;
  }
  .reader-alert {
    padding: 8px 12px;
    font-size: 12px;
  }
}
@media (max-width: 480px) {
  .auth-header {
    padding: 0 24px;
    height: 72px;
  }
  .auth-footer {
    padding: 20px 24px;
  }
  .brand {
    gap: 12px;
    font-size: 15px;
  }
  .app-header {
    padding: 0 16px;
  }
  .account-button > span:nth-child(2) {
    display: none;
  }
  .sidebar {
    padding: 10px 12px;
  }
  .sidebar .nav-button {
    padding: 0 10px;
    font-size: 13px;
  }
  .library {
    padding: 24px 16px 40px;
  }
  .library-heading {
    gap: 8px;
    margin-bottom: 24px;
  }
  .library-heading h1 {
    font-size: 23px;
  }
  .heading-actions {
    gap: 6px;
  }
  .heading-actions > .secondary {
    width: 38px;
    padding: 0;
  }
  .heading-actions > .secondary span {
    display: none;
  }
  .heading-actions > .primary {
    height: 38px;
    padding: 0 12px;
    font-size: 13px;
  }
  .library-controls {
    gap: 8px;
    margin-bottom: 20px;
  }
  .library-controls select {
    width: 120px;
    font-size: 13px;
    padding: 8px;
  }
  .search-field input {
    font-size: 13px;
    padding-left: 34px;
  }
  .search-field svg {
    left: 10px;
    width: 16px;
  }
  .document-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 12px;
  }
  .cover {
    height: 166px;
    padding: 14px;
  }
  .card-text {
    padding: 12px 12px 8px;
  }
  .card-text strong {
    font-size: 14px;
    padding: 0;
  }
  .card-preview {
    font-size: 12px;
  }
  .card-meta {
    padding: 0 8px 8px 12px;
    font-size: 11px;
    gap: 2px;
  }
  .card-meta > .card-date {
    display: none;
  }
  .section-line {
    font-size: 12px;
  }
  .reader-actions .icon {
    width: 32px;
  }
  .reader-header > .icon {
    width: 32px;
  }
  .reader-title strong {
    font-size: 13px;
  }
  .reader-actions .secondary {
    padding: 0 6px;
  }
  .save-button svg {
    width: 14px;
  }
  .drawing-toolbar {
    gap: 2px;
    max-width: calc(100% - 12px);
    margin-left: 6px;
    margin-right: 6px;
  }
  .drawing-toolbar .icon {
    width: 30px;
    height: 32px;
  }
  .drawing-toolbar .tool-group {
    gap: 0;
  }
  .drawing-toolbar select {
    width: 56px;
    font-size: 12px;
    padding: 2px;
  }
  .drawing-toolbar .vertical-line {
    margin: 0 1px;
  }
  .drawing-toolbar .color-label {
    width: 26px;
  }
  .page-navigation {
    padding: 4px 8px 6px;
    gap: 4px;
  }
  .page-controls,
  .zoom-controls {
    gap: 2px;
  }
  .page-navigation .icon {
    width: 30px;
    height: 32px;
  }
  .page-controls input {
    width: 40px;
  }
  .zoom-controls > span {
    min-width: 34px;
    font-size: 12px;
  }
  .notes-panel {
    padding-left: 16px;
    padding-right: 16px;
  }
  .format-toolbar {
    left: 94px;
    right: 50px;
  }
  .format-toolbar > .icon {
    width: 28px;
  }
  .notes-panel > .panel-heading h2 {
    gap: 5px;
  }
  .notes-panel > .panel-heading > button {
    width: 30px;
  }
  .notes-panel .note-editor {
    font-size: 15px;
  }
  .reader-header .save-button {
    width: 22px;
  }
  .auth-card {
    padding-top: 20px;
  }
  .auth-links {
    gap: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

.compare-block {
  margin: 16px 0;
}
.compare-block h3 {
  font-size: 13px;
  font-weight: 600;
  margin: 12px 0 6px;
}
.compare-preview {
  max-height: 100px;
  overflow: auto;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.compare-preview h1,
.compare-preview h2,
.compare-preview h3 {
  font-size: 15px;
}
.compare-preview p {
  margin: 0 0 6px;
}

/* PDF.js 5 TextLayer geometry (Apache-2.0): keep selectable text aligned with canvas. */
.textLayer {
  --min-font-size: 1;
  --scale-round-x: 0.001px;
  --scale-round-y: 0.001px;
  --text-scale-factor: calc(var(--total-scale-factor) * var(--min-font-size));
  --min-font-size-inv: calc(1 / var(--min-font-size));
}
.textLayer > :not(.markedContent),
.textLayer .markedContent span:not(.markedContent) {
  --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));
}
.textLayer .markedContent {
  display: contents;
}
.textLayer[data-main-rotation="90"] {
  transform: rotate(90deg) translateY(-100%);
}
.textLayer[data-main-rotation="180"] {
  transform: rotate(180deg) translate(-100%, -100%);
}
.textLayer[data-main-rotation="270"] {
  transform: rotate(270deg) translateX(-100%);
}
.pdf-scroll.fitted {
  overflow-x: hidden;
}

@media (min-width: 1280px) {
  .document-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Zero-width native scrollbars + positioned custom tracks: no layout gutter. */
* {
  scrollbar-width: none !important;
}
*::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
html,
.pdf-scroll,
.note-editor,
.outline-panel,
dialog,
.compare-preview,
textarea {
  scrollbar-gutter: auto;
}
.custom-scrollbar {
  position: fixed;
  z-index: 2000;
  touch-action: none;
  user-select: none;
  border-radius: 8px;
  background: transparent;
}
.custom-scrollbar-y {
  width: 8px;
}
.custom-scrollbar-x {
  height: 8px;
}
.custom-scrollbar-thumb {
  position: absolute;
  background: #a4aca0;
  border-radius: 8px;
  opacity: 0.65;
}
.custom-scrollbar-y .custom-scrollbar-thumb {
  width: 5px;
  left: 2px;
}
.custom-scrollbar-x .custom-scrollbar-thumb {
  height: 5px;
  top: 2px;
}
.custom-scrollbar:hover .custom-scrollbar-thumb,
.custom-scrollbar:focus-visible .custom-scrollbar-thumb,
.scrollbar-dragging .custom-scrollbar-thumb {
  opacity: 1;
  background: #6e7c68;
}
.custom-scrollbar:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 1px;
}
.note-editor {
  padding-right: 14px;
}
@media (forced-colors: active) {
  .custom-scrollbar-thumb {
    background: CanvasText !important;
  }
}
body {
  min-width: 0;
}
.folder-card {
  background: var(--surface);
}
.folder-card .folder-cover {
  background: #eef1e9;
}
.folder-cover > svg {
  width: 72px;
  height: 72px;
  stroke-width: 1;
  color: #819373;
}
.folder-card .card-meta {
  margin-top: auto;
}
.folder-card .document-open {
  flex: 1;
}
.section-line {
  flex-wrap: wrap;
  gap: 6px 16px;
}
.drag-handle {
  width: 24px;
  height: 28px;
  color: #92978e;
  cursor: grab;
  touch-action: none;
  flex-shrink: 0;
}
.drag-handle svg {
  width: 16px;
}
.dragging-items,
.dragging-items * {
  cursor: grabbing !important;
  user-select: none !important;
}
.is-dragging {
  opacity: 0.48;
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
.drop-inside {
  outline: 2px solid var(--green) !important;
  outline-offset: -2px;
  background: #e7efe8 !important;
}
.drop-before {
  box-shadow: -5px 0 0 var(--green);
}
.drop-after {
  box-shadow: 5px 0 0 var(--green);
}
.document-card img {
  -webkit-user-drag: none;
}
@media (forced-colors: active) {
  * {
    scrollbar-color: auto;
  }
  .drop-inside,
  .drop-before,
  .drop-after {
    outline: 3px solid Highlight !important;
  }
}
