@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,500;0,600;0,700;1,500&family=Lora:ital,wght@0,400;0,500;1,400&display=swap');

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

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

body {
  font-family: 'Lora', Georgia, serif;
  font-size: 15px;
  color: #2a1a0e;
  background: #f5ede0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Grain overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 300px 300px;
  opacity: 0.04;
  z-index: 9999;
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: #2a1a0e;
  color: #f5ede0;
}

.nav-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  color: inherit;
  text-decoration: none;
}

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

.btn-link {
  background: none;
  border: none;
  color: #c4a882;
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
  padding: 0;
}
.btn-link:hover { color: #f5ede0; }

main { padding: 2rem 1.5rem; max-width: 960px; width: 100%; margin: 0 auto; flex: 1; }

h2, h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
}

h2 { margin-bottom: 1.25rem; font-size: 1.4rem; }

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  background: #fffdf9;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(42,26,14,0.1);
}

th {
  text-align: left;
  padding: 0.75rem 1rem;
  background: #ece3d6;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #6b4c2a;
  font-weight: 500;
}

td {
  padding: 0.75rem 1rem;
  border-top: 1px solid #e8ddd0;
  vertical-align: middle;
}

tr:hover td { background: #fdf8f2; }

/* Status badge */
.badge {
  display: inline-block;
  padding: 0.2em 0.6em;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 500;
}
.badge-read    { background: #d4edda; color: #1a5c32; }
.badge-reading { background: #fde8d0; color: #7a3010; }
.badge-planned { background: #dde6f0; color: #1e3a5f; }

/* Status select (admin only) */
.status-select {
  border: none;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.2em 0.6em;
  cursor: pointer;
}
.status-select-read    { background: #d4edda; color: #1a5c32; }
.status-select-reading { background: #fde8d0; color: #7a3010; }
.status-select-planned { background: #dde6f0; color: #1e3a5f; }

/* Meeting date input (admin only) */
.date-input {
  border: 1px solid #c9b8a0;
  border-radius: 6px;
  font-size: 0.8rem;
  padding: 0.25em 0.4em;
  color: #4a3020;
  cursor: pointer;
  background: #fffdf9;
}
.date-input-sm { width: 7.5rem; font-size: 0.72rem; padding: 0.15em 0.25em; }

/* Rating pips */
.pip-form {
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
}

.pip {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid #c2601f;
  background: transparent;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.1s;
}

.pip.filled { background: #c2601f; }
.pip:hover  { background: #e8a070; border-color: #e8a070; }

/* Login */
.login-box {
  max-width: 360px;
  margin: 2rem auto 4rem;
  background: #fffdf9;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(42,26,14,0.1);
}
.login-box h2 { margin-bottom: 1.25rem; }

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
}

input[type="text"], input[type="password"] {
  padding: 0.5rem 0.75rem;
  border: 1px solid #c9b8a0;
  border-radius: 6px;
  font-size: 1rem;
  width: 100%;
  background: #fffdf9;
}
input:focus { outline: 2px solid #c2601f; border-color: transparent; }

.login-box button[type="submit"] {
  width: 100%;
  padding: 0.6rem;
  background: #c2601f;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 0.25rem;
}
.login-box button[type="submit"]:hover { background: #a34d15; }

.error {
  color: #7a1c1c;
  background: #fde8d0;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.success-text {
  color: #2a5e2a;
  background: #d8f0d8;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  display: inline-block;
}

/* ── Footer ───────────────────────────────────────────── */
footer {
  margin-top: 4rem;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid #d9c9b5;
  background: #fffdf9;
  font-size: 0.8rem;
  color: #9c836a;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.footer-brand {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  color: #7a5a3a;
}

.footer-link { color: #9c836a; text-decoration: none; }
.footer-link:hover { color: #7a5a3a; }

.footer-land { font-size: 0.78rem; }

/* ── Modals ───────────────────────────────────────────── */
dialog {
  border: none;
  border-radius: 8px;
  padding: 2rem;
  max-width: 360px;
  width: 90%;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 4px 24px rgba(42,26,14,0.15);
  background: #fffdf9;
}

dialog::backdrop {
  background: rgba(42,26,14,0.4);
}

.modal-body {
  font-size: 0.9rem;
  color: #5a4030;
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

/* ── Tabs ─────────────────────────────────────────────── */
.tabs {
  display: flex;
  background: #fffdf9;
  border-bottom: 1px solid #d9c9b5;
  padding: 0 1.5rem;
}

.tab {
  padding: 0.7rem 1.1rem;
  text-decoration: none;
  color: #7a5a3a;
  font-size: 0.9rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab:hover { color: #2a1a0e; }
.tab.active { color: #c2601f; border-bottom-color: #c2601f; font-weight: 500; }

/* ── Shared utilities ─────────────────────────────────── */
.page-header { margin-bottom: 1.25rem; }

.empty-state { color: #9c836a; font-size: 0.9rem; padding: 1rem 0; }

.field-label { font-size: 0.9rem; font-weight: 500; margin-bottom: 0.4rem; }

.btn-primary {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: #c2601f;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
}
.btn-primary:hover { background: #a34d15; }

.btn-secondary {
  display: inline-block;
  padding: 0.5rem 0.9rem;
  background: #ece3d6;
  color: #4a3020;
  border: 1px solid #c9b8a0;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  margin-right: 0.5rem;
}
.btn-secondary:hover { background: #dfd4c4; }

.btn-danger {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  background: #fffdf9;
  color: #7a1c1c;
  border: 1px solid #e8a8a8;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
}
.btn-danger:hover { background: #fde8d0; border-color: #d47070; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  background: #ece3d6;
  color: #4a3020;
  border: 1px solid #c9b8a0;
  border-radius: 6px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  margin-left: 0.4rem;
}
.btn-icon:hover { background: #dfd4c4; }
.btn-icon-add { margin-left: 0; margin-top: 0.3rem; }

.btn-icon-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  background: #fffdf9;
  color: #7a1c1c;
  border: 1px solid #e8a8a8;
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
}
.btn-icon-danger:hover { background: #fde8d0; border-color: #d47070; }

/* ── Planning ─────────────────────────────────────────── */
.collapsible-panel {
  background: #fffdf9;
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(42,26,14,0.1);
}

.collapsible-panel summary {
  cursor: pointer;
  font-weight: 500;
  color: #c2601f;
  user-select: none;
}

.create-poll-form { margin-top: 1rem; }

.create-poll-form label,
.create-poll-form .field-label { margin-bottom: 0.75rem; }

.option-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.option-row input[type="date"] { flex: 0 0 auto; }
.option-row select { flex: 0 0 auto; }
.option-row input[type="text"] { flex: 1; }

.create-poll-form .btn-secondary { margin-top: 0.25rem; margin-bottom: 1rem; }

.poll-card {
  background: #fffdf9;
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 3px rgba(42,26,14,0.1);
}

.poll-header { margin-bottom: 1rem; }
.poll-header h3 { margin-bottom: 0.2rem; font-size: 1.1rem; }
.poll-book { display: block; font-size: 0.88rem; color: #5a4030; margin-bottom: 0.15rem; }
.poll-meta { font-size: 0.8rem; color: #9c836a; }

.poll-grid { margin-bottom: 1.25rem; }

.option-dt { white-space: nowrap; font-size: 0.88rem; }
.option-note { color: #7a5a3a; font-size: 0.85rem; }

.vote-cell { text-align: center; font-size: 1rem; }
.avail-yes { color: #1a6b3a; font-weight: 600; }
.avail-no  { color: #9a2020; }

.vote-form-label { font-size: 0.85rem; font-weight: 500; color: #7a5a3a; margin-bottom: 0.5rem; }

.vote-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.vote-note { color: #9c836a; font-size: 0.8rem; }

.vote-form .btn-primary { margin-top: 0.75rem; }

/* ── Discussion ───────────────────────────────────────── */
.note-search-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.note-search-row select,
.note-search-row input[type="search"] {
  padding: 0.4rem 0.75rem;
  border: 1px solid #c9b8a0;
  border-radius: 6px;
  font-size: 0.9rem;
  background: #fffdf9;
  color: #2a1a0e;
}

.note-search-row input[type="search"] { flex: 1; }
.note-search-row input[type="search"]:focus { outline: 2px solid #c2601f; border-color: transparent; }

.create-note-form { margin-top: 1rem; }
.create-note-form label { margin-bottom: 0.75rem; }
.create-note-form select,
.create-note-form textarea {
  padding: 0.5rem 0.75rem;
  border: 1px solid #c9b8a0;
  border-radius: 6px;
  font-size: 0.9rem;
  width: 100%;
  background: #fffdf9;
  color: #2a1a0e;
}
.create-note-form textarea { resize: vertical; }
.create-note-form select:focus,
.create-note-form textarea:focus { outline: 2px solid #c2601f; border-color: transparent; }

.visibility-toggle {
  flex-direction: row !important;
  align-items: center;
  gap: 0.5rem !important;
  font-weight: 400 !important;
  cursor: pointer;
}

.note-card {
  background: #fffdf9;
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(42,26,14,0.1);
}

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

.note-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  font-size: 0.82rem;
  color: #9c836a;
}

.note-book  { font-weight: 500; color: #5a4030; }
.note-author::before { content: "by "; }
.note-date  { color: #b09070; }

.note-content {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #2a1a0e;
  margin-bottom: 0.9rem;
}

.note-content > * + * { margin-top: 0.6rem; }

.note-content h1, .note-content h2, .note-content h3,
.note-content h4, .note-content h5, .note-content h6 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  line-height: 1.3;
  margin-top: 0.9rem;
}
.note-content h1 { font-size: 1.2rem; }
.note-content h2 { font-size: 1.05rem; }
.note-content h3, .note-content h4,
.note-content h5, .note-content h6 { font-size: 0.95rem; }

.note-content p { margin: 0; }

.note-content ul, .note-content ol {
  padding-left: 1.4rem;
}
.note-content li + li { margin-top: 0.2rem; }

.note-content a { color: #c2601f; text-decoration: underline; }
.note-content a:hover { color: #a34d15; }

.note-content strong { font-weight: 600; }
.note-content em { font-style: italic; }
.note-content del { text-decoration: line-through; color: #9c836a; }

.note-content code {
  font-family: ui-monospace, monospace;
  font-size: 0.85em;
  background: #ece3d6;
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

.note-content pre {
  background: #ece3d6;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  overflow-x: auto;
}
.note-content pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
}

.note-content blockquote {
  border-left: 3px solid #c9b8a0;
  margin-left: 0;
  padding-left: 0.9rem;
  color: #7a5a3a;
  font-style: italic;
}

.note-content table {
  border-collapse: collapse;
  width: auto;
  box-shadow: none;
  border-radius: 0;
  font-size: 0.88rem;
}
.note-content th, .note-content td {
  border: 1px solid #d9c9b5;
  padding: 0.3rem 0.6rem;
}
.note-content th { background: #ece3d6; }

.note-content hr {
  border: none;
  border-top: 1px solid #d9c9b5;
  margin: 0.75rem 0;
}

.note-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

textarea.note-edit {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #c9b8a0;
  border-radius: 6px;
  font-size: 0.9rem;
  background: #fffdf9;
  color: #2a1a0e;
  resize: vertical;
  margin-bottom: 0.5rem;
}
textarea.note-edit:focus { outline: 2px solid #c2601f; border-color: transparent; }

.note-edit-actions { display: flex; gap: 0.5rem; }

.badge-public  { background: #d4edda; color: #1a5c32; }
.badge-private { background: #e8e4de; color: #5a4030; }

/* ── Admin ────────────────────────────────────────────── */
.admin-section {
  background: #fffdf9;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(42,26,14,0.1);
}

.admin-section > h3 { margin: 0 0 0.75rem; font-size: 0.95rem; font-weight: 600; color: #5a4030; }
.admin-section > p { margin: 0 0 0.75rem; font-size: 0.9rem; }

.unenriched-list { margin: 0.5rem 0 1rem; padding-left: 1.25rem; font-size: 0.9rem; }
.unenriched-list li { margin-bottom: 0.2rem; }

.enrich-status { margin: 0.5rem 0 0; font-size: 0.9rem; }

.create-user-form { margin-top: 1.25rem; border-top: 1px solid #e8ddd0; padding-top: 1rem; }
.create-user-form h4 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: #5a4030;
  margin-bottom: 0.6rem;
}

.create-user-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}
.create-user-fields input[type="text"],
.create-user-fields input[type="password"] {
  width: auto;
  flex: 1 1 160px;
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
}
.admin-check {
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  font-size: 0.9rem;
  white-space: nowrap;
}

/* ── Trends ───────────────────────────────────────────── */
.trends-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.trends-filters label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: #7a5a3a;
}

.trends-filters input[type="date"],
.trends-filters select {
  padding: 0.4rem 0.75rem;
  border: 1px solid #c9b8a0;
  border-radius: 6px;
  font-size: 0.9rem;
  background: #fffdf9;
  color: #2a1a0e;
}

.trends-filters input[type="date"]:focus,
.trends-filters select:focus { outline: 2px solid #c2601f; border-color: transparent; }

.trends-hero {
  background: linear-gradient(135deg, #fbf3e9, #f6e4d3);
  border-left: 4px solid #c2601f;
  border-radius: 8px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
}

.trends-hero p {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.6;
  color: #5a4030;
}

.trends-hero strong { color: #c2601f; font-weight: 700; }

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

@media (max-width: 720px) {
  .charts-grid { grid-template-columns: 1fr; }
}

.chart-card {
  background: #fffdf9;
  border-radius: 8px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(42,26,14,0.1);
}

.chart-card h3 { margin-bottom: 1rem; font-size: 0.95rem; font-weight: 600; color: #5a4030; }

/* Methodology tooltip — an "i" chip beside each chart title. */
.chart-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 0.35rem;
  border-radius: 50%;
  background: #e8ddd0;
  color: #7a5a3a;
  font-family: 'Lora', Georgia, serif;
  font-style: italic;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: help;
  position: relative;
  vertical-align: middle;
}
.chart-info:hover, .chart-info:focus { background: #c2601f; color: #fff; outline: none; }

.chart-info::after {
  content: attr(data-tip);
  position: absolute;
  top: 145%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: 230px;
  padding: 0.55rem 0.7rem;
  background: #2a1a0e;
  color: #f5ede0;
  border-radius: 6px;
  font-family: 'Lora', Georgia, serif;
  font-style: normal;
  font-weight: 400;
  font-size: 0.75rem;
  line-height: 1.45;
  text-align: left;
  box-shadow: 0 2px 10px rgba(42,26,14,0.3);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s;
  pointer-events: none;
}
.chart-info:hover::after, .chart-info:focus::after { opacity: 1; visibility: visible; }

/* Books / Pages slide toggle on the reading-pace card. */
.pace-toggle {
  display: inline-flex;
  float: right;
  align-items: center;
  gap: 0.4rem;
}
.pace-label {
  font-family: 'Lora', Georgia, serif;
  font-size: 0.72rem;
  font-weight: 600;
  color: #b8a690;
  cursor: pointer;
  transition: color 0.15s;
}
.pace-label.active { color: #c2601f; }
.pace-switch {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
  cursor: pointer;
}
.pace-switch input { opacity: 0; width: 0; height: 0; }
.pace-slider {
  position: absolute;
  inset: 0;
  background: #e8ddd0;
  border-radius: 18px;
  transition: background 0.15s;
}
.pace-slider::before {
  content: '';
  position: absolute;
  height: 14px;
  width: 14px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s;
}
.pace-switch input:checked + .pace-slider { background: #c2601f; }
.pace-switch input:checked + .pace-slider::before { transform: translateX(14px); }

/* Fixed-height box owns the canvas size so Chart.js (maintainAspectRatio:false)
   fills it without the resize creep that a bare responsive canvas shows. */
.chart-box { position: relative; height: 260px; }

.chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  margin: 0;
  text-align: center;
  color: #9c836a;
  font-size: 0.85rem;
}

/* ── Book detail ──────────────────────────────────────── */
.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  color: #9c836a;
  text-decoration: none;
  font-size: 0.85rem;
}
.back-link:hover { color: #c2601f; }

.detail-card {
  background: #fffdf9;
  border-radius: 8px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 3px rgba(42,26,14,0.1);
  max-width: 640px;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1.1rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid #e8ddd0;
}

.detail-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  font-size: 1.5rem;
  margin: 0;
  line-height: 1.2;
}

.detail-author {
  color: #7a5a3a;
  font-style: italic;
  margin: 0.25rem 0 0;
  font-size: 0.95rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.7rem 1.5rem;
  margin: 0;
}

.detail-grid dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #6b4c2a;
  font-weight: 500;
  align-self: center;
}

.detail-grid dd {
  margin: 0;
  color: #2a1a0e;
  font-size: 0.95rem;
  word-break: break-word;
}

.detail-section-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  font-size: 1.05rem;
  margin: 0 0 0.9rem;
}

.muted { color: #9c836a; }

.rating-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rating-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0;
  border-top: 1px solid #e8ddd0;
  font-size: 0.95rem;
}
.rating-list li:first-child { border-top: none; }

.rating-user { color: #4a3020; }
.rating-score { color: #2a1a0e; }

.meeting-list { list-style: none; margin: 0; padding: 0; }

.meeting-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0;
  border-top: 1px solid #e8ddd0;
  font-size: 0.95rem;
}
.meeting-list li:first-child { border-top: none; }

.meeting-date { color: #2a1a0e; }

.meeting-tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15em 0.6em;
  border-radius: 99px;
  font-weight: 500;
}
.meeting-tag-past { background: #e8e4de; color: #6b5a48; }
.meeting-tag-upcoming { background: #dde6f0; color: #1e3a5f; }

.part-tag {
  background: #ece3d6;
  color: #6b4c2a;
  padding: 0.15em 0.6em;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 500;
}
.meeting-left { display: flex; align-items: center; gap: 0.6em; }
.meeting-right { display: flex; align-items: center; gap: 0.5em; }

.row-meeting {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2em;
  padding: 0.3rem 0;
}

.row-meeting-controls {
  display: flex;
  align-items: center;
  gap: 0.4em;
}

.part-tag-sm {
  display: inline-block;
  background: #ece3d6;
  color: #6b4c2a;
  padding: 0.05em 0.45em;
  border-radius: 99px;
  font-size: 0.68rem;
  font-weight: 600;
}

.error-sm { font-size: 0.78rem; margin: 0.1rem 0 0.3rem; }

input.read-to-input {
  display: block;
  margin-top: 0.3em;
  padding: 0.15rem 0.3rem;
  border: 1px solid #c9b8a0;
  border-radius: 6px;
  font-size: 0.72rem;
  background: #fffdf9;
  color: #2a1a0e;
  width: 7rem;
}
input.read-to-input-sm { width: 5.5rem; font-size: 0.68rem; padding: 0.12rem 0.25rem; }

.metadata-source {
  margin-top: 0.25rem;
  font-size: 0.78rem;
  color: #9c836a;
}
.metadata-source a { color: #9c836a; text-decoration: underline; }
.metadata-source a:hover { color: #c2601f; }

.detail-hero { display: flex; gap: 1.5rem; align-items: flex-start; }

.detail-cover {
  width: 132px;
  flex-shrink: 0;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(42,26,14,0.2);
}

.detail-hero-body { flex: 1; min-width: 0; }

.detail-description {
  color: #4a3020;
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-line;
}

.genre-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.genre-tag {
  background: #ece3d6;
  color: #6b4c2a;
  padding: 0.2em 0.7em;
  border-radius: 99px;
  font-size: 0.78rem;
}

@media (max-width: 560px) {
  .detail-hero { flex-direction: column; }
  .detail-cover { width: 110px; }
}

.book-link {
  color: #2a1a0e;
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid transparent;
  transition: color 0.1s, border-color 0.1s;
}
.book-link:hover {
  color: #c2601f;
  border-bottom-color: #c2601f;
}

/* ── Add-book lookup + confirm ─────────────────────────── */
.form-actions { display: flex; align-items: center; gap: 0.75rem; }

.lookup-indicator {
  display: none;
  align-items: center;
  gap: 0.45rem;
  color: #9c836a;
  font-size: 0.85rem;
}
.htmx-request.lookup-indicator { display: inline-flex; }

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #d9c9b5;
  border-top-color: #c2601f;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.confirm-heading { font-weight: 600; color: #2a1a0e; margin-bottom: 0.75rem; }
.confirm-heading-match { color: #2a5e2a; }

.confirm-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1rem;
  margin-bottom: 1rem;
}
.confirm-meta dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b4c2a;
  font-weight: 500;
  align-self: center;
}
.confirm-meta dd { margin: 0; color: #2a1a0e; font-size: 0.95rem; }

.confirm-note { color: #9c836a; font-size: 0.9rem; margin-bottom: 1rem; }

.confirm-actions { display: flex; gap: 0.5rem; align-items: center; }
