:root {
  --ink: #1f2933;
  --muted: #687385;
  --paper: #f7f0df;
  --surface: rgba(255, 252, 242, 0.92);
  --line: #ded4bf;
  --accent: #bf4d28;
  --accent-dark: #8f341c;
  --sage: #6e7f62;
  --danger: #b42318;
  --shadow: 0 22px 60px rgba(63, 45, 30, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at top left, rgba(191, 77, 40, 0.16), transparent 34rem),
    linear-gradient(135deg, #fbf4e4 0%, #efe2c6 46%, #e8d7bb 100%);
  min-height: 100vh;
}

a {
  color: var(--accent-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-header {
  align-items: center;
  backdrop-filter: blur(16px);
  background: rgba(255, 252, 242, 0.78);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  color: var(--ink);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav {
  align-items: center;
  display: flex;
  gap: 1rem;
}

.page-shell {
  margin: 0 auto;
  max-width: 1440px;
  padding: clamp(1rem, 3vw, 2.5rem);
}

.hero-panel,
.reader-heading,
.auth-card,
.empty-state,
.document-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.hero-panel,
.reader-heading {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1.4rem;
  padding: clamp(1.2rem, 3vw, 2rem);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 0.95;
  margin-bottom: 0.75rem;
}

h2 {
  font-size: 1.35rem;
  margin-bottom: 0.8rem;
}

.eyebrow {
  color: var(--sage);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.auth-card {
  margin: 2rem auto;
  max-width: 520px;
  padding: clamp(1.2rem, 4vw, 2.5rem);
}

.wide-card {
  max-width: 720px;
}

.document-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.document-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 220px;
  padding: 1.4rem;
}

.card-actions {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  margin-top: 1rem;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 2rem;
  text-align: center;
}

.reader-layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
}

.pdf-pane {
  background: #2c2a26;
  border-radius: 26px;
  box-shadow: var(--shadow);
  min-height: 78vh;
  overflow: hidden;
}

.pdf-frame {
  border: 0;
  display: block;
  height: 78vh;
  width: 100%;
}

.notes-pane {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel {
  padding: 1.2rem;
}

.stack-form,
.compact-form {
  display: grid;
  gap: 0.9rem;
}

.stack-form p,
.compact-form p {
  display: grid;
  gap: 0.35rem;
  margin: 0;
}

label {
  color: var(--ink);
  font-weight: 700;
}

input,
textarea {
  background: #fffaf0;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  font: inherit;
  padding: 0.85rem 0.95rem;
  width: 100%;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(191, 77, 40, 0.14);
  outline: none;
}

.helptext,
ul.errorlist {
  color: var(--muted);
  font-size: 0.9rem;
}

ul.errorlist {
  color: var(--danger);
  margin: 0;
  padding-left: 1rem;
}

.primary-button,
.secondary-button,
.danger-button,
.link-button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  justify-content: center;
  padding: 0.72rem 1.05rem;
}

.primary-button {
  background: var(--accent);
  color: #fffaf0;
}

.secondary-button {
  background: #efe2c6;
  color: var(--ink);
}

.danger-button {
  background: rgba(180, 35, 24, 0.1);
  color: var(--danger);
}

.link-button {
  background: transparent;
  color: var(--accent-dark);
  padding-left: 0;
  padding-right: 0;
}

.inline-form {
  display: inline;
  margin: 0;
}

.messages {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.message {
  background: rgba(110, 127, 98, 0.14);
  border: 1px solid rgba(110, 127, 98, 0.3);
  border-radius: 16px;
  margin: 0;
  padding: 0.8rem 1rem;
}

.message-error {
  background: rgba(180, 35, 24, 0.12);
  border-color: rgba(180, 35, 24, 0.28);
}

.note-list {
  display: grid;
  gap: 0.8rem;
}

.note-card {
  background: #fffaf0;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem;
}

.note-meta,
.tags {
  color: var(--sage);
  font-size: 0.9rem;
  margin-bottom: 0.45rem;
}

.tags::before {
  content: "# ";
}

.danger-text {
  color: var(--danger);
}

@media (max-width: 980px) {
  .reader-layout {
    grid-template-columns: 1fr;
  }

  .pdf-pane,
  .pdf-frame {
    min-height: 62vh;
    height: 62vh;
  }
}

@media (max-width: 640px) {
  .site-header,
  .hero-panel,
  .reader-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    flex-wrap: wrap;
  }

  .card-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button,
  .secondary-button,
  .danger-button {
    width: 100%;
  }
}
