:root {
  --bg: #f7f2ec;
  --bg-strong: #f1e7dc;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-solid: #fffdf9;
  --text: #27313a;
  --muted: #687784;
  --line: rgba(92, 104, 114, 0.14);
  --shadow: 0 24px 70px rgba(77, 61, 46, 0.12);
  --accent: #79b6af;
  --accent-strong: #5f9f98;
  --accent-warm: #efb8a5;
  --accent-sun: #f6d39a;
  --accent-lilac: #c7c0f0;
  --accent-rose: #f2bac3;
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --sidebar-width: 272px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.8), transparent 30%),
    linear-gradient(180deg, #fbf7f2 0%, #f4ebe2 100%);
  overflow-x: hidden;
}

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

button {
  cursor: pointer;
}

.ambient {
  position: fixed;
  inset: auto;
  z-index: -1;
  filter: blur(18px);
  opacity: 0.8;
  pointer-events: none;
}

.ambient-one {
  top: 8%;
  left: 8%;
  width: 280px;
  height: 280px;
  border-radius: 48% 52% 48% 52%;
  background: rgba(121, 182, 175, 0.24);
}

.ambient-two {
  top: 14%;
  right: 8%;
  width: 240px;
  height: 240px;
  border-radius: 39% 61% 37% 63%;
  background: rgba(239, 184, 165, 0.26);
}

.ambient-three {
  bottom: 8%;
  left: 24%;
  width: 300px;
  height: 300px;
  border-radius: 58% 42% 58% 42%;
  background: rgba(199, 192, 240, 0.22);
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-right: 1px solid var(--line);
  background: rgba(255, 252, 248, 0.66);
  backdrop-filter: blur(16px);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(121, 182, 175, 0.45), rgba(246, 211, 154, 0.72));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.7rem;
  color: var(--accent-strong);
  font-weight: 800;
}

h1,
h2,
h3,
.hero-card h3,
.login-copy h2 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 1.35rem;
}

h2 {
  font-size: clamp(1.75rem, 2vw, 2.4rem);
}

h3 {
  font-size: 1.35rem;
}

.side-nav {
  display: grid;
  gap: 10px;
}

.nav-btn,
.secondary-btn,
.primary-btn,
.icon-btn,
.key-btn {
  border: 0;
  border-radius: 999px;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, color 160ms ease, opacity 160ms ease;
}

.nav-btn {
  padding: 14px 16px;
  text-align: left;
  color: var(--text);
  background: transparent;
  font-weight: 700;
}

.nav-btn:hover,
.nav-btn.active {
  background: rgba(121, 182, 175, 0.16);
  color: #1f4944;
}

.sidebar-card,
.panel,
.login-card,
.modal-card {
  border: 1px solid rgba(92, 104, 114, 0.12);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.sidebar-card {
  margin-top: auto;
  padding: 18px;
  border-radius: var(--radius-lg);
}

.sidebar-card p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.main-column {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.topbar p,
.panel-meta,
.login-copy p,
.hero-card p,
.form-copy p,
.bookcase-card p,
.empty-state p {
  color: var(--muted);
  line-height: 1.65;
}

.topbar h2 {
  max-width: 12ch;
}

.topbar-actions {
  display: flex;
  align-items: end;
  gap: 12px;
}

.site-logo {
  width: 46px;
  height: 46px;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(39, 66, 75, 0.08);
  border: 1px solid rgba(255,255,255,0.6);
}

.search-box {
  display: grid;
  gap: 8px;
  min-width: min(42vw, 360px);
}

.search-box span,
.filters-row span,
.form-grid span,
.reader-fieldset legend {
  font-size: 0.9rem;
  font-weight: 800;
  color: #3c515d;
}

input,
select,
textarea {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(92, 104, 114, 0.16);
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  padding: 13px 14px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(95, 159, 152, 0.7);
  box-shadow: 0 0 0 4px rgba(121, 182, 175, 0.18);
}

.primary-btn,
.secondary-btn,
.icon-btn {
  padding: 13px 18px;
  font-weight: 800;
}

.primary-btn {
  color: #113531;
  background: linear-gradient(135deg, rgba(121, 182, 175, 0.92), rgba(246, 211, 154, 0.98));
  box-shadow: 0 14px 30px rgba(121, 182, 175, 0.24);
}

.secondary-btn,
.icon-btn {
  color: #314550;
  background: rgba(255, 255, 255, 0.72);
}

.primary-btn:hover,
.secondary-btn:hover,
.icon-btn:hover,
.nav-btn:hover,
.key-btn:hover {
  transform: translateY(-1px);
}

.views {
  display: grid;
  gap: 20px;
}

.view-panel {
  display: none;
}

.view-panel.active {
  display: grid;
  gap: 20px;
}

.panel {
  padding: 22px;
  border-radius: var(--radius-xl);
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(180px, 0.7fr);
  gap: 20px;
  align-items: center;
}

.hero-art {
  min-height: 220px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(246, 211, 154, 0.34), rgba(121, 182, 175, 0.3));
  position: relative;
  overflow: hidden;
}

.hero-book {
  position: absolute;
  bottom: 20px;
  width: 40px;
  border-radius: 14px 14px 10px 10px;
  box-shadow: 0 16px 30px rgba(44, 60, 68, 0.18);
}

.hero-book::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.34), transparent 32%);
}

.hero-book-a {
  left: 16%;
  height: 150px;
  background: linear-gradient(180deg, #f2bac3, #d992a1);
}

.hero-book-b {
  left: 38%;
  height: 186px;
  background: linear-gradient(180deg, #7ab9b3, #5f9f98);
}

.hero-book-c {
  left: 60%;
  height: 132px;
  background: linear-gradient(180deg, #f6d39a, #ddaf69);
}

.stat-row,
.stats-grid,
.mini-grid,
.bookcase-grid {
  display: grid;
  gap: 16px;
}

.stat-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dashboard-hero,
.dashboard-card,
.reader-detail-card {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(92, 104, 114, 0.1);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow);
}

.dashboard-hero {
  padding: 22px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.dashboard-hero h3 {
  font-size: 1.55rem;
  max-width: 16ch;
}

.dashboard-ornament {
  width: 170px;
  height: 110px;
  display: flex;
  align-items: end;
  gap: 14px;
  justify-content: center;
}

.dashboard-ornament span {
  width: 34px;
  border-radius: 18px 18px 8px 8px;
  background: linear-gradient(180deg, rgba(121, 182, 175, 0.9), rgba(246, 211, 154, 0.84));
  box-shadow: 0 18px 26px rgba(77, 61, 46, 0.16);
}

.dashboard-ornament span:nth-child(1) { height: 68px; }
.dashboard-ornament span:nth-child(2) { height: 92px; }
.dashboard-ornament span:nth-child(3) { height: 52px; }

.dashboard-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.dashboard-card {
  padding: 18px;
  display: grid;
  gap: 8px;
}

.dashboard-card strong {
  font-family: "Fraunces", serif;
  font-size: 1.35rem;
}

.accent-card {
  position: relative;
  overflow: hidden;
}

.accent-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 8px;
  background: var(--card-accent, rgba(121, 182, 175, 0.55));
}

.wide-card {
  grid-column: span 2;
}

.recent-dashboard-list {
  display: grid;
  gap: 10px;
}

.quote-source {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

blockquote {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 1.05rem;
  line-height: 1.45;
  color: var(--text);
}

.search-row {
  margin-bottom: 14px;
}

.bookcase-section {
  display: grid;
  gap: 18px;
  padding: 22px;
  margin: 0;
  border-radius: 30px;
  border: 2px solid color-mix(in srgb, var(--bookcase-accent, #79b6af) 40%, rgba(92, 104, 114, 0.14));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--bookcase-accent, #79b6af) 20%, rgba(255, 255, 255, 0.92)), rgba(255, 255, 255, 0.82)),
    rgba(255, 255, 255, 0.65);
  box-shadow: 0 18px 44px rgba(77, 61, 46, 0.08);
}

.bookcase-section-header {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.bookcase-section-copy h3 {
  font-size: 1.12rem;
  color: color-mix(in srgb, var(--bookcase-accent, #79b6af) 80%, #20343b);
}

.bookcase-section-copy p {
  margin: 4px 0 0;
}

.bookcase-cover {
  min-height: 140px;
  border-radius: 22px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, color-mix(in srgb, var(--bookcase-accent, #79b6af) 36%, white), color-mix(in srgb, var(--bookcase-accent, #79b6af) 18%, #f7f2ec));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45), 0 0 0 1px color-mix(in srgb, var(--bookcase-accent, #79b6af) 32%, transparent);
}

.bookcase-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bookcase-cover .fallback-cover.small {
  font-size: 1.45rem;
}

.add-options-grid,
.bookcase-library-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.add-options-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.add-option-card {
  text-align: left;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(92, 104, 114, 0.12);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
  display: grid;
  gap: 8px;
}

.add-option-card strong {
  font-family: "Fraunces", serif;
  font-size: 1.15rem;
}

.add-option-card p,
.bookcase-library-copy p,
.reader-detail-card p,
.recent-book-btn small {
  color: var(--muted);
  line-height: 1.55;
}

.quick-add-menu {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: grid;
  place-items: center;
  padding: 22px;
}

.menu-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(43, 52, 56, 0.25);
  backdrop-filter: blur(4px);
}

.menu-card {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
}

.form-topline {
  display: flex;
  justify-content: flex-end;
}

.bookcase-library-card,
.reader-detail-card {
  border-radius: 24px;
  border: 1px solid rgba(92, 104, 114, 0.12);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.bookcase-library-card {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
}

.bookcase-cover {
  min-height: 100%;
  background: linear-gradient(145deg, rgba(121, 182, 175, 0.16), rgba(246, 211, 154, 0.18));
  display: grid;
  place-items: center;
}

.bookcase-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bookcase-cover .fallback-cover.small {
  font-size: 1.45rem;
}

.bookcase-library-copy {
  padding: 16px;
  display: grid;
  gap: 8px;
}

.bookcase-library-copy strong {
  font-family: "Fraunces", serif;
  font-size: 1.1rem;
}

.reader-card {
  text-align: left;
  cursor: pointer;
}

.reader-card strong {
  display: block;
}

.reader-detail-panel {
  margin-top: 16px;
}

.reader-detail-card {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.recent-list {
  display: grid;
  gap: 10px;
}

.recent-book-btn {
  text-align: left;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(92, 104, 114, 0.12);
  background: rgba(255, 255, 255, 0.74);
  display: grid;
  gap: 4px;
}

.recent-book-btn small {
  font-size: 0.8rem;
}

.stat-card,
.metric-card,
.bookcase-card,
.book-card,
.detail-summary,
.empty-state {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(92, 104, 114, 0.1);
  background: rgba(255, 255, 255, 0.68);
}

.stat-card,
.metric-card {
  padding: 18px;
}

.stat-card strong,
.metric-card strong {
  display: block;
  margin-top: 8px;
  font-family: "Fraunces", serif;
  font-size: clamp(1.5rem, 2.4vw, 2.1rem);
}

.bookcase-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.bookcase-card {
  padding: 16px;
  overflow: hidden;
}

.bookcase-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.bookcase-books {
  display: flex;
  gap: 8px;
  align-items: end;
  min-height: 110px;
  padding: 16px 12px 10px;
  border-radius: 20px 20px 16px 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.44), rgba(255, 255, 255, 0.06)),
    linear-gradient(180deg, rgba(245, 235, 225, 0.6), rgba(215, 200, 184, 0.9));
  position: relative;
  overflow: hidden;
}

.bookcase-books::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 8px;
  height: 6px;
  border-radius: 999px;
  background: rgba(71, 55, 42, 0.14);
}

.spine {
  width: 22px;
  height: 88px;
  border-radius: 9px 9px 6px 6px;
  box-shadow: 0 8px 18px rgba(61, 56, 47, 0.18);
  position: relative;
}

.spine::before {
  content: "";
  position: absolute;
  inset: 10px 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
}

.spine-label {
  position: absolute;
  inset: auto 2px 8px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.92);
  text-align: center;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 14px;
  margin-bottom: 16px;
}

.filters-row {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 220px) auto;
  gap: 12px;
  margin-bottom: 18px;
}

.filters-row label,
.form-grid label,
.cover-preview-field,
.reader-fieldset,
.login-copy,
.book-form-shell,
.detail-summary {
  display: grid;
  gap: 8px;
}

.choice-field {
  display: grid;
  gap: 10px;
}

.choice-add-btn {
  justify-self: start;
  padding-inline: 14px;
}

.books-grid {
  display: grid;
  gap: 28px;
  grid-template-columns: repeat(auto-fit, 236px);
  justify-content: center;
  justify-items: center;
  align-items: start;
}

#booksGrid {
  display: grid;
  gap: 28px;
  grid-template-columns: 1fr;
  justify-items: stretch;
  align-items: start;
}

#booksGrid > .bookcase-section {
  width: 100%;
}

.bookcase-section .books-grid {
  display: grid;
  gap: 28px;
  grid-template-columns: repeat(auto-fit, 236px);
  justify-content: center;
  justify-items: center;
  align-items: start;
}

.book-card {
  width: 100%;
  max-width: 236px;
  min-height: 0;
  padding: 16px;
  display: grid;
  gap: 14px;
  cursor: pointer;
  border: 1.5px solid var(--bookcase-accent, rgba(92, 104, 114, 0.16));
  border-radius: 28px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.48) inset, 0 18px 36px rgba(77, 61, 46, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.76));
  align-content: start;
}

.book-copy {
  display: grid;
  gap: 6px;
  align-content: start;
}

.book-cover {
  aspect-ratio: 3 / 4;
  min-height: 0;
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(145deg, color-mix(in srgb, var(--bookcase-accent, #79b6af) 20%, white), color-mix(in srgb, var(--bookcase-accent, #79b6af) 14%, #f7f2ec));
  display: grid;
  place-items: center;
  position: relative;
}

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

.book-cover .fallback-cover {
  font-family: "Fraunces", serif;
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  color: rgba(39, 49, 58, 0.78);
}

.book-cover .fallback-cover.small {
  font-size: 1.5rem;
}

.book-card h4,
.detail-summary h3 {
  margin: 0;
  font-size: 1rem;
}

.book-card h4 {
  font-size: 0.95rem;
  line-height: 1.35;
}

.book-meta {
  font-size: 0.88rem;
  line-height: 1.45;
}

.book-meta-subtle {
  color: #5f6b75;
}

.book-meta,
.pill-row,
.detail-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill,
.mini-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(121, 182, 175, 0.14);
  color: #2d4c4a;
  font-size: 0.82rem;
  font-weight: 800;
}

.book-search-results {
  display: grid;
  gap: 10px;
}

.book-search-result {
  text-align: left;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(92, 104, 114, 0.12);
  background: rgba(255, 255, 255, 0.74);
  display: grid;
  gap: 4px;
}

.book-search-result.selected {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(121, 182, 175, 0.14);
}

.book-card:hover,
.book-card:focus-visible,
.bookcase-card:hover,
.stat-card:hover,
.metric-card:hover {
  transform: translateY(-2px);
}

.reader-card:hover,
.reader-card:focus-visible,
.add-option-card:hover,
.recent-book-btn:hover {
  transform: translateY(-2px);
}

.empty-state {
  padding: 28px;
  text-align: center;
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin-bottom: 16px;
}

.mini-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.metric-card ul {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
  display: grid;
  gap: 8px;
}

.reader-card {
  text-align: left;
  cursor: pointer;
}

.reader-card strong {
  display: block;
}

.reader-modal-meta {
  display: grid;
  gap: 8px;
}

.login-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: linear-gradient(180deg, rgba(247, 242, 236, 0.92), rgba(241, 231, 220, 0.95));
  z-index: 20;
}

.login-card {
  width: min(560px, 100%);
  padding: 26px;
  border-radius: 34px;
  display: grid;
  gap: 20px;
}

.passcode-dots {
  display: flex;
  gap: 14px;
  justify-content: center;
}

.dot {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(95, 159, 152, 0.44);
  background: rgba(255, 255, 255, 0.75);
}

.dot.filled {
  background: linear-gradient(135deg, rgba(121, 182, 175, 0.95), rgba(246, 211, 154, 0.95));
  box-shadow: 0 0 0 4px rgba(121, 182, 175, 0.14);
}

.login-status {
  min-height: 1.4em;
  text-align: center;
  color: var(--muted);
  margin: 0;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.key-btn {
  min-height: 58px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  font-weight: 900;
  border: 1px solid rgba(92, 104, 114, 0.12);
}

.key-enter {
  color: #22463f;
  background: linear-gradient(135deg, rgba(121, 182, 175, 0.56), rgba(246, 211, 154, 0.86));
}

.key-accent {
  color: #7a4552;
  background: rgba(242, 186, 195, 0.26);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 22px;
}

.hidden {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(43, 52, 56, 0.28);
  backdrop-filter: blur(5px);
}

.modal-card {
  position: relative;
  width: min(960px, 100%);
  max-height: min(92vh, 980px);
  overflow: auto;
  padding: 24px;
  border-radius: 34px;
  z-index: 1;
}

.modal-close {
  position: sticky;
  top: 0;
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  font-size: 1.4rem;
  line-height: 1;
}

.detail-summary {
  padding: 16px;
  margin-bottom: 18px;
}

.detail-summary h3 {
  font-size: clamp(1.5rem, 2.8vw, 2.35rem);
}

.detail-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.detail-field {
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
}

.detail-field span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: end;
}

.choice-modal-card {
  width: min(620px, 100%);
}

.choice-form {
  display: grid;
  gap: 16px;
}

.book-form-shell {
  gap: 18px;
}

.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wide-field {
  grid-column: 1 / -1;
}

.reader-fieldset {
  margin: 0;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid rgba(92, 104, 114, 0.12);
}

.reader-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.reader-grid label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  font-weight: 800;
}

.cover-preview {
  min-height: 180px;
  border-radius: 18px;
  border: 1px dashed rgba(92, 104, 114, 0.2);
  background: linear-gradient(145deg, rgba(121, 182, 175, 0.12), rgba(246, 211, 154, 0.14));
  overflow: hidden;
  display: grid;
  place-items: center;
}

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

.cover-placeholder {
  text-align: center;
  color: var(--muted);
  padding: 22px;
}

.form-actions {
  display: flex;
  justify-content: end;
  gap: 10px;
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 10px;
  z-index: 40;
}

.toast {
  padding: 12px 14px;
  border-radius: 16px;
  color: #21433e;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  border: 1px solid rgba(92, 104, 114, 0.12);
  animation: toast-in 260ms ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.shake {
  animation: shake 280ms ease;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-6px);
  }

  50% {
    transform: translateX(6px);
  }

  75% {
    transform: translateX(-3px);
  }
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: auto 12px 12px;
    z-index: 15;
    height: auto;
    padding: 12px;
    border-radius: 26px;
    border: 1px solid rgba(92, 104, 114, 0.12);
    box-shadow: var(--shadow);
    grid-template-columns: 1fr;
    background: rgba(255, 252, 248, 0.92);
  }

  .brand-block,
  .sidebar-card {
    display: none;
  }

  .side-nav {
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .nav-btn {
    text-align: center;
    padding: 12px 8px;
  }

  .main-column {
    padding-bottom: 114px;
  }
}

@media (max-width: 900px) {
  .topbar,
  .topbar-actions,
  .hero-card,
  .panel-header,
  .filters-row,
  .stat-row,
  .form-grid {
    grid-template-columns: 1fr;
    display: grid;
    align-items: start;
  }

  .topbar,
  .panel-header {
    gap: 14px;
  }

  .topbar-actions,
  .filters-row,
  .form-actions {
    justify-content: stretch;
  }

  .search-box {
    min-width: 0;
  }

  .dashboard-hero,
  .bookcase-section-header {
    grid-template-columns: 1fr;
    display: grid;
  }

  .dashboard-hero {
    flex-direction: column;
    align-items: start;
  }

  .wide-card {
    grid-column: auto;
  }

  .bookcase-library-card {
    grid-template-columns: 1fr;
  }

  .bookcase-cover {
    min-height: 180px;
  }
}

@media (max-width: 640px) {
  .main-column {
    padding: 18px 14px 120px;
  }

  .panel,
  .login-card,
  .modal-card {
    border-radius: 24px;
    padding: 18px;
  }

  .books-grid,
  .bookcase-library-grid,
  .dashboard-grid,
  .add-options-grid,
  .stats-grid,
  .mini-grid,
  .stat-row {
    grid-template-columns: 1fr;
  }

  .books-grid {
    grid-template-columns: 1fr;
    justify-content: stretch;
    justify-items: stretch;
  }

  #booksGrid {
    gap: 20px;
  }

  .book-card {
    max-width: none;
    min-height: 0;
  }

  .book-cover {
    height: auto;
  }

  .bookcase-section {
    padding: 16px;
  }

  .bookcase-cover {
    min-height: 120px;
  }

  .quick-add-menu {
    padding: 12px;
  }

  .menu-card {
    width: 100%;
  }

  .keypad {
    gap: 10px;
  }

  .key-btn {
    min-height: 52px;
  }

  .toast-stack {
    right: 10px;
    left: 10px;
    bottom: 96px;
  }
}