@layer surfaces {

/* Library lists projects (project-level sync). The project title reads a touch heavier than meta. */
.project-row .document-row-title a {
  font-weight: 600;
}

.auth-page {
  max-width: 24rem;
  margin: 12vh auto 0;
}

/* Parked landing — the public front door for the invite-only beta (HomeController#index). */
.landing {
  max-width: 34rem;
  margin: 14vh auto 0;
  text-align: center;
}

.landing-mark {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--c-ink);
}

.landing-headline {
  margin: 1.5rem 0 0.75rem;
  font-size: 1.5rem;
  line-height: 1.25;
  color: var(--c-ink);
}

.landing-sub {
  margin: 0 auto;
  max-width: 30rem;
  color: var(--c-gray-600);
  line-height: 1.6;
}

.landing-actions {
  margin: 1.75rem 0 0;
}

.landing-note {
  margin: 1.75rem 0 0;
  color: var(--c-gray-600);
  font-size: 0.9375rem;
}

.landing-fineprint {
  margin: 0.5rem auto 0;
  max-width: 30rem;
  color: var(--c-gray-500);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.auth-header {
  margin-bottom: 1.5rem;
}

.auth-form {
  display: grid;
  gap: 1rem;
}

.auth-field {
  display: grid;
  gap: 0.35rem;
}

.auth-field label {
  color: var(--c-gray-700);
  font-size: 0.875rem;
}

.auth-field input {
  width: 100%;
  border: 1px solid var(--c-gray-300);
  border-radius: 4px;
  padding: 0.6rem 0.7rem;
}

.auth-field input:focus {
  border-color: var(--c-gray-900);
  outline: 2px solid transparent;
}

.auth-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.25rem;
}

.editor-page {
  max-width: 72rem;
  margin: 0 auto;
}

.documents-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

/* The sync widget lives in the status bar (the ambient-state strip at the editor's foot):
   durability/sync state is continuous, glanceable info, not header chrome. The conflict
   banner is the exception — actionable, so it pops above the bar instead of living in it. */
.editor-statusbar-sync {
  position: relative;
  display: flex;
  align-items: center;
}

.document-sync-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.document-sync-conflict-banner {
  position: absolute;
  bottom: calc(100% + 0.75rem);
  left: 0;
  z-index: 30;
  width: max-content;
  max-width: 28rem;
  border: 1px solid var(--c-danger-200);
  border-radius: 6px;
  background: var(--c-danger-50);
  padding: 0.75rem;
  box-shadow: 0 4px 16px var(--c-shadow);
}

.document-sync-conflict-message {
  color: var(--c-danger-900);
  font-size: 0.875rem;
  font-weight: 600;
}

/* Local-vs-server comparison inside the conflict banner. The banner is
   absolutely positioned, so the expanded panes grow the overlay, never the
   topbar; each pane scrolls internally. */
.document-conflict-preview {
  margin: 0.5rem 0;
}

.document-conflict-preview-summary {
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--c-danger-800);
}

.document-conflict-preview-note {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  color: var(--c-gray-600);
}

.document-conflict-preview-pane {
  margin-top: 0.5rem;
}

.document-conflict-preview-heading {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--c-gray-700);
  margin-bottom: 0.25rem;
}

.document-conflict-preview-text {
  overflow: auto;
  max-height: 9rem;
  margin: 0;
  border: 1px solid var(--c-gray-200);
  border-radius: 6px;
  background: var(--c-white);
  color: var(--c-gray-800);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.45;
  padding: 0.5rem;
  white-space: pre-wrap;
}

.document-sync-retry-button {
  min-height: 1.75rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--c-gray-300);
  border-radius: 6px;
  background: var(--c-white);
  color: var(--c-gray-700);
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
}

/* "Needs review" resolver rows — one per held topic/annotation 409. Reuses the
   conflict-banner shell (absolute overlay) with neutral, per-record rows. */
.document-metadata-review {
  border-color: var(--c-warning-200);
  background: var(--c-warning-50);
}

.document-metadata-review .document-sync-conflict-message {
  color: var(--c-warning-900);
}

.document-metadata-review-row {
  margin-top: 0.625rem;
  padding-top: 0.625rem;
  border-top: 1px solid var(--c-warning-200);
}

.document-metadata-review-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--c-gray-800);
}

.document-metadata-review-server {
  margin: 0.125rem 0 0.375rem;
  font-size: 0.75rem;
  color: var(--c-gray-600);
}

.document-metadata-review .document-conflict-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.document-sync-retry-button:hover {
  background: var(--c-gray-100);
}

.page-title,
.document-title {
  margin: 0 0 0.5rem;
  font-size: 1.875rem;
  line-height: 1.2;
  font-weight: 300;
}

.page-subtitle {
  margin: 0;
  color: var(--c-gray-500);
  font-size: 0.875rem;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  border: 0;
  border-radius: 4px;
  background: var(--c-ink);
  color: var(--c-white);
  padding: 0.5rem 1.25rem;
  cursor: pointer;
  transition: background-color var(--t-fast);
}

.primary-button:hover {
  background: var(--c-gray-800);
}

.documents-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--c-gray-300);
  border-radius: 4px;
  background: var(--c-white);
  color: var(--c-gray-700);
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: border-color var(--t-fast), color var(--t-fast);
}

.secondary-button:hover {
  border-color: var(--c-gray-900);
  color: var(--c-gray-900);
}

.documents-status {
  margin: 0 0 0.75rem;
  min-height: 1.25rem;
  color: var(--c-gray-500);
  font-size: 0.875rem;
}

.documents-list,
.editor-blocks {
  display: grid;
  gap: 0.25rem;
}

/* The loose-notes (brain dump) section of the library — a lens, not a separate app. */
.documents-notes {
  display: grid;
  gap: 0.25rem;
  margin-top: 1.5rem;
}

.documents-notes-title {
  color: var(--c-gray-500);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
}

/* Milestone D — the promotion picker: a loose note joins a project. */
.note-row-promote {
  background: transparent;
  border: 1px solid var(--c-gray-300);
  border-radius: 6px;
  color: var(--c-gray-500);
  font-size: 0.75rem;
  padding: 0.125rem 0.375rem;
}

.secondary-link {
  color: var(--c-gray-500);
  font-size: 0.875rem;
}

.secondary-link:hover,
.secondary-link:focus-visible {
  color: var(--c-gray-900);
  outline: none;
}

.editor-surface {
  position: relative;
}

/* The trash (ADR 0011): a quiet footer lens, not a destination. Rows carry no sync state —
   local trash is indefinite, remote severance is silent, restore is exact. The only loud
   word here is "forever", and it belongs to the writer. */
.documents-trash {
  margin-top: 2.5rem;
  border-top: 1px solid var(--c-gray-200);
  padding-top: 0.75rem;
}

.documents-trash-summary {
  cursor: pointer;
  color: var(--c-gray-500);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: var(--ls-kicker);
  text-transform: uppercase;
  list-style-position: outside;
}

.documents-trash-summary:hover {
  color: var(--c-gray-700);
}

.documents-trash-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0.25rem;
  border-bottom: 1px solid var(--c-gray-100);
}

.documents-trash-title {
  font-family: var(--font-prose);
  font-size: 0.9375rem;
  color: var(--c-gray-600);
}

.documents-trash-meta {
  display: block;
  margin-top: 0.125rem;
  color: var(--c-gray-400);
  font-size: 0.75rem;
}

.documents-trash-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.documents-trash-restore,
.documents-trash-forever,
.documents-trash-empty {
  border: 1px solid var(--c-gray-300);
  border-radius: 4px;
  background: var(--c-white);
  color: var(--c-gray-700);
  cursor: pointer;
  font-size: 0.8125rem;
  padding: 0.25rem 0.5rem;
  transition: color var(--t-fast), border-color var(--t-fast);
}

.documents-trash-restore:hover {
  border-color: var(--c-accent);
  color: var(--c-accent);
}

.documents-trash-forever:hover,
.documents-trash-empty:hover {
  border-color: var(--c-danger-200);
  color: var(--c-danger-700);
}

.documents-trash-foot {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.75rem;
}

}

/* Drag a vault folder or a handful of files onto the library — the page itself is the
   drop target, so there is no zone to aim at until you are actually dragging. */
.documents-page[data-import-dropping="true"] {
  outline: 2px dashed var(--c-gray-400);
  outline-offset: -0.5rem;

/* ============================================================================
   The making of everything: the library's account-wide story. Reuses the
   project dashboard's .project-story-* classes, so there is one look and one
   voice for the same idea at three scales (document, project, library).
   ============================================================================ */

.library-story {
  margin: 0 0 1.5rem;
  padding: 0.75rem 0 0;
  border-top: 1px solid var(--c-gray-200);
}

.library-story > summary {
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--c-gray-600);
}

.library-story[open] > summary {
  margin-bottom: 1rem;
  color: var(--c-gray-800);
}

/* Shared work is labelled, not scored: the flag says whose record this is, and
   never compares one writer to another. */
.project-story-shared-flag {
  margin-left: 0.4rem;
  font-size: 0.6875rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--c-gray-500);
}

}
