:root {
  color-scheme: light;

  /* Surfaces */
  --surface-0: #fafafa;
  --surface-1: #ffffff;
  --surface-2: #f4f4f5;
  --surface-3: #e4e4e7;

  /* Text */
  --text-primary: #0f0f10;
  --text-secondary: #3f3f46;
  --text-tertiary: #a1a1aa;

  /* Lines + brand */
  --border: #e4e4e7;
  --primary: #2563eb;
  --primary-foreground: #ffffff;

  /* Semantic accents */
  --accent-green: #16a34a;
  --accent-amber: #d97706;
  --accent-red: #ef4444;

  --shadow: 0 10px 30px rgba(15, 15, 16, 0.12);
  --shadow-soft: 0 1px 3px rgba(15, 15, 16, 0.08);

  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Crimson Text", Georgia, "Times New Roman", serif;

  font-family: var(--font-sans);
  background: var(--surface-2);
  color: var(--text-primary);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--surface-2);
}

#app {
  height: 100svh;
  height: 100dvh;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
  color: inherit;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

input,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-0);
  color: var(--text-primary);
  padding: 11px 14px;
  line-height: 1.4;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
}

textarea {
  resize: none;
}

.icon {
  display: block;
  flex: 0 0 auto;
}

/* ---------- App shell (device-fit flex column) ---------- */

.screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--surface-1);
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

.app-header {
  flex: 0 0 auto;
}

.app-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.app-body.no-scroll {
  overflow: hidden;
}

.tab-bar {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  border-top: 1px solid var(--border);
  background: var(--surface-1);
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
}

.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 46px;
  border-radius: 12px;
  color: var(--text-tertiary);
  font-size: 0.92rem;
  font-weight: 600;
}

.tab.active {
  background: var(--surface-2);
  color: var(--text-primary);
}

.tab .count {
  color: var(--text-tertiary);
  font-weight: 500;
}

.tab.active .count {
  color: var(--text-secondary);
}

/* ---------- Shared bits ---------- */

.eyebrow {
  margin: 0 0 2px;
  color: var(--text-tertiary);
  font-size: 0.8rem;
  font-weight: 500;
}

h1,
h2 {
  margin: 0;
  min-width: 0;
  font-weight: 700;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

h1 {
  font-size: 1.75rem;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.2rem;
}

.serif {
  font-family: var(--font-serif);
}

.status {
  margin: 10px 16px 0;
  border: 1px solid #f1d4a8;
  border-radius: 12px;
  background: #fef6e7;
  color: #92600c;
  padding: 8px 12px;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.empty-state {
  margin-top: 38px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.9rem;
}

.empty-state h2 {
  color: var(--text-secondary);
  font-size: 1.05rem;
}

.empty-state p {
  margin: 6px 0 0;
}

.primary-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 46px;
  border-radius: 14px;
  background: var(--primary);
  color: var(--primary-foreground);
  font-weight: 600;
}

.primary-btn:active {
  opacity: 0.9;
}

.primary-btn.full-width {
  width: 100%;
  margin-top: 12px;
}

.ghost-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-1);
  color: var(--text-secondary);
  font-weight: 600;
}

.ghost-btn:active {
  background: var(--surface-2);
}

.danger-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 14px;
  background: var(--surface-1);
  color: var(--accent-red);
  font-weight: 600;
}

.danger-btn:active {
  background: rgba(239, 68, 68, 0.08);
}

.icon-round {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-foreground);
}

.icon-round:active {
  transform: scale(0.95);
}

.icon-round.secondary {
  background: var(--surface-2);
  color: var(--text-secondary);
}

/* ---------- Library ---------- */

.lib-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 18px 10px;
}

.lib-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.book-list {
  padding: 4px 14px 24px;
}

.book-list-inner {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-1);
}

.book-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
}

.book-row + .book-row {
  border-top: 1px solid var(--border);
}

.book-row:active {
  background: var(--surface-2);
}

.spine {
  flex: 0 0 auto;
  width: 40px;
  height: 56px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.spine.tone-0 {
  background: #dbeafe;
}

.spine.tone-1 {
  background: #dcfce7;
}

.spine.tone-2 {
  background: #fef3c7;
}

.spine.tone-3 {
  background: #fee2e2;
}

.spine.tone-4 {
  background: #ede9fe;
}

.spine.tone-5 {
  background: #e0f2fe;
}

.book-cover {
  flex: 0 0 auto;
  display: block;
  width: 40px;
  height: 56px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  background: var(--surface-2);
}

.book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-info {
  min-width: 0;
  flex: 1;
}

.book-title {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.18rem;
  font-weight: 600;
  line-height: 1.15;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-author {
  display: block;
  margin-top: 1px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-meta {
  display: block;
  margin-top: 4px;
  color: var(--text-tertiary);
  font-size: 0.78rem;
}

.chevron {
  flex: 0 0 auto;
  color: var(--text-tertiary);
}

/* Inline add-book / manage cards */

.edit-card {
  margin: 4px 16px 8px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-0);
  padding: 16px;
}

.edit-card .card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 12px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.field {
  display: block;
  margin-bottom: 12px;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-tertiary);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.field-row {
  display: flex;
  gap: 8px;
}

.field-row > * {
  flex: 1;
}

input.serif,
textarea.serif {
  font-family: var(--font-serif);
  font-size: 1.05rem;
}

/* ---------- Book header ---------- */

.book-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px 0;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 38px;
  padding: 0 8px 0 4px;
  color: var(--primary);
  font-size: 0.95rem;
  font-weight: 500;
}

.back-btn:active {
  opacity: 0.6;
}

.manage-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  color: var(--text-secondary);
}

.manage-btn:active {
  background: var(--surface-2);
}

.book-title-block {
  padding: 2px 18px 12px;
}

.book-title-block h1 {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: 600;
}

.book-title-block .book-author {
  white-space: normal;
  font-size: 0.92rem;
}

/* ---------- Capture ---------- */

.capture {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 4px 16px 16px;
}

.capture-controls {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.page-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.page-pill:active {
  background: var(--surface-3);
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 6px;
  color: var(--text-tertiary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
}

.upload-btn:active {
  color: var(--text-secondary);
}

.upload-btn input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.viewfinder {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  border-radius: 24px;
  background: #1c1c1e;
}

#camera-video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.camera-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  color: #f4f4f5;
}

.camera-fallback strong {
  font-size: 1rem;
}

.camera-fallback span {
  color: #c7c7cc;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.camera-fallback button {
  justify-self: center;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-weight: 600;
}

.hidden {
  display: none;
}

.shutter {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.85);
}

.shutter::after {
  content: "";
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: #fff;
}

.shutter:active {
  transform: scale(0.92);
}

.shutter:disabled {
  opacity: 0.6;
}

.divider {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
  color: var(--text-tertiary);
  font-size: 0.78rem;
  font-weight: 500;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.note-btn {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-0);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 600;
}

.note-btn:active {
  background: var(--surface-2);
}

.note-btn .icon {
  color: var(--text-secondary);
}

/* ---------- Saved toast ---------- */

.toast-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(78px + env(safe-area-inset-bottom));
  z-index: 30;
  display: flex;
  justify-content: center;
  padding: 0 16px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 448px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-0);
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.toast-check {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(22, 163, 74, 0.15);
  color: var(--accent-green);
}

.toast-text {
  min-width: 0;
  flex: 1;
}

.toast-text strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast-text span {
  display: block;
  color: var(--text-tertiary);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast-add {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.82rem;
  font-weight: 600;
}

.toast-add:active {
  transform: scale(0.96);
}

.toast-del {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  color: var(--accent-red);
}

.toast-del:active {
  background: rgba(239, 68, 68, 0.1);
}

/* ---------- Bottom sheets (page pad + add-note) ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: rgba(15, 15, 16, 0.3);
}

.sheet-dismiss {
  position: absolute;
  inset: 0;
}

.sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: 92%;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  border-top-left-radius: 26px;
  border-top-right-radius: 26px;
  border-top: 1px solid var(--border);
  background: var(--surface-1);
  padding-bottom: env(safe-area-inset-bottom);
}

.grabber {
  width: 40px;
  height: 4px;
  margin: 10px auto 0;
  border-radius: 999px;
  background: rgba(15, 15, 16, 0.2);
}

.sheet-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 16px 8px;
}

.sheet-head .eyebrow {
  margin: 0;
}

.sheet-head strong {
  display: block;
  margin-top: 1px;
  font-size: 1.05rem;
  font-weight: 600;
}

.sheet-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  color: var(--text-secondary);
}

.sheet-close:active {
  background: var(--surface-2);
}

.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 16px 8px;
}

.sheet-foot {
  flex: 0 0 auto;
  display: flex;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding: 12px 16px 14px;
}

.sheet-foot .primary-btn {
  flex: 1;
}

/* Number pad */

.pad-display {
  padding: 0 16px 8px;
}

.pad-display .eyebrow {
  margin: 0;
}

.pad-display .value {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.pad-display .value.placeholder {
  color: var(--text-tertiary);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 16px;
}

.keypad button {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 54px;
  border-radius: 16px;
  background: var(--surface-2);
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--text-primary);
}

.keypad button:active {
  background: var(--surface-3);
}

.keypad .keypad-spacer {
  background: none;
}

.pad-set {
  margin: 12px 16px 4px;
}

/* Add-note sheet */

.preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-height: 220px;
  margin-bottom: 14px;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.preview img {
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
}

.sheet-field {
  margin-bottom: 16px;
}

.sheet-field textarea {
  border-radius: 16px;
}

.sheet-field textarea.serif {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.4;
}

.shimmer {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-0);
  padding: 12px 14px;
}

.shimmer .reading {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  color: var(--text-tertiary);
  font-size: 0.82rem;
  font-weight: 500;
}

.shimmer .bar {
  width: 100%;
  height: 11px;
  margin-bottom: 8px;
  border-radius: 999px;
  background: rgba(15, 15, 16, 0.08);
  animation: pulse 1.4s ease-in-out infinite;
}

.shimmer .bar-wide {
  width: 92%;
}

.shimmer .bar-short {
  width: 68%;
}

.shimmer .bar:last-child {
  margin-bottom: 0;
}

.spin {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

/* ---------- Entries ---------- */

.entries {
  padding: 8px 14px 24px;
}

.entries-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 2px 12px;
  color: var(--text-tertiary);
  font-size: 0.78rem;
}

.sort-pill {
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
}

.sort-pill.active {
  background: var(--text-primary);
  color: var(--surface-1);
}

.group-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 22px 2px 8px;
  color: var(--text-tertiary);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.group-label .icon {
  color: var(--accent-amber);
}

.entry-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.entry-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-1);
}

.entry-head {
  width: 100%;
  text-align: left;
  padding: 13px 14px;
}

.entry-head:active {
  background: var(--surface-2);
}

.entry-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.entry-meta-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.page-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
}

.page-badge.uncat {
  background: rgba(217, 119, 6, 0.15);
  color: var(--accent-amber);
}

.entry-kind {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-tertiary);
  font-size: 0.72rem;
}

.entry-time {
  flex: 0 0 auto;
  color: var(--text-tertiary);
  font-size: 0.72rem;
}

.entry-body {
  display: flex;
  gap: 12px;
}

.entry-thumb {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 60px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-tertiary);
  overflow: hidden;
}

.entry-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.entry-text {
  min-width: 0;
  flex: 1;
}

.entry-passage {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.35;
  color: var(--text-primary);
}

.entry-empty {
  font-size: 0.82rem;
  font-style: italic;
  color: var(--text-tertiary);
}

.entry-note {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.35;
}

.entry-note .note-tag {
  display: block;
  margin-bottom: 2px;
  color: var(--text-tertiary);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.entry-reading {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--accent-amber);
  font-size: 0.85rem;
  font-weight: 500;
}

.entry-actions {
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--border);
  background: var(--surface-0);
  padding: 9px 14px;
}

.entry-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
}

.entry-action:active {
  opacity: 0.7;
}

.entry-action.delete {
  margin-left: auto;
  background: none;
  color: var(--accent-red);
}

.entry-action.delete:active {
  background: rgba(239, 68, 68, 0.1);
}

/* ---------- Auth ---------- */

.auth {
  justify-content: flex-start;
  padding: 24px 22px calc(24px + env(safe-area-inset-bottom));
  overflow-y: auto;
}

.auth-inner {
  width: 100%;
  max-width: 360px;
  margin: auto;
}

.auth-head {
  margin-bottom: 20px;
}

.auth-head .eyebrow {
  margin-bottom: 4px;
}

.auth-head h1 {
  font-size: 2rem;
}

.auth-switch {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  border-radius: 14px;
  background: var(--surface-2);
}

.auth-switch-btn {
  flex: 1;
  min-height: 44px;
  border-radius: 10px;
  color: var(--text-tertiary);
  font-size: 0.92rem;
  font-weight: 600;
}

.auth-switch-btn[aria-pressed="true"] {
  background: var(--surface-1);
  color: var(--text-primary);
  box-shadow: var(--shadow-soft);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-error {
  margin: 0;
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.08);
  color: var(--accent-red);
  padding: 9px 12px;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.auth-links {
  margin: 14px 0 0;
  text-align: center;
  font-size: 0.82rem;
}

.auth-links a {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-page {
  min-height: 100dvh;
  background: var(--surface-1);
  color: var(--text-primary);
  padding: 28px 22px 48px;
}

.legal-page main {
  max-width: 680px;
  margin: 0 auto;
}

.legal-page h1 {
  margin-bottom: 14px;
  font-family: var(--font-serif);
  font-size: 2rem;
}

.legal-page h2 {
  margin-top: 24px;
  font-size: 1rem;
}

.legal-page p,
.legal-page li {
  color: var(--text-secondary);
  line-height: 1.55;
}

.legal-page a {
  color: var(--primary);
}
