:root {
  --ink: #0b1426;
  --muted: #6b7280;
  --paper: #f7f3ff;
  --navy: #0f1f3a;
  --blue: #cfe5ff;
  --sky: #f2f7ff;
  --teal: #e6f8f1;
  --accent: #6d5efc;
  --glass: rgba(255, 255, 255, 0.9);
  --border: rgba(12, 22, 40, 0.12);
  --shadow: 0 20px 50px rgba(9, 20, 40, 0.14);
  --shadow-soft: 0 10px 24px rgba(9, 20, 40, 0.08);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --radius-btn: 10px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e9ecff;
  --muted: rgba(233, 236, 255, 0.72);
  --paper: #070a14;
  --navy: #e9ecff;
  --sky: rgba(18, 24, 40, 0.7);
  --glass: rgba(18, 24, 40, 0.86);
  --border: rgba(255, 255, 255, 0.14);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.42);
  --shadow-soft: 0 10px 24px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Work Sans", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top, rgba(109, 94, 252, 0.12), transparent 55%),
    radial-gradient(circle at 10% 20%, rgba(78, 156, 255, 0.14), transparent 50%),
    #f8f6ff;
  min-height: 100vh;
}

[data-theme="dark"] body {
  background:
    radial-gradient(circle at top, rgba(109, 94, 252, 0.18), transparent 55%),
    radial-gradient(circle at 10% 20%, rgba(78, 156, 255, 0.16), transparent 50%),
    #070a14;
}

h1,
h2,
h3,
h4 {
  font-family: "Spectral", serif;
  margin: 0;
}

p {
  margin: 0;
}

.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 4vw 60px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 28px;
  position: relative;
  z-index: 1;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-radius: var(--radius-lg);
  background: white;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  flex-wrap: wrap;
}

[data-theme="dark"] .topbar {
  background: rgba(18, 24, 40, 0.9);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  font-weight: 700;
  background: linear-gradient(135deg, #6d5efc, #4bb3ff);
  color: white;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.brand-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 0.7rem;
  color: var(--accent);
}

.brand-subtitle {
  color: #7b6b93;
  font-size: 0.85rem;
}

[data-theme="dark"] .brand-subtitle {
  color: rgba(233, 236, 255, 0.65);
}

.top-nav {
  display: flex;
  gap: 8px;
  background: #fff;
  padding: 6px;
  border-radius: var(--radius-btn);
}

[data-theme="dark"] .top-nav {
  background: rgba(18, 24, 40, 0.7);
}

.nav-link {
  border: none;
  background: transparent;
  padding: 8px 16px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-link.active {
  background: rgba(109, 94, 252, 0.12);
  color: var(--navy);
  box-shadow: 0 10px 20px rgba(12, 23, 44, 0.15);
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.user-chip {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(15, 31, 58, 0.08);
  color: var(--navy);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  line-height: 1.1;
  text-align: center;
}

[data-theme="dark"] .user-chip {
  background: rgba(233, 236, 255, 0.08);
}

.user-chip img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.ghost-button,
.solid-button {
  border: none;
  border-radius: var(--radius-btn);
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ghost-button {
  background: rgba(109, 94, 252, 0.12);
  color: var(--navy);
}

.solid-button {
  background: linear-gradient(135deg, #6d5efc, #4bb3ff);
  color: white;
  box-shadow: 0 12px 30px rgba(15, 31, 58, 0.22);
}

.ghost-button:hover,
.solid-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(12, 23, 44, 0.22);
}

.content {
  display: grid;
  gap: 28px;
}

.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  padding: 24px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #ffffff, rgba(109, 94, 252, 0.08));
  box-shadow: var(--shadow-soft);
}

.hero-tag {
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(15, 31, 58, 0.92);
  border: 1px solid rgba(15, 31, 58, 0.28);
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

[data-theme="dark"] .hero-tag {
  background: rgba(233, 236, 255, 0.12);
  border-color: rgba(233, 236, 255, 0.18);
}

.hero-copy {
  color: var(--muted);
  max-width: 480px;
}

.hero-card {
  background: linear-gradient(140deg, #5b3cc4, #7c5cff);
  color: white;
  padding: 20px;
  border-radius: var(--radius-md);
  display: grid;
  gap: 10px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.hero-label {
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.24em;
  color: rgba(255, 255, 255, 0.7);
}

.section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.section-kicker {
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin-bottom: 6px;
}

.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.field {
  display: grid;
  gap: 6px;
}

label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
}

input,
select {
  border: none;
  border-radius: var(--radius-btn);
  padding: 10px 16px;
  font-size: 1rem;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(15, 31, 58, 0.12);
}

[data-theme="dark"] input,
[data-theme="dark"] select {
  background: rgba(18, 24, 40, 0.72);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--border);
}

textarea {
  border: none;
  border-radius: var(--radius-btn);
  padding: 10px 14px;
  font-size: 0.95rem;
  font-family: "Work Sans", sans-serif;
  resize: vertical;
  min-height: 80px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(15, 31, 58, 0.12);
}

[data-theme="dark"] textarea {
  background: rgba(18, 24, 40, 0.72);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--border);
}

input:focus,
select:focus {
  outline: 2px solid rgba(78, 163, 255, 0.35);
  outline-offset: 2px;
}

.search-meta {
  color: var(--muted);
}

.section-header h3 {
  letter-spacing: 0.01em;
}

.status-message {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(15, 31, 58, 0.06);
  color: var(--navy);
  font-weight: 600;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
}

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

.user-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border);
}

.user-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: #eff4fb;
  border: 1px solid var(--border);
}

.user-avatar.placeholder {
  background: linear-gradient(135deg, #d8ebff, rgba(109, 94, 252, 0.18));
}

.book-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

[data-theme="dark"] .book-card,
[data-theme="dark"] .list-card,
[data-theme="dark"] .profile-card,
[data-theme="dark"] .public-list-card,
[data-theme="dark"] .modal-card {
  background: rgba(18, 24, 40, 0.9);
}

.book-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 40px rgba(12, 23, 44, 0.2);
}

.cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-sm);
  background: #eff4fb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Literata", serif;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 10px;
}

.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.book-title {
  font-family: "Literata", serif;
  font-size: 1rem;
  margin: 0;
}

.book-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.book-body {
  display: grid;
  gap: 4px;
  flex: 1;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
}

.menu {
  position: relative;
  flex: 1;
}

/* On book/list cards we want the menu panel to overlay the card, so the
   positioned ancestor should be the card (not the .menu wrapper). */
.book-card .menu,
.list-card .menu {
  position: static;
}

.menu-toggle {
  width: 100%;
  border: none;
  border-radius: var(--radius-btn);
  padding: 8px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  background: rgba(109, 94, 252, 0.14);
  color: var(--navy);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.menu-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(12, 23, 44, 0.18);
}

.menu-panel button {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.menu-panel button:hover {
  transform: translateY(-1px);
}

.menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 8px;
  display: grid;
  gap: 6px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border);
  z-index: 2;
}

[data-theme="dark"] .menu-panel {
  background: rgba(18, 24, 40, 0.96);
}

/* Book/list card menus: open as an overlay that covers the card (instead of
   expanding below it), while leaving the bottom action row clickable. */
.book-card .menu-panel,
.list-card .menu-panel {
  top: 16px;
  left: 16px;
  right: 16px;
  bottom: 64px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  overflow: auto;
  z-index: 10;
}

.menu-panel button {
  border: none;
  border-radius: var(--radius-btn);
  padding: 6px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  background: rgba(109, 94, 252, 0.12);
  color: var(--navy);
}

.menu-panel button:hover {
  box-shadow: 0 6px 14px rgba(12, 23, 44, 0.12);
}

.list-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.list-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: var(--radius-btn);
  background: rgba(15, 31, 58, 0.06);
}

.tab {
  border: none;
  border-radius: var(--radius-btn);
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.tab.active {
  background: var(--navy);
  color: white;
}

.list-tab-actions {
  display: flex;
  gap: 4px;
  position: relative;
}

.list-tab-actions .menu-toggle {
  border: none;
  border-radius: var(--radius-btn);
  padding: 6px 10px;
  font-size: 0.7rem;
  cursor: pointer;
  background: rgba(15, 31, 58, 0.12);
  color: var(--navy);
}

.list-tab-actions .menu-panel {
  min-width: 140px;
}

.list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.list-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 16px;
  display: grid;
  gap: 14px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border);
  position: relative;
}

.list-card .cover {
  aspect-ratio: 2.6 / 3.4;
}

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

.list-actions .menu {
  flex: 1;
}

.list-actions .menu-toggle {
  background: rgba(109, 94, 252, 0.12);
}

.list-actions .menu-panel button {
  background: rgba(109, 94, 252, 0.12);
}

.list-actions .menu-panel button:nth-child(2) {
  background: #d8ebff;
}

.list-actions .menu-panel button:nth-child(3) {
  background: #e6f8f1;
}

.list-actions button {
  border: none;
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.78rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.list-actions button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(12, 23, 44, 0.15);
}

.rating {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.rating-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.rating-star {
  border: none;
  background: rgba(15, 31, 58, 0.08);
  color: var(--navy);
  border-radius: var(--radius-btn);
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.8rem;
}

.rating-star.active {
  background: #ffd27a;
  color: #7a4b00;
}

.progress {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 31, 58, 0.04);
}

.progress-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.progress-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.progress-inputs label {
  display: grid;
  gap: 4px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.progress-inputs input {
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 0.85rem;
}

.progress-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 31, 58, 0.12);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #5bbcff, #7ad6ff);
}

.progress-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.favourite-button {
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1rem;
  cursor: pointer;
  background: rgba(15, 31, 58, 0.12);
  color: var(--navy);
}

.favourite-button.active {
  background: #ffdfdf;
  color: #c91c2c;
}

.book-card .favourite-button,
.list-card .favourite-button {
  position: absolute;
  top: 12px;
  right: 12px;
}

.sidebar {
  display: grid;
  gap: 18px;
}

.sidebar-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border);
}

[data-theme="dark"] .sidebar-card {
  background: rgba(18, 24, 40, 0.9);
}

.filters {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.filters label {
  display: grid;
  gap: 6px;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
}

.signal-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.signal-label {
  font-weight: 600;
}

.signal-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.footer {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.85rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 50;
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(15, 31, 58, 0.16);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 40px rgba(12, 23, 44, 0.22);
  color: var(--navy);
  font-weight: 600;
  text-align: center;
  backdrop-filter: blur(10px);
}

.toast.success {
  border-color: rgba(16, 124, 74, 0.22);
}

.toast.error {
  border-color: rgba(184, 31, 31, 0.24);
}

.profile-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border);
  display: grid;
  gap: 8px;
}

.profile-edit {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.profile-edit label {
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  display: grid;
  gap: 6px;
}

.profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.profile-photo {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  background: #eff4fb;
  border: 1px solid var(--border);
  display: none;
}

.profile-photo.is-visible {
  display: block;
}

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

.following-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
}

.public-list {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
}

[data-theme="dark"] .public-list {
  background: rgba(18, 24, 40, 0.9);
}

.public-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.public-lists {
  display: grid;
  gap: 10px;
}

.public-list-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--border);
}

.public-list-detail {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.public-list-detail h4 {
  font-size: 1.05rem;
}

.public-list-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.public-book-card {
  display: grid;
  gap: 6px;
  text-align: left;
  font-size: 0.8rem;
  color: var(--navy);
  cursor: pointer;
  position: relative;
  overflow: visible;
}

.public-book-card .menu-panel {
  z-index: 20;
}

.public-book-card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 10px;
}

.public-book-card span {
  display: grid;
  place-items: center;
  aspect-ratio: 3 / 4;
  border-radius: 10px;
  background: #eff4fb;
  color: var(--muted);
  padding: 6px;
}

.public-book {
  display: grid;
  gap: 6px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--navy);
}

.public-book img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 10px;
}

.public-book span {
  display: grid;
  place-items: center;
  aspect-ratio: 3 / 4;
  border-radius: 10px;
  background: #eff4fb;
  color: var(--muted);
  padding: 6px;
}

.profile-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 40, 0.35);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 10;
}

.modal-card {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, 0.96);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: grid;
  gap: 16px;
}

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

.book-modal-body {
  display: grid;
  grid-template-columns: minmax(0, 200px) minmax(0, 1fr);
  gap: 16px;
}

.book-modal-cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #cbdfff, #bfeaff);
  display: grid;
  place-items: center;
  color: var(--muted);
  padding: 10px;
}

.book-modal-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.book-modal-details {
  display: grid;
  gap: 10px;
}

.book-modal-actions {
  display: grid;
  gap: 8px;
}

.book-modal-menu {
  max-width: 260px;
}

.book-modal-description {
  color: var(--ink);
  line-height: 1.5;
}

.book-modal-subjects {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.book-modal-subjects span {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 31, 58, 0.08);
  font-size: 0.75rem;
  color: var(--navy);
}

.book-modal-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-close {
  border: none;
  background: rgba(15, 31, 58, 0.08);
  color: var(--navy);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}

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

.auth-error {
  color: #b42318;
  font-weight: 600;
}

.hidden {
  display: none;
}

@media (max-width: 1080px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    grid-column: 1 / -1;
  }

  .topbar {
    gap: 16px;
  }
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .top-nav {
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
  }

  .top-nav::-webkit-scrollbar {
    height: 6px;
  }

  .top-nav::-webkit-scrollbar-thumb {
    background: rgba(15, 31, 58, 0.2);
    border-radius: 999px;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .search-form {
    width: 100%;
  }

  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .list-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .profile-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .public-list-detail-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .book-modal-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .app {
    padding: 24px 4vw 48px;
  }

  .brand {
    width: 100%;
  }

  .brand h1 {
    font-size: 1.4rem;
  }

  .top-actions {
    gap: 8px;
  }

  .ghost-button,
  .solid-button {
    width: 100%;
    justify-content: center;
  }

  .user-chip {
    width: 100%;
    justify-content: center;
  }

  .menu-panel {
    position: static;
    box-shadow: none;
    border: 1px dashed var(--border);
  }
}
