/* Hassan's Library — Warm Editorial Reading-Room Design System */

:root {
  --paper: #f7f4ee;
  --paper-elevated: #fdfcf9;
  --paper-tint: #efeae0;
  --ink: #221d18;
  --ink-secondary: #5c534a;
  --ink-muted: #8a7f74;
  --hairline: rgba(34, 29, 24, 0.11);
  --hairline-strong: rgba(34, 29, 24, 0.2);
  --forest: #245c44;
  --forest-soft: rgba(36, 92, 68, 0.1);
  --terracotta: #a34828;
  --terracotta-soft: rgba(163, 72, 40, 0.1);
  --ochre: #9c6b22;
  --ochre-soft: rgba(156, 107, 34, 0.12);
  --shelf-wood: #d8cbb8;
  --shelf-wood-edge: #b9a68d;
  --shadow-book: 0 14px 28px -12px rgba(34, 29, 24, 0.28), 0 4px 10px -4px rgba(34, 29, 24, 0.14);
  --shadow-book-hover: 0 22px 36px -12px rgba(34, 29, 24, 0.34), 0 8px 16px -6px rgba(34, 29, 24, 0.18);
  --shadow-drawer: -12px 0 48px rgba(34, 29, 24, 0.18);
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  background-color: var(--paper);
  background-image:
    radial-gradient(rgba(34, 29, 24, 0.03) 1px, transparent 0);
  background-size: 24px 24px;
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.55;
}

button,
input,
select,
textarea {
  font-family: inherit;
  color: inherit;
}

/* Layout Shell */
.page-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.5rem 5rem;
}

/* Top Navigation Bar */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 0;
  border-bottom: 1px solid var(--hairline);
}

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

.home-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  color: var(--ink-secondary);
  font-size: 0.84rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--paper-elevated);
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.home-link:hover {
  color: var(--ink);
  border-color: var(--hairline-strong);
  background: #fff;
}

.nav-links-inline {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.nav-subtle-link {
  text-decoration: none;
  color: var(--ink-muted);
  font-size: 0.82rem;
  font-weight: 600;
  transition: color 0.2s ease;
}

.nav-subtle-link:hover {
  color: var(--ink);
}

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

.btn-librarian-add {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.48rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper-elevated);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.btn-librarian-add:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-signin {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.48rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--hairline-strong);
  background: var(--paper-elevated);
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.btn-signin:hover {
  background: #fff;
  border-color: var(--ink);
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.26rem 0.75rem 0.26rem 0.32rem;
  border-radius: 999px;
  border: 1px solid var(--hairline-strong);
  background: var(--paper-elevated);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.user-pill:hover {
  background: #fff;
  border-color: var(--ink);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--paper-tint);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

.user-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-pill-name {
  font-size: 0.84rem;
  font-weight: 700;
}

.user-pill-caret {
  font-size: 0.72rem;
  color: var(--ink-muted);
}

/* Editorial Hero */
.hero {
  padding: 2.4rem 0 1.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.hero-copy {
  max-width: 620px;
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 4.4vw, 3.3rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.08;
  color: var(--ink);
  margin-bottom: 0;
}

.hero-ledger {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  padding: 0.95rem 1.35rem;
  background: var(--paper-elevated);
  border: 1px solid var(--hairline);
  border-radius: 14px;
}

.ledger-stat {
  display: flex;
  flex-direction: column;
}

.ledger-val {
  font-family: var(--font-serif);
  font-size: 1.65rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--ink);
}

.ledger-val.available {
  color: var(--forest);
}

.ledger-val.borrowed {
  color: var(--terracotta);
}

.ledger-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  margin-top: 0.15rem;
}

.ledger-divider {
  width: 1px;
  height: 30px;
  background: var(--hairline);
}

/* Controls Toolbar */
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.1rem 0 1.6rem;
  border-top: 1px solid var(--hairline);
}

.toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 240px;
  max-width: 420px;
}

.search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-muted);
  pointer-events: none;
  font-size: 0.9rem;
}

.search-input {
  width: 100%;
  padding: 0.62rem 1rem 0.62rem 2.35rem;
  border-radius: 10px;
  border: 1px solid var(--hairline-strong);
  background: var(--paper-elevated);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.search-input:focus {
  border-color: var(--ink);
  background: #fff;
}

.search-input::placeholder {
  color: var(--ink-muted);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.segmented {
  display: inline-flex;
  background: var(--paper-tint);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 3px;
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.78rem;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.seg-btn:hover {
  color: var(--ink);
}

.seg-btn.active {
  background: var(--paper-elevated);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(34, 29, 24, 0.1);
}

.genre-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  overflow-x: auto;
  padding-bottom: 0.2rem;
  scrollbar-width: thin;
}

.genre-chip {
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--ink-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.34rem 0.82rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.16s ease;
}

.genre-chip:hover {
  border-color: var(--hairline-strong);
  color: var(--ink);
}

.genre-chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper-elevated);
}

/* Bookshelf Cover Grid */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 2.1rem 1.6rem;
  margin-top: 0.5rem;
}

.book-card {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  text-align: left;
  background: transparent;
  border: none;
  padding: 0;
  group: true;
}

.book-cover-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  margin-bottom: 0.9rem;
  perspective: 900px;
}

.book-object {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 3px 9px 9px 3px;
  background-color: var(--spine-color, #2f3e46);
  color: var(--accent-color, #f4e9cd);
  box-shadow: var(--shadow-book);
  overflow: hidden;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.28s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.25rem 1.1rem 1.1rem 1.45rem;
}

/* Tactile book spine crease & paper edge sheen */
.book-object::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 14px;
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.28) 0%,
    rgba(255, 255, 255, 0.14) 38%,
    rgba(0, 0, 0, 0.18) 65%,
    rgba(255, 255, 255, 0.08) 85%,
    transparent 100%
  );
  z-index: 3;
  pointer-events: none;
}

.book-object::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.1) 0%, transparent 45%, rgba(0, 0, 0, 0.18) 100%);
  z-index: 2;
  pointer-events: none;
}

.book-card:hover .book-object {
  transform: translateY(-6px) rotateY(-4deg);
  box-shadow: var(--shadow-book-hover);
}

.book-card.is-borrowed .book-object {
  filter: saturate(0.75);
}

.book-cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.book-cover-img.loaded {
  opacity: 1;
}

.book-cloth-genre {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.78;
  position: relative;
  z-index: 0;
}

.book-cloth-body {
  position: relative;
  z-index: 0;
  margin: auto 0;
  padding: 0.6rem 0;
  border-top: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  border-color: color-mix(in srgb, currentColor 30%, transparent);
}

.book-cloth-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.015em;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-cloth-author {
  font-size: 0.74rem;
  font-weight: 500;
  opacity: 0.85;
  position: relative;
  z-index: 0;
}

/* Status ribbon on borrowed cover */
.book-ribbon {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(253, 252, 249, 0.94);
  color: var(--ink);
  padding: 0.25rem 0.55rem 0.25rem 0.3rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(6px);
}

.book-ribbon-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--paper-tint);
}

.book-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.book-title-text {
  font-family: var(--font-serif);
  font-size: 1.06rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-author-text {
  font-size: 0.82rem;
  color: var(--ink-secondary);
}

.book-owner-row {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--ink-muted);
}

.book-owner-avatar {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--paper-tint);
  border: 1px solid var(--hairline-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.56rem;
  font-weight: 700;
  color: var(--ink-secondary);
  position: relative;
  flex-shrink: 0;
}

.book-owner-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.35rem;
  font-size: 0.74rem;
  font-weight: 600;
}

.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.status-tag.available {
  color: var(--forest);
}
.status-tag.available .status-dot {
  background: var(--forest);
}

.status-tag.borrowed {
  color: var(--terracotta);
}
.status-tag.borrowed .status-dot {
  background: var(--terracotta);
}

.waitlist-count {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--ink-muted);
}

/* Circulation Log Section */
.activity-section {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--hairline);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.section-head h2 {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.section-head span {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.activity-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.75rem;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  background: var(--paper-elevated);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  font-size: 0.85rem;
}

.activity-text {
  flex: 1;
  min-width: 0;
  color: var(--ink-secondary);
}

.activity-text strong {
  color: var(--ink);
  font-weight: 700;
}

.activity-time {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-muted);
  white-space: nowrap;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  color: var(--ink-muted);
}

.empty-state h3 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 0.4rem;
}

/* Slide-over Book Detail Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(34, 29, 24, 0.42);
  backdrop-filter: blur(4px);
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.book-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 480px;
  background: var(--paper-elevated);
  box-shadow: var(--shadow-drawer);
  z-index: 910;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.book-drawer.open {
  transform: translateX(0);
}

.drawer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--hairline);
}

.drawer-top-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}

.icon-close-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--ink-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-close-btn:hover {
  background: var(--paper-tint);
  color: var(--ink);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.6rem 1.5rem 2.2rem;
}

.drawer-hero {
  display: flex;
  gap: 1.35rem;
  margin-bottom: 1.6rem;
}

.drawer-cover {
  width: 122px;
  flex-shrink: 0;
}

.drawer-cover .book-object {
  aspect-ratio: 2 / 3;
  height: auto;
  padding: 0.85rem 0.75rem 0.75rem 1rem;
}

.drawer-cover .book-cloth-title {
  font-size: 0.95rem;
}

.drawer-cover .book-cloth-author {
  font-size: 0.65rem;
}

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

.drawer-genre {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin-bottom: 0.35rem;
}

.drawer-title {
  font-family: var(--font-serif);
  font-size: 1.65rem;
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.drawer-author {
  font-size: 0.94rem;
  color: var(--ink-secondary);
  margin-bottom: 0.75rem;
}

.drawer-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--ink-muted);
}

.drawer-owner-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  margin-top: 0.65rem;
  padding: 0.24rem 0.65rem 0.24rem 0.28rem;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink-secondary);
}

.owner-shelf-note {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: var(--paper);
  border: 1px dashed var(--hairline-strong);
  font-size: 0.86rem;
  color: var(--ink-secondary);
  text-align: center;
}

.drawer-synopsis {
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--ink-secondary);
  margin-bottom: 1.35rem;
}

.hassan-note-box {
  padding: 0.95rem 1.1rem;
  background: var(--paper);
  border-left: 3px solid var(--ochre);
  border-radius: 0 10px 10px 0;
  margin-bottom: 1.5rem;
}

.hassan-note-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ochre);
  margin-bottom: 0.3rem;
}

.hassan-note-text {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.98rem;
  color: var(--ink);
}

.loan-status-panel {
  padding: 1.1rem 1.2rem;
  border-radius: 12px;
  border: 1px solid var(--hairline);
  background: var(--paper);
  margin-bottom: 1.3rem;
}

.loan-status-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.45rem;
}

.status-pill-lg {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.24rem 0.68rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
}

.status-pill-lg.available {
  background: var(--forest-soft);
  color: var(--forest);
}

.status-pill-lg.borrowed {
  background: var(--terracotta-soft);
  color: var(--terracotta);
}

.borrower-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.7rem;
}

.borrow-note-quote {
  margin-top: 0.55rem;
  font-size: 0.82rem;
  color: var(--ink-secondary);
  font-style: italic;
}

/* Form Controls inside Drawer / Modals */
.field-group {
  margin-bottom: 0.95rem;
}

.field-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-secondary);
  margin-bottom: 0.35rem;
}

.field-input,
.field-select,
.field-textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--hairline-strong);
  background: #fff;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.field-input:focus,
.field-select:focus,
.field-textarea:focus {
  border-color: var(--ink);
}

.field-textarea {
  resize: vertical;
  min-height: 76px;
}

.field-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.btn-primary-action {
  width: 100%;
  padding: 0.82rem 1.2rem;
  border-radius: 10px;
  border: none;
  background: var(--ink);
  color: var(--paper-elevated);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: opacity 0.2s ease, transform 0.15s ease;
}

.btn-primary-action:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-primary-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-forest {
  background: var(--forest);
  color: #fff;
}

.btn-secondary-action {
  width: 100%;
  padding: 0.74rem 1.1rem;
  border-radius: 10px;
  border: 1px solid var(--hairline-strong);
  background: transparent;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.55rem;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-secondary-action:hover {
  background: var(--paper-tint);
  border-color: var(--ink);
}

.btn-danger-ghost {
  background: transparent;
  border: 1px solid rgba(163, 72, 40, 0.32);
  color: var(--terracotta);
  margin-top: 0.85rem;
}

.btn-danger-ghost:hover {
  background: var(--terracotta-soft);
  border-color: var(--terracotta);
}

.waitlist-section {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--hairline);
}

.waitlist-avatars {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.55rem;
}

.waitlist-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.6rem 0.22rem 0.25rem;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  font-size: 0.76rem;
  font-weight: 600;
}

/* Modals (Shared Auth & Add Book) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(34, 29, 24, 0.52);
  backdrop-filter: blur(5px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--paper-elevated);
  border: 1px solid var(--hairline-strong);
  border-radius: 18px;
  padding: 1.8rem;
  box-shadow: 0 24px 60px rgba(34, 29, 24, 0.24);
  position: relative;
}

.modal-card h2 {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.modal-sub {
  font-size: 0.88rem;
  color: var(--ink-secondary);
  margin-bottom: 1.3rem;
}

.form-error {
  color: var(--terracotta);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.85rem;
  display: none;
}

.roster-strip {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--hairline);
}

.roster-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--hairline-strong);
  background: var(--paper-tint);
}

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

/* Color Swatch Picker in Add Book Modal */
.swatch-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.swatch-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.swatch-btn.selected {
  border-color: var(--ink);
  transform: scale(1.12);
}

/* Cover URL Live Preview in Add Book Modal */
.cover-preview-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.55rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: var(--paper);
  border: 1px solid var(--hairline);
}

.cover-preview-thumb {
  width: 42px;
  height: 63px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--paper-tint);
  border: 1px solid var(--hairline-strong);
  flex-shrink: 0;
}

.cover-preview-status {
  font-size: 0.76rem;
  color: var(--ink-muted);
  line-height: 1.35;
}

.cover-preview-status.ok {
  color: var(--forest);
  font-weight: 600;
}

.cover-preview-status.err {
  color: var(--terracotta);
  font-weight: 600;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--ink);
  color: var(--paper-elevated);
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(34, 29, 24, 0.28);
  z-index: 1200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  max-width: 90vw;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 720px) {
  .page-shell {
    padding: 0 1rem 4rem;
  }

  .nav-links-inline {
    display: none;
  }

  .hero {
    padding: 1.8rem 0 1.4rem;
    gap: 1.25rem;
  }

  .hero-ledger {
    width: 100%;
    justify-content: space-between;
  }

  .books-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem 1rem;
  }

  .book-cloth-title {
    font-size: 1.02rem;
  }

  .book-drawer {
    max-width: 100%;
    top: auto;
    height: 90vh;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
  }

  .book-drawer.open {
    transform: translateY(0);
  }
}
