:root {
  --bg: #f5f1ea;
  --surface: #fbf8f2;
  --surface-strong: #fffdf9;
  --surface-muted: #efe8dc;
  --border: rgba(30, 35, 41, 0.12);
  --border-strong: rgba(30, 35, 41, 0.22);
  --text: #1e2329;
  --muted: #66707b;
  --accent: #1d4d45;
  --accent-soft: #e3efe9;
  --shadow: none;
  --shadow-soft: none;
  --radius-lg: 1rem;
  --radius-md: 0.85rem;
  --radius-sm: 0.7rem;
  --catalogue-topbar-height: 0px;
  --catalogue-controls-height: 0px;
  --mobile-bottom-bar-height: 0px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #fcf9f4 0%, var(--bg) 100%);
  color: var(--text);
  font-family: "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1320px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 5rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 0.2rem 0 1rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(252, 249, 244, 0.98), rgba(245, 241, 234, 0.94));
  backdrop-filter: blur(14px);
  transition:
    padding 160ms ease,
    gap 160ms ease,
    margin-bottom 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

.brand-block,
.stack {
  display: grid;
  gap: 1rem;
}

.stack.compact {
  gap: 0.35rem;
}

.eyebrow,
.meta-line,
.section-subtitle,
.tagline,
.field label,
.meta-label {
  color: var(--muted);
}

.eyebrow.strong {
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow.strong {
  font-size: 0.76rem;
  font-weight: 700;
  transition: opacity 140ms ease, transform 140ms ease, max-height 140ms ease;
}

.brand-logo {
  height: 1.75rem;
  width: auto;
  flex-shrink: 0;
  border-radius: 50%;
}

.brand-block {
  display: grid;
  gap: 0.35rem;
}

.brand {
  color: var(--text);
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-decoration: none;
}
.brand-kicker {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.brand:hover {
  opacity: 0.9;
}

.tagline {
  margin: 0;
  max-width: 36rem;
  font-size: 0.95rem;
}

.topbar-actions,
.topbar-nav,
.topbar-utility,
.toolbar,
.inline-form,
.result-actions,
.form-actions,
.hero-header,
.hero-actions,
.toolbar-end,
.card-actions,
.filter-strip,
.detail-actions,
.detail-header {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.topbar-actions {
  justify-content: flex-end;
  gap: 1rem;
}

.topbar-nav,
.topbar-utility {
  align-items: center;
}

.topbar-utility {
  margin-left: auto;
}

.topbar-icon-button {
  min-width: 2.9rem;
  padding: 0.75rem;
}

.topbar-icon-button svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: currentColor;
}

.nav-link,
.nav-button,
.button,
.filter-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    min-height 160ms ease,
    padding 160ms ease;
}

.nav-link:hover,
.nav-button:hover,
.button:hover,
.filter-chip:hover {
  background: rgba(29, 77, 69, 0.06);
}

.button:disabled,
.nav-button:disabled,
.filter-chip:disabled,
button[disabled].button,
button[disabled].nav-button,
button[disabled].filter-chip,
input[type="submit"]:disabled,
input[type="button"]:disabled,
input[type="reset"]:disabled {
  background: color-mix(in srgb, var(--surface) 88%, #e7dfd1 12%);
  border-color: color-mix(in srgb, var(--border) 92%, transparent);
  color: color-mix(in srgb, var(--text) 62%, transparent);
  cursor: not-allowed;
  opacity: 1;
  box-shadow: none;
}

.button:disabled:hover,
.nav-button:disabled:hover,
.filter-chip:disabled:hover,
button[disabled].button:hover,
button[disabled].nav-button:hover,
button[disabled].filter-chip:hover,
input[type="submit"]:disabled:hover,
input[type="button"]:disabled:hover,
input[type="reset"]:disabled:hover {
  background: color-mix(in srgb, var(--surface) 88%, #e7dfd1 12%);
}

.nav-link.active,
.filter-chip.active,
.button.primary,
.nav-button,
.pill.strong {
  background: var(--accent);
  border-color: var(--accent);
  color: #f8fbf9;
}

.button.subtle,
.button.ghost {
  background: var(--surface-muted);
  box-shadow: none;
}

.button.danger {
  background: rgba(141, 49, 41, 0.12);
  border-color: #8d3129;
  color: #8d3129;
}

.button.danger:hover {
  background: rgba(141, 49, 41, 0.18);
  border-color: #8d3129;
  color: #74231a;
}

.nav-button {
  box-shadow: none;
}

.flash,
.card,
.hero,
.auth-card,
.form-panel,
.meta-card,
.cover-card,
.empty-state {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.hero,
.card,
.auth-card,
.form-panel {
  padding: 0;
}

.hero {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.flash {
  margin-bottom: 1rem;
  padding: 0.2rem 0 0.2rem 1rem;
  border-left: 3px solid var(--border-strong);
}

.flash.alert {
  color: #8d3129;
}

.page,
.stats,
.catalogue-controls,
.search-panel,
.form-grid,
.detail-layout,
.metadata-grid,
.lookup-results,
.shelf-grid,
.cover-grid,
.editor-layout,
.integration-list {
  display: grid;
  gap: 1rem;
}

.page {
  gap: 2rem;
}

.brand-row {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.topbar-library-size {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.82);
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.page-title {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.75rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.section-title {
  margin: 0;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  letter-spacing: -0.03em;
  font-family: 'Lora', Georgia, serif;
}

.section-subtitle {
  margin: 0;
  max-width: 48rem;
  font-size: 1rem;
  font-family: 'Lora', Georgia, serif;
}

.hero-header {
  justify-content: space-between;
  align-items: end;
}

.stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.profile-meta {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}

.profile-stats {
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
}

.profile-password-modal {
  width: min(32rem, calc(100vw - 1rem));
  max-width: calc(100vw - 1rem);
  border: 1px solid var(--border-strong);
  padding: 0;
  background: var(--surface);
  color: var(--text);
}

.profile-password-modal::backdrop {
  background: rgba(30, 35, 41, 0.45);
}

.profile-password-sheet {
  padding: 1rem;
}

.profile-password-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.profile-password-close {
  width: 2.8rem;
  min-width: 2.8rem;
  min-height: 2.8rem;
  border: 1px solid var(--border);
  background: rgba(255, 253, 249, 0.82);
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text);
}

.stat {
  padding: 1rem 0 0;
  border-top: 1px solid var(--border);
}

.stat-value {
  display: block;
  margin-bottom: 0.25rem;
  font-size: clamp(2rem, 3vw, 2.5rem);
  line-height: 1;
  font-weight: 700;
}

