/* The Gilded Grimoire — sky blue, lavender, pink, magenta (+ ink & white) */

:root {
  --sky: #4cbae7;
  --lavender: #c080fb;
  --pink: #ff82e6;
  --magenta: #ff1087;
  --deep: #4a1d6e;
  --sky-light: #b8e8fc;
  --lavender-mist: #f3ecfc;
  --black: #0a0a0a;
  --white: #fafaf9;
  --gray: #ebe8f4;
  --text: #1c1224;
  --radius: 12px;
  --font-display: "Georgia", "Times New Roman", serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;

  /* Semantic aliases used across components */
  --emerald: var(--sky);
  --emerald-dark: var(--deep);
  --emerald-light: var(--sky-light);
  --gold: var(--pink);
  --gold-dim: var(--magenta);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--white);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--pink);
  color: var(--black);
  padding: 0.5rem 1rem;
  z-index: 1000;
}
.skip-link:focus {
  left: 0;
}

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

.site-header {
  background: linear-gradient(135deg, #3d1560 0%, var(--lavender) 42%, var(--sky) 100%);
  color: var(--white);
  border-bottom: 3px solid var(--pink);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--white);
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
}

.brand-logo {
  border-radius: 8px;
  border: 2px solid var(--gold);
  display: block;
  flex-shrink: 0;
  object-fit: cover;
}

/* Homepage hero — banner on top, copy below */
.hero {
  overflow: hidden;
  border-radius: calc(var(--radius) + 4px);
  margin-bottom: 2rem;
  border: 2px solid var(--gold);
  background: var(--white);
}

.hero-banner {
  display: block;
  width: 100%;
  height: auto;
  min-height: 200px;
  max-height: 420px;
  object-fit: cover;
  object-position: center;
  border-bottom: 2px solid var(--gold);
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 1rem 1.25rem 1.15rem;
  text-align: center;
  color: var(--text);
  background: var(--white);
}

.hero h1 {
  font-family: var(--font-display);
  color: var(--deep);
  font-size: clamp(1.25rem, 3vw, 1.65rem);
  margin: 0;
}

.hero p {
  max-width: 480px;
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--text);
  opacity: 0.88;
}

.hero-content .btn {
  margin-top: 0.35rem;
}

.auth-logo {
  display: block;
  width: 80px;
  height: 80px;
  margin: 0 auto 1rem;
  border-radius: 12px;
  border: 3px solid var(--gold);
  box-shadow: 0 6px 18px rgba(74, 29, 110, 0.2);
  object-fit: cover;
}

.header-search {
  flex: 1 1 220px;
  display: flex;
  gap: 0.5rem;
  min-width: 0;
}

.header-search input[type="search"] {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  border: 2px solid var(--gold-dim);
  background: var(--white);
  color: var(--text);
}

.header-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.header-nav a {
  color: var(--white);
  text-decoration: none;
  font-weight: 500;
}
.header-nav a:hover,
.header-nav a:focus {
  text-decoration: underline;
  color: var(--gold);
}

.header-nav-icons {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.nav-icon-btn:hover,
.nav-icon-btn:focus {
  background: rgba(255, 255, 255, 0.22);
  border-color: var(--gold);
  color: var(--gold);
  text-decoration: none;
}

.nav-icon-svg {
  display: block;
}

.nav-toggle {
  display: none;
  background: transparent;
  color: var(--gold);
  border: 2px solid var(--gold);
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
}

.site-main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.site-footer {
  background: var(--black);
  color: var(--gray);
  border-top: 3px solid var(--gold);
  margin-top: auto;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
  text-align: center;
}

.footer-title {
  font-family: var(--font-display);
  color: var(--gold);
  margin: 0 0 1rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1rem;
}

.footer-nav a {
  color: var(--white);
  text-decoration: none;
}
.footer-nav a:hover {
  color: var(--gold);
}

.footer-copy {
  font-size: 0.85rem;
  margin: 0;
  opacity: 0.85;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  text-align: center;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.btn-gold {
  background: var(--pink);
  color: var(--black);
  border-color: var(--magenta);
}
.btn-gold:hover {
  background: var(--magenta);
  color: var(--white);
}

.btn-primary {
  background: var(--sky);
  color: var(--black);
  border-color: #2a9bc9;
}
.btn-primary:hover {
  background: var(--deep);
  color: var(--white);
  border-color: var(--deep);
}

.btn-outline {
  background: transparent;
  color: var(--white);
  border-color: var(--gold);
}
.btn-outline:hover {
  background: rgba(255, 130, 230, 0.2);
}

body:not(.admin-body) .btn-outline {
  color: var(--deep);
  border-color: var(--sky);
}
body:not(.admin-body) .btn-outline:hover {
  background: rgba(76, 186, 231, 0.15);
}

.btn-block {
  display: block;
  width: 100%;
}

/* Alerts */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  border: 2px solid;
}
.alert-error {
  background: #fef2f2;
  border-color: #b91c1c;
  color: #7f1d1d;
}
.alert-success {
  background: var(--lavender-mist);
  border-color: var(--lavender);
  color: var(--deep);
}

.category-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1.5rem;
  padding: 0.75rem;
  background: var(--gray);
  border-radius: var(--radius);
  border: 1px solid var(--gold-dim);
}

.category-bar span {
  font-weight: 700;
  color: var(--emerald-dark);
  margin-right: 0.5rem;
}

.category-pill {
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: var(--white);
  border: 2px solid var(--emerald);
  color: var(--emerald-dark);
  text-decoration: none;
  font-size: 0.9rem;
}
.category-pill:hover {
  background: var(--sky);
  color: var(--black);
}

.about-strip {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border: 2px solid var(--pink);
  background: linear-gradient(90deg, var(--white), var(--lavender-mist));
  margin-bottom: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.about-strip h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display), Georgia, serif;
  color: var(--deep);
}

.about-strip p {
  margin: 0;
}

.category-pill--end {
  margin-left: auto;
}

.book-card-author {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.85;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-card-rating {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
}

.book-card-body .book-price {
  margin: auto 0 0;
  padding-top: 0.5rem;
}

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

.section-head h2 {
  font-family: var(--font-display);
  color: var(--emerald-dark);
  margin: 0;
}

.promo-banner {
  margin: 2rem 0;
  padding: 1.25rem;
  border-radius: var(--radius);
  background: var(--black);
  color: var(--gold);
  border: 2px solid var(--gold);
  text-align: center;
  font-weight: 600;
}

.promo-codes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.promo-code-card {
  border-style: solid;
  margin: 0;
}

.promo-code-title {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--gold-dim);
}

.promo-code-discount {
  margin: 0;
  font-weight: 600;
}

.promo-code-valid {
  font-size: 0.85rem;
  opacity: 0.85;
  margin: 0.5rem 0 0;
}

.promo-books-section {
  margin-bottom: 2.5rem;
}

@media (max-width: 900px) {
  .promo-codes-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .promo-codes-grid {
    grid-template-columns: 1fr;
  }
}

.book-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.book-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 2px solid var(--gray);
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.book-card:hover {
  border-color: var(--pink);
  box-shadow: 0 8px 24px rgba(192, 128, 251, 0.22);
}

.book-card a {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.book-card img,
.book-cover-img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  background: var(--gray);
}

.book-detail .book-cover-img {
  max-width: 280px;
  border-radius: var(--radius);
  border: 3px solid var(--gold);
}

.book-cover-img--cart {
  width: 64px;
  max-width: 64px;
  height: 85px;
  aspect-ratio: auto;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.book-cover-img--cart.book-cover-placeholder {
  width: 64px;
  height: 85px;
}

.book-cover-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.5rem;
  box-sizing: border-box;
  background: linear-gradient(135deg, var(--emerald-dark, #14532d), var(--deep, #1f2a44));
  color: var(--gold, #d4af37);
  font-family: var(--font-display), Georgia, serif;
  overflow: hidden;
}

.book-cover-placeholder-text {
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-cover-img--cart.book-cover-placeholder .book-cover-placeholder-text,
.admin-cover-preview.book-cover-placeholder .book-cover-placeholder-text {
  font-size: 0.55rem;
  -webkit-line-clamp: 3;
}

.series-badge {
  display: inline-block;
  margin: 0 0 0.75rem;
  padding: 0.25rem 0.65rem;
  background: var(--lavender-mist);
  border-left: 3px solid var(--lavender);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--deep);
}

.series-section {
  margin: 2rem 0 1.5rem;
}

.recommendations-lead {
  margin: -0.5rem 0 1rem;
  font-size: 0.92rem;
  color: var(--text);
  opacity: 0.9;
}

.admin-cover-preview {
  width: 48px;
  max-width: 48px;
  height: 64px;
  aspect-ratio: auto;
  flex-shrink: 0;
  vertical-align: middle;
  margin-left: 0.5rem;
  border-radius: 4px;
  object-fit: cover;
}

.book-card-body {
  padding: 0.65rem 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

.book-card-body h3 {
  font-size: 0.95rem;
  margin: 0 0 0.25rem;
  line-height: 1.25;
}

.book-card-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(2 * 0.95rem * 1.25);
}

.book-price {
  font-weight: 700;
  color: var(--emerald-dark);
}

/* Catalogue layout */
.catalogue-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 800px) {
  .catalogue-layout {
    grid-template-columns: 1fr;
  }
  .nav-toggle {
    display: block;
  }
  .header-nav {
    display: none;
  }
  .header-nav.is-open {
    display: flex;
    flex-direction: column;
    width: 100%;
  }
}

.filter-sidebar {
  background: var(--gray);
  border-radius: var(--radius);
  padding: 1rem;
  border: 2px solid var(--emerald);
  position: sticky;
  top: 5rem;
}

.filter-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.filter-sidebar h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: var(--emerald-dark);
}

.filter-sidebar-head h2 {
  margin: 0 0 0.75rem;
}

/* Mobile-only controls — hidden on desktop */
.filter-toggle,
.filter-close {
  display: none;
}

.filter-toggle {
  padding: 0.6rem 1.1rem;
  font-weight: 700;
  color: var(--white);
  background: var(--emerald);
  border: 2px solid var(--emerald-dark);
  border-radius: var(--radius);
  cursor: pointer;
}

/* Filter sidebar becomes an off-canvas pop-out drawer on mobile.
   Placed after the base .filter-sidebar / .filter-toggle rules so these win. */
@media (max-width: 800px) {
  .filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
  }
  .filter-toggle-icon {
    font-size: 1.1rem;
    line-height: 1;
  }
  .filter-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    margin: 0 0 0.75rem;
    font-size: 1.5rem;
    line-height: 1;
    background: transparent;
    border: none;
    color: var(--emerald-dark);
    cursor: pointer;
  }
  .filter-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(85vw, 320px);
    max-width: 320px;
    margin: 0;
    border-radius: 0;
    border-right: 2px solid var(--emerald);
    overflow-y: auto;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
  }
  .filter-sidebar.is-open {
    transform: translateX(0);
  }
  .filter-backdrop.is-open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
  }
  body.filter-open {
    overflow: hidden;
  }
}

.filter-backdrop {
  display: none;
}

.filter-group {
  margin-bottom: 1rem;
}
.filter-group h3 {
  font-size: 0.85rem;
  margin: 0 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--black);
}
.filter-group label {
  display: block;
  font-size: 0.9rem;
  margin: 0.2rem 0;
  cursor: pointer;
}

.catalogue-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.25rem;
}

/* Genre groups: heading + horizontal "rolling" rail (5 cards per row) */
.genre-section {
  margin-bottom: 2rem;
}

.genre-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 4 * 1rem) / 5);
  gap: 1rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  padding-bottom: 0.85rem;
  -webkit-overflow-scrolling: touch;
}

.genre-rail .book-card {
  scroll-snap-align: start;
}

@media (max-width: 1100px) {
  .genre-rail {
    grid-auto-columns: calc((100% - 3 * 1rem) / 4);
  }
}

@media (max-width: 900px) {
  .genre-rail {
    grid-auto-columns: calc((100% - 2 * 1rem) / 3);
  }
}

@media (max-width: 600px) {
  .genre-rail {
    grid-auto-columns: calc((100% - 1.2 * 1rem) / 2.2);
  }
}

/* Book detail */
.book-detail {
  display: grid;
  grid-template-columns: minmax(200px, 280px) 1fr;
  gap: 2rem;
}

@media (max-width: 700px) {
  .book-detail {
    grid-template-columns: 1fr;
  }
}

.book-detail-cover {
  border-radius: var(--radius);
  border: 3px solid var(--gold);
  width: 100%;
  max-width: 280px;
}

.meta-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}
.meta-list li {
  margin-bottom: 0.35rem;
}

.star-rating {
  color: var(--gold);
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem 1rem;
}
.form-grid .full {
  grid-column: 1 / -1;
}

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

label {
  font-weight: 600;
  font-size: 0.9rem;
}

.field-hint {
  display: block;
  margin: 0.2rem 0 0.35rem;
  font-size: 0.85rem;
  font-weight: 400;
  opacity: 0.85;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 2px solid var(--gray);
  font-family: inherit;
  background: var(--white);
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--gold);
  border-color: var(--emerald);
}

/* Cart & checkout */
.two-col {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}

.panel {
  border: 2px dashed var(--emerald);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  background: var(--white);
}

.panel--solid {
  border-style: solid;
}

.panel--spaced {
  margin-bottom: 1rem;
}

.panel--sticky {
  position: sticky;
  top: 5.5rem;
}

.panel--narrow {
  max-width: 720px;
}

.panel-heading {
  margin-top: 0;
  font-family: var(--font-display), Georgia, serif;
  color: var(--emerald-dark);
}

.panel-heading--sm {
  font-size: 1.1rem;
}

.book-detail-title {
  margin-top: 0;
}

.page-title {
  font-family: var(--font-display), Georgia, serif;
  color: var(--emerald-dark);
}

.section-title {
  font-family: var(--font-display), Georgia, serif;
  color: var(--emerald-dark);
}

.two-col--equal {
  grid-template-columns: 1fr 1fr;
}

.field-stack label + label,
.field-stack label + input,
.field-stack label + textarea {
  display: block;
  margin-top: 0.5rem;
}

.field-stack label:first-child {
  margin-top: 0;
}

.btn-stack {
  margin-top: 0.75rem;
}

.profile-header-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.profile-name {
  margin: 0;
  font-family: var(--font-display), Georgia, serif;
  color: var(--emerald-dark);
}

.profile-email {
  margin: 0.25rem 0;
}

.profile-meta {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.85;
}

.checkout-demo-note {
  font-size: 0.9rem;
  margin-top: 0;
}

.panel-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  border: 2px dashed var(--gold-dim);
  padding: 0.2rem 0.5rem;
  margin-bottom: 0.75rem;
  color: var(--emerald-dark);
}

.cart-line {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--gray);
  align-items: center;
}

.cart-line img {
  width: 72px;
  height: 96px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--gold-dim);
}

.qty-control {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.5rem;
}
.qty-control button {
  width: 2rem;
  height: 2rem;
  border-radius: 6px;
  border: 2px solid var(--emerald);
  background: var(--white);
  cursor: pointer;
  font-weight: 700;
}
.qty-control button:hover {
  background: var(--emerald);
  color: var(--white);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin: 0.35rem 0;
}
.summary-total {
  font-size: 1.35rem;
  font-weight: 800;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 2px solid var(--gold);
}

/* Checkout steps */
.checkout-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  justify-content: center;
}
.checkout-steps span {
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  border: 2px solid var(--gray);
  font-size: 0.85rem;
  font-weight: 600;
}
.checkout-steps span.active {
  background: var(--black);
  color: var(--gold);
  border-color: var(--gold);
}

.checkout-summary-line {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  align-items: center;
}

.checkout-summary-line .book-cover-img--cart {
  width: 48px;
  max-width: 48px;
  height: 64px;
}

.checkout-summary-line .book-cover-img--cart.book-cover-placeholder {
  width: 48px;
  height: 64px;
}

.checkout-summary-body {
  flex: 1;
  min-width: 0;
}

.checkout-summary-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.checkout-summary-qty {
  font-size: 0.8rem;
}

.checkout-summary-price {
  font-weight: 700;
}

.checkout-submit-btn {
  margin-top: 1.25rem;
  font-size: 1.05rem;
}

.checkout-collection-form label + label,
.checkout-collection-form label + input,
.checkout-collection-form label + textarea {
  margin-top: 0.75rem;
}

.field-stack-label {
  display: block;
  margin-top: 0.75rem;
}

.qty-control-link {
  text-decoration: none;
  padding: 0.2rem 0.5rem;
}

.qty-value {
  min-width: 1.5rem;
  text-align: center;
  font-weight: 700;
}

.cart-remove-link {
  font-size: 0.85rem;
}

.cart-line-total {
  font-weight: 700;
  text-align: right;
}

.cart-line-unit {
  font-size: 0.8rem;
  font-weight: 500;
}

.promo-section {
  margin-top: 1rem;
}

.promo-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.promo-clear-note {
  font-size: 0.85rem;
}

.btn-block-spaced {
  margin-top: 1.25rem;
}

.btn-block-spaced-sm {
  margin-top: 0.75rem;
}

.book-detail-author {
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
}

.star-rating-score {
  color: var(--text);
  font-weight: 600;
}

.book-actions-form {
  margin-top: 1rem;
}

.book-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1rem;
}

.qty-input-sm {
  width: 4rem;
}

.reviews-section {
  margin-top: 2rem;
}

.review-date {
  font-size: 0.85rem;
  opacity: 0.8;
}

.review-comment {
  margin: 0.35rem 0 0;
}

.review-form-title {
  margin-top: 1rem;
}

.is-hidden {
  display: none !important;
}

.payment-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 1rem;
}
.payment-toggle label {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 2px solid var(--emerald);
  cursor: pointer;
  font-weight: 600;
}
.payment-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.payment-toggle label:has(input:checked) {
  background: var(--emerald);
  color: var(--white);
  border-color: var(--gold);
}

/* Fake card section */
.fake-card-fields {
  padding: 1rem;
  background: var(--black);
  color: var(--white);
  border-radius: var(--radius);
  border: 2px solid var(--gold);
  margin-top: 0.75rem;
}
.fake-card-fields p {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--gold);
}

/* Profile */
.profile-header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem;
  border: 2px dashed var(--emerald);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid var(--gold);
  object-fit: cover;
}

.avatar--initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--emerald-dark, #14532d), var(--deep, #1f2a44));
  color: var(--gold, #d4af37);
  font-family: var(--font-display), Georgia, serif;
  font-size: 1.75rem;
  font-weight: 700;
  box-sizing: border-box;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--gray);
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--gold-dim);
  font-weight: 600;
}

.profile-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1.5rem;
}

@media (max-width: 700px) {
  .profile-layout {
    grid-template-columns: 1fr;
  }
}

.account-menu {
  border: 2px dashed var(--gold);
  border-radius: var(--radius);
  padding: 0.75rem;
}
.account-menu a {
  display: block;
  padding: 0.45rem 0.5rem;
  color: var(--emerald-dark);
  text-decoration: none;
  border-radius: 6px;
}
.account-menu a:hover,
.account-menu a.active {
  background: var(--emerald);
  color: var(--white);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.data-table th,
.data-table td {
  padding: 0.6rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--gray);
}
.data-table th {
  background: var(--gray);
  color: var(--emerald-dark);
}

.status-pill {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
}
.status-delivered {
  background: var(--emerald-light);
  color: var(--black);
}
.status-shipped {
  background: #e9d5ff;
  color: var(--deep);
}
.status-pending {
  background: #fde68a;
  color: var(--black);
}

/* Admin */
body.admin-body {
  background: var(--lavender-mist);
}

body.admin-body .site-header .header-inner {
  max-width: min(1680px, 100%);
}

.admin-top-nav {
  gap: 0.35rem 1rem;
}

.admin-top-nav-user {
  opacity: 0.92;
  font-size: 0.9rem;
  padding: 0 0.25rem;
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-shell {
  display: grid;
  grid-template-columns: 1fr;
  min-height: calc(100vh - 80px);
  max-width: 1680px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
  gap: 1.25rem;
  align-items: start;
}

@media (min-width: 901px) {
  .admin-shell {
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 1.75rem;
    padding: 1.25rem clamp(1rem, 2.5vw, 2.5rem) 2.5rem;
  }

  .admin-sidebar {
    position: sticky;
    top: 5.75rem;
    align-self: start;
    max-height: calc(100vh - 6.5rem);
    overflow-y: auto;
    border-radius: 16px;
    border: 2px solid var(--pink);
    box-shadow: 0 8px 32px rgba(74, 29, 110, 0.12);
  }

  .admin-main {
    background: var(--white);
    border-radius: 16px;
    border: 2px solid var(--gray);
    box-shadow: 0 12px 48px rgba(74, 29, 110, 0.08);
    padding: 2rem clamp(1.5rem, 3vw, 2.75rem) 2.75rem;
    min-height: min(70vh, calc(100vh - 8rem));
  }
}

@media (max-width: 900px) {
  .admin-shell {
    padding-top: 0.75rem;
  }

  .admin-sidebar {
    position: static;
    max-height: none;
    border-radius: 14px;
    border: 2px solid var(--pink);
    box-shadow: 0 6px 24px rgba(74, 29, 110, 0.1);
  }

  .admin-main {
    padding: 1.25rem 1rem 2rem;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
  }
}

.admin-sidebar {
  background: var(--black);
  color: var(--white);
  padding: 1.15rem 0;
  border-right: none;
}

.admin-sidebar h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--pink);
  padding: 0 1.15rem 1rem;
  margin: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 0.35rem;
}

.admin-sidebar a {
  display: block;
  padding: 0.65rem 1.15rem;
  margin: 0.15rem 0.5rem;
  color: var(--white);
  text-decoration: none;
  border-radius: 10px;
  border-left: 3px solid transparent;
  font-weight: 500;
}
.admin-sidebar a:hover {
  background: rgba(255, 130, 230, 0.12);
  color: var(--pink);
}
.admin-sidebar a.active {
  background: rgba(192, 128, 251, 0.22);
  border-left-color: var(--lavender);
  color: var(--lavender);
}

.admin-main {
  padding: 1.25rem 1rem 2rem;
  min-width: 0;
}

/* admin dashboard */
.admin-dashboard {
  max-width: none;
}

.admin-dashboard-head {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 2px dashed var(--gray);
}

.admin-dashboard-title {
  font-family: var(--font-display);
  color: var(--deep);
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  margin: 0 0 0.35rem;
  font-weight: 700;
}

.admin-dashboard-sub {
  margin: 0;
  font-size: 0.95rem;
  color: #6b5c7d;
}

.admin-timeframe {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-bottom: 2rem;
  padding: 1rem 1.35rem;
  background: var(--lavender-mist);
  border-radius: 14px;
  border: 2px solid var(--gray);
}

.admin-timeframe-label {
  font-weight: 800;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--deep);
}

.admin-timeframe-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.admin-timeframe-form input[type="date"] {
  width: auto;
  min-width: 11rem;
  border-color: var(--lavender);
}

.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

@media (max-width: 1000px) {
  .dashboard-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .dashboard-cards {
    grid-template-columns: 1fr;
  }
}

.dash-card {
  background: var(--white);
  border-radius: 14px;
  padding: 1.35rem 1.4rem 1.25rem;
  min-height: 128px;
  border: 2px solid var(--gray);
  box-shadow: 0 4px 16px rgba(74, 29, 110, 0.06);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0.5rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.dash-card:hover {
  border-color: var(--lavender);
  box-shadow: 0 8px 28px rgba(192, 128, 251, 0.15);
}

.dash-card--highlight {
  border-color: var(--sky);
  background: linear-gradient(145deg, #f8fcff 0%, var(--white) 55%);
}

.dash-card--muted {
  opacity: 0.92;
  background: var(--lavender-mist);
}

.dash-card-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #6b5c7d;
  line-height: 1.3;
}

.dash-card-value {
  display: block;
  font-size: clamp(1.85rem, 3.2vw, 2.35rem);
  font-weight: 800;
  color: var(--deep);
  line-height: 1.1;
  margin-top: auto;
}

.dash-card-value--money {
  color: var(--deep);
  letter-spacing: -0.02em;
}

/* Reports (cards are direct child of .admin-main, not inside .admin-dashboard) */
.admin-main > .dashboard-cards {
  margin-top: 0.5rem;
}

.admin-table-wrap {
  overflow-x: auto;
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--gray);
}

.inline-form {
  display: inline;
}

/* Login / register — centered auth layout */
.site-main:has(.auth-shell) {
  max-width: none;
  width: 100%;
  padding-left: 0;
  padding-right: 0;
}

.auth-shell {
  min-height: min(70vh, calc(100vh - 12rem));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem 3rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  text-align: center;
}

.auth-title {
  font-family: var(--font-display);
  color: var(--emerald-dark);
  font-size: clamp(1.75rem, 4vw, 2.125rem);
  margin: 0 0 0.35rem;
}

.auth-lead {
  margin: 0 0 1.5rem;
  color: #57534e;
  font-size: 0.95rem;
}

.auth-form {
  text-align: left;
  border-style: solid;
  border-width: 2px;
  border-color: var(--gold-dim);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.5rem 1.35rem;
  background: var(--white);
  box-shadow: 0 12px 40px rgba(192, 128, 251, 0.18);
}

.auth-form-grid {
  grid-template-columns: 1fr;
  gap: 1rem;
}

.auth-footer-text {
  margin: 1.25rem 0 0;
  font-size: 0.95rem;
}

.auth-footer-text a {
  color: var(--emerald-dark);
  font-weight: 600;
}

/* Discount pricing */
.price-wrap {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
}
.price-was {
  text-decoration: line-through;
  opacity: 0.65;
  font-size: 0.92em;
}
.price-now {
  color: var(--magenta);
  font-weight: 800;
}
.book-card {
  position: relative;
}
.sale-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 1;
  background: var(--magenta);
  color: var(--white);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
}

.coming-soon-label {
  font-size: 0.75rem;
  color: #ff1087;
  font-weight: 600;
}

/* Password show/hide */
.password-field {
  position: relative;
  display: flex;
  align-items: stretch;
}
.password-field .password-input {
  flex: 1;
  padding-right: 4.5rem;
}
.password-toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid var(--sky);
  background: var(--white);
  color: var(--deep);
  border-radius: 6px;
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}
.password-toggle:hover {
  background: rgba(76, 186, 231, 0.12);
}

/* Footer social icons */
.footer-social {
  display: flex;
  justify-content: center;
  gap: 0.85rem;
  margin-bottom: 1rem;
}
.footer-social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  transition: background 0.15s, color 0.15s;
}
.footer-social-link:hover {
  background: rgba(255, 130, 230, 0.15);
  color: var(--white);
}

/* Profile order history */
.order-history-card {
  border-top: 1px solid var(--gray);
  padding: 1rem 0;
}
.order-history-card:first-of-type {
  border-top: 0;
}
.order-history-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.5rem;
}
.order-history-date {
  margin-left: 0.5rem;
  font-size: 0.85rem;
  opacity: 0.8;
}
.order-history-total {
  margin-left: 0.75rem;
}
.order-line-meta {
  display: block;
  font-size: 0.85rem;
  opacity: 0.85;
}
.order-history-store {
  font-size: 0.9rem;
  margin: 0.5rem 0 0;
}
.profile-settings-form {
  max-width: 480px;
  grid-template-columns: 1fr;
}
.profile-settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}
.order-items-list {
  margin: 0;
  padding-left: 1.1rem;
}
.order-items-list li {
  margin-bottom: 0.35rem;
}

/* Admin form Save/Cancel parity */
.admin-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}
.admin-form-actions .btn {
  min-width: 7.5rem;
  text-align: center;
}
.admin-body .admin-form-actions .btn-outline {
  color: var(--deep);
  border-color: var(--sky);
  background: var(--white);
}
.admin-body .admin-form-actions .btn-outline:hover {
  background: rgba(76, 186, 231, 0.12);
}
.return-actions {
  display: inline-flex;
  gap: 0.35rem;
}
.admin-row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.admin-row-actions .btn {
  min-width: 4.75rem;
  text-align: center;
}
.admin-inventory-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin: 1.25rem 0 0.75rem;
}
.admin-inventory-toolbar .admin-section-title {
  margin: 0;
}
.admin-search-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.admin-search-bar input[type="search"] {
  min-width: min(100%, 260px);
}
.admin-orders-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
  padding: 1rem 1.35rem;
  background: var(--lavender-mist);
  border-radius: 14px;
  border: 2px solid var(--gray);
}
.admin-orders-filter input[type="search"],
.admin-orders-filter input[type="date"] {
  width: auto;
  min-width: 11rem;
}
.admin-orders-filter select {
  width: auto;
  min-width: 10rem;
}
.admin-empty-note {
  margin: 0 0 1rem;
  color: #6b5c7d;
}
.price-tbd {
  font-style: italic;
  color: #6b5c7d;
}
.availability-note {
  margin: 1rem 0 0;
  padding: 0.75rem 1rem;
  background: var(--lavender-mist);
  border-radius: 10px;
  border: 1px solid var(--gray);
}
.review-item {
  border-bottom: 1px solid var(--gray);
  padding: 0.75rem 0;
}
.review-item-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.admin-timeframe-form,
.admin-filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 1.5rem;
}

.empty-state {
  padding: 1rem;
}

.returns-history-table {
  border: 0;
  margin-bottom: 1.5rem;
}

.return-disclaimer {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.85rem;
  background: rgba(255, 16, 135, 0.08);
  border-left: 3px solid var(--magenta);
  font-size: 0.92rem;
}
.return-disclaimer--inline {
  margin: 0.35rem 0 0.5rem;
}
.return-item-picker {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
}
.return-item-picker legend {
  font-weight: 600;
  padding: 0 0.25rem;
}
.return-item-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.return-item-row:last-child {
  border-bottom: 0;
}
.return-item-row input[type="checkbox"] {
  flex-shrink: 0;
}
.return-item-label {
  flex: 1 1 12rem;
  min-width: 0;
}
.return-item-label small {
  display: block;
  color: var(--text-muted, #666);
  margin-top: 0.15rem;
}
.return-item-qty-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
}
.return-item-qty {
  width: 3.5rem;
  padding: 0.25rem 0.4rem;
}
.return-item-max {
  color: var(--text-muted, #666);
  font-size: 0.85rem;
}
.status-cancelled {
  background: #fde8f3;
  color: #9b1d5a;
}
