/* Second UI polish pass: interactive feedback, bigger uncropped card covers,
   distinct header bubble colors, tighter filters, horizontally-scrolling
   homepage collections. Loaded last so it wins the cascade cleanly. */

/* --- Universal interactive feedback: every button/link-button/nav icon --- */
button,
.btn,
.nav-icon,
.header-filters-button,
.site-search-submit,
.card-cart-button,
.heart-button,
.edition-cart-button,
.store-link,
.link-button,
.wishlist-primary,
a.badge {
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease,
    border-color 0.12s ease, color 0.12s ease, opacity 0.12s ease;
}
button:not(:disabled):hover,
.btn:hover,
.nav-icon:hover,
.card-cart-button:hover,
.heart-button:hover,
.edition-cart-button:hover,
.store-link:hover,
.wishlist-primary:hover {
  transform: translateY(-1px);
}
button:not(:disabled):active,
.btn:active,
.nav-icon:active,
.card-cart-button:active,
.heart-button:active,
.edition-cart-button:active,
.store-link:active,
.wishlist-primary:active {
  transform: translateY(1px);
  transition-duration: 0.05s;
}
a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent, #a74434);
  outline-offset: 2px;
}

/* .heart-button styling moved to book-card.css 2026-07-22. */

/* --- Header bubbles: cart most prominent, then wishlist, then notifications --- */
.nav-icon {
  position: relative;
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  line-height: 0;
  /* Most nav icons are <a> tags with no native chrome to begin with; the
     notification bell is a real <button> (it opens a dropdown, not a link),
     so it needs its own reset or the browser's default button background/
     border/font/text-color show through, distinct from every other icon
     here. `color:inherit` alone isn't enough - style.css's `.nav-links a`
     rule (color:#5e554e) only ever matched <a> tags, so a plain button
     fell back to the ancestor's darker body ink instead of matching. */
  border: 0;
  background: transparent;
  padding: 0;
  color: #5e554e;
  font: inherit;
  cursor: pointer;
}
.nav-icon[aria-expanded="true"] {
  background: #efe4d3;
  border-radius: 999px;
}
.nav-icon .icon {
  display: block;
  width: 23px;
  height: 23px;
  margin: 0;
}
.nav-icon > b {
  border-width: 2px;
}
/* style.css's `.nav-icon > b { display:grid }` outranks the browser's own
   [hidden] rule (a class+element selector beats a bare attribute selector),
   so a badge holding "0" stayed visible even though the template already
   marks it hidden. Restore the hide. */
.nav-icon > b[hidden] {
  display: none !important;
}
.nav-icon[href*="/cart"] > b {
  background: #a74434;
}
.nav-icon[href*="/wishlist"] > b {
  background: #c78a2e;
}
.nav-icon[data-nav="notifications"] > b {
  background: #3a6ea5;
}

/* --- Discount tag: overlaid on the cover, top-left --- */
.card-discount-tag {
  position: absolute;
  z-index: 7;
  top: 18px;
  left: 18px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #a74434;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  box-shadow: 0 4px 12px rgba(55, 39, 26, 0.2);
}

/* Book-card price row/counts/cover rules all moved to book-card.css
   2026-07-22 (single source of truth for the whole card component). */

/* Card cover fixes (empty-space gap, hover-crop bug) moved to
   book-card.css 2026-07-22, along with the reasoning behind each. */

/* --- Filters: compact, dropdown never wider than its button --- */
.filter-grid {
  gap: 8px;
}
.facet-popover {
  min-width: 0;
}
.facet-options label {
  padding: 6px 7px;
  font-size: 0.82rem;
}

/* The availability toggle gets a visibly different treatment from the
   facet dropdown buttons, so the filter row isn't a wall of identical-
   looking pills (price now has its own dedicated slider styling below). */
.stock-check {
  background: #eef6ee !important;
  border-color: #bfdcc2 !important;
}
.stock-check input[type="checkbox"] {
  accent-color: #2f7a45;
}

/* Homepage collection scroll-row (.scroll-row-wrap/.book-row-scroll/
   .scroll-arrow*) moved to book-card.css 2026-07-22. */

/* --- 404/500 error pages --- */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 480px;
  margin: 60px auto;
  padding: 40px;
  text-align: center;
}
.error-code {
  font-family: Literata, Georgia, serif;
  font-size: 4rem;
  font-weight: 800;
  color: var(--accent, #a74434);
  opacity: 0.4;
  line-height: 1;
}
.error-page h1 {
  margin: 0;
}
.error-page p {
  color: var(--muted);
}
.error-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}

/* --- Shops page: had no dedicated styling at all before (plain stacked
   list, generic .status pill inherited from jobs.css) --- */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 14px;
}
.shop-grid .panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
}
.shop-grid .panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.shop-grid .panel-title h2 {
  margin: 0;
  font-size: 1.05rem;
}
.shop-grid .status {
  padding: 4px 10px;
  border-radius: 999px;
  background: #eee9e3;
  color: var(--muted, #7b7067);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}
.shop-grid .status.ok {
  background: #dff1e5;
  color: #17663f;
}
.shop-grid .status.pending {
  background: #fbeee0;
  color: #8a5a1f;
  cursor: help;
}
.shop-grid a {
  color: var(--accent, #a74434);
  font-weight: 700;
  text-decoration: none;
}
.shop-grid a:hover {
  text-decoration: underline;
}
.shop-grid p {
  margin: 0;
  font-size: 0.85rem;
}
.shop-grid .shop-edit {
  margin-top: 6px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.shop-grid .shop-edit summary {
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent, #a74434);
}
.shop-edit-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.shop-edit-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--muted, #7b7067);
  font-weight: 700;
}
.shop-edit-form input[type="text"],
.shop-edit-form input[type="url"],
.shop-edit-form input[type="number"],
.shop-edit-form select {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-weight: 400;
  color: var(--ink);
}
.delivery-method-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.delivery-method-list li {
  font-size: 0.82rem;
  color: var(--muted, #7b7067);
}
.delivery-method-table {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
  font-size: 0.78rem;
}
.delivery-method-table th,
.delivery-method-table td {
  padding: 5px 6px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.delivery-method-table th {
  color: var(--muted, #7b7067);
  font-weight: 700;
}
.delivery-method-table button {
  border: 0;
  background: transparent;
  color: var(--accent, #a74434);
  cursor: pointer;
  font-weight: 700;
}
.delivery-method-form {
  margin-top: 10px;
  border-top: 1px dashed var(--line);
  padding-top: 8px;
}
.shop-edit-checkbox {
  flex-direction: row !important;
  align-items: center;
  gap: 6px !important;
}
.shop-edit-form button {
  align-self: flex-start;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* --- Search-as-you-type results: same visual language as the wishlist
   rows (rounded cover thumb, title/author stack, bold price) instead of
   the old dense single-line list. --- */
.suggestion-item {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line, #eee5dc);
  border-radius: 12px;
  color: #302720;
  text-decoration: none;
  transition: background-color 0.12s ease;
}
.suggestion-item:first-child {
  margin-top: 4px;
}
.suggestion-item:hover,
.suggestion-item.active {
  background: #f4eee4;
}
.suggestion-cover {
  display: grid;
  width: 56px;
  height: 78px;
  place-items: center;
  overflow: hidden;
  border-radius: 10px;
  background: linear-gradient(145deg, #efe4d3, #f7f1e7);
}
.suggestion-cover img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.suggestion-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}
.suggestion-copy strong {
  display: -webkit-box;
  overflow: hidden;
  color: #211a14;
  font-family: "Literata", Georgia, serif;
  font-size: 0.86rem;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.suggestion-copy small {
  overflow: hidden;
  color: var(--muted, #81746b);
  font-size: 0.74rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.suggestion-price {
  flex: 0 0 auto;
  color: #211a14;
  font-family: "Literata", Georgia, serif;
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
}
.suggestion-price.price-discounted {
  color: var(--red, #a74434);
}
.suggestion-item.out-of-stock {
  opacity: 0.55;
}
.suggestion-item.out-of-stock .suggestion-price {
  font-weight: 500;
}

/* .unified-book-card price color rule moved to book-card.css 2026-07-22. */
.offer-price-main {
  color: #211a14;
}
.offer-price-main.price-discounted {
  color: var(--red, #a74434);
}

/* --- Merge review: one duplicate-book candidate at a time, human decides --- */
.merge-review-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 10px;
}
.merge-review-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.merge-review-score {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}
.merge-review-score strong {
  font-family: Literata, Georgia, serif;
  font-size: 1.3rem;
  color: var(--accent, #a74434);
}
.merge-review-score small {
  margin-left: auto;
  text-align: right;
}
.merge-review-pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}
.merge-review-book {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-width: 0;
}
.merge-review-book img,
.merge-review-book .book-cover-placeholder {
  flex: 0 0 auto;
  width: 56px;
  height: 78px;
  border-radius: 8px;
  object-fit: contain;
  background: #f4eadc;
}
.merge-review-book h3 {
  margin: 0 0 3px;
  font-size: 0.92rem;
  line-height: 1.3;
}
.merge-review-book p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.8rem;
}
.merge-review-book small {
  color: var(--muted);
  font-size: 0.7rem;
}
.merge-review-vs {
  color: var(--muted);
  font-weight: 800;
  font-size: 0.8rem;
  text-transform: uppercase;
}
.merge-review-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.merge-review-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.merge-review-actions button {
  border: 0;
  border-radius: 10px;
  padding: 9px 16px;
  font-weight: 750;
  cursor: pointer;
}
.merge-review-actions button[type="submit"]:not(.secondary) {
  background: var(--green, #176d4f);
  color: #fff;
}
.merge-review-actions .secondary {
  background: #eee5db;
  color: var(--ink);
}
@media (max-width: 700px) {
  .merge-review-pair {
    grid-template-columns: 1fr;
  }
  .merge-review-vs {
    display: none;
  }
}

/* --- Wishlist: purpose-built management rows instead of browse cards ---
   This page is for managing saved books (price/availability alerts,
   removal), not browsing, so it gets its own compact row layout rather
   than reusing the catalog card grid. */
.wishlist-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 6px;
}
.wishlist-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  padding: 16px 18px;
  border: 1px solid var(--line, #e8ded2);
  border-radius: 18px;
  background: var(--card, #fffaf3);
  box-shadow: 0 8px 22px rgba(52, 36, 21, 0.05);
}
.wishlist-row.is-discounted {
  border-color: #e8c3ab;
}
.wishlist-row-cover {
  display: grid;
  flex: 0 0 auto;
  width: 84px;
  height: 112px;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  background: linear-gradient(145deg, #efe4d3, #f7f1e7);
}
.wishlist-row-cover img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.wishlist-row-copy {
  min-width: 0;
}
.wishlist-row-copy h3 {
  margin: 0 0 4px;
  font-size: 1rem;
  line-height: 1.3;
}
.wishlist-row-copy h3 a {
  color: inherit;
  text-decoration: none;
}
.wishlist-row-copy h3 a:hover {
  text-decoration: underline;
}
.wishlist-row-author {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.84rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wishlist-row-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}
.wishlist-row-counts {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.wishlist-row-counts .icon {
  width: 15px;
  height: 15px;
  vertical-align: -3px;
  margin-right: 2px;
}
.wishlist-row-price {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 110px;
}
.wishlist-row-price .card-price-row strong {
  font-family: Literata, Georgia, serif;
  font-size: 1.15rem;
  color: #176d4f;
}
.wishlist-row-price .card-discount-tag.static {
  position: static;
  margin-bottom: 4px;
  box-shadow: none;
}
.wishlist-row-actions {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.wishlist-notify {
  position: relative;
}
.wishlist-notify summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
  list-style: none;
  cursor: pointer;
}
.wishlist-notify summary::-webkit-details-marker {
  display: none;
}
.wishlist-notify summary .icon {
  width: 15px;
  height: 15px;
}
.wishlist-notify[open] summary {
  border-color: #7da58a;
  background: #f1f7f2;
  color: #176d4f;
}
.wishlist-notify-form {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  right: 0;
  display: flex;
  flex-direction: column;
  width: 290px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(65, 45, 30, 0.18);
}
.wishlist-notify-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.wishlist-notify-head strong {
  font-size: 0.92rem;
}
.wishlist-notify-head span {
  color: var(--muted);
  font-size: 0.72rem;
}
.wishlist-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  font-size: 0.84rem;
}
.wishlist-switch {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 38px;
  height: 22px;
}
.wishlist-switch input {
  position: absolute;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.wishlist-switch i {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #e3d9c9;
  transition: background-color 0.15s ease;
}
.wishlist-switch i::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}
.wishlist-switch input:checked + i {
  background: #2f7a45;
}
.wishlist-switch input:checked + i::before {
  transform: translateX(16px);
}
.wishlist-switch input:focus-visible + i {
  outline: 2px solid var(--accent, #a74434);
  outline-offset: 2px;
}
.wishlist-target {
  display: grid;
  gap: 5px;
  margin: 6px 0 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.76rem;
}
.wishlist-target input {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.wishlist-notify-save {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--red, #a74434);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.wishlist-notify-danger {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  text-align: center;
}
.wishlist-notify-danger .link-danger {
  border: 0;
  background: transparent;
  color: #a94737;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}
@media (max-width: 760px) {
  .wishlist-row {
    grid-template-columns: 64px 1fr;
    grid-template-areas: "cover copy" "cover price" "actions actions";
    row-gap: 8px;
  }
  .wishlist-row-cover {
    grid-area: cover;
    width: 64px;
    height: 88px;
  }
  .wishlist-row-copy {
    grid-area: copy;
  }
  .wishlist-row-price {
    grid-area: price;
    align-items: flex-start;
  }
  .wishlist-row-actions {
    grid-area: actions;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .wishlist-notify-form {
    right: auto;
    left: 0;
    width: calc(100vw - 64px);
    max-width: 300px;
  }
}

/* --- Notification bell dropdown --- */
.notif-root {
  position: relative;
}
.notif-panel {
  position: absolute;
  z-index: 60;
  top: calc(100% + 10px);
  right: 0;
  display: flex;
  flex-direction: column;
  width: 380px;
  max-height: 70vh;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(65, 45, 30, 0.22);
}
.notif-panel[hidden] {
  display: none;
}
.notif-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.notif-panel-head strong {
  font-size: 0.95rem;
}
.notif-mark-all {
  border: 0;
  background: transparent;
  color: #3a6ea5;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.notif-panel-list {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: calc(70vh - 96px);
}
.notif-panel-foot {
  padding: 11px 16px;
  border-top: 1px solid var(--line);
  color: var(--red);
  font-size: 0.8rem;
  font-weight: 750;
  text-align: center;
}
.notif-empty {
  padding: 26px 16px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}
.notif-card {
  position: relative;
  display: flex;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid #f2ebe1;
  color: inherit;
  transition: background-color 0.12s ease;
}
.notif-card:last-child {
  border-bottom: 0;
}
.notif-card:hover {
  background: #fbf6ee;
}
.notif-card.is-unread {
  background: #f4f8fc;
}
.notif-card.is-unread:hover {
  background: #eef4fa;
}
.notif-dot {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: #3a6ea5;
}
.notif-card-body {
  min-width: 0;
  flex: 1;
}
.notif-card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.notif-card-top strong {
  font-size: 0.86rem;
  line-height: 1.3;
}
.notif-card-top time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.68rem;
}
.notif-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}
/* Reuse the same card look on the full /me/notifications page, just wider
   and standalone (not clipped inside a fixed-height dropdown). */
.notif-card-page {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
}
.notif-card-page.is-unread {
  background: #f4f8fc;
  border-color: #bcd3e8;
}
@media (max-width: 480px) {
  .notif-panel {
    position: fixed;
    top: 68px;
    right: 10px;
    left: 10px;
    width: auto;
  }
}

/* --- Shop logo next to each offer's store name on the book page --- */
.offer-shop-name {
  display: flex;
  align-items: center;
  gap: 8px;
}
.offer-shop-logo {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  object-fit: contain;
  background: #fff;
}
.offer-shop strong {
  margin-bottom: 0 !important;
}

/* --- Profile dropdown panel --- */
.profile-panel-body {
  padding: 14px 16px;
}
.profile-panel-email {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
}
.profile-panel-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.profile-panel-stats a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: center;
}
.profile-panel-stats a:hover {
  background: #fbf6ee;
}
.profile-panel-stats strong {
  font: 800 1.1rem Literata, serif;
}
.profile-panel-stats span {
  color: var(--muted);
  font-size: 0.68rem;
}
.profile-panel-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.profile-panel-links a,
.profile-panel-links form {
  margin: 0;
}
.profile-panel-links a,
.profile-panel-links .link-button {
  padding: 8px 4px;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 700;
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
}
.profile-panel-links .link-button {
  width: 100%;
  color: var(--red);
}
.profile-panel-links a:hover,
.profile-panel-links .link-button:hover {
  text-decoration: underline;
}

/* --- Admin: built-in collection category filters --- */
.builtin-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.builtin-filter {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdf8;
  overflow: hidden;
}
.builtin-filter summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.builtin-filter summary::-webkit-details-marker {
  display: none;
}
.builtin-filter summary span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
}
.builtin-filter form {
  padding: 0 14px 14px;
}
.builtin-filter-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 4px 10px;
  max-height: 260px;
  overflow-y: auto;
  margin-bottom: 10px;
}
.builtin-filter-options label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
}

/* --- Sort control (search results + collection pages) --- */
.catalog-heading-tools {
  display: flex;
  align-items: center;
  gap: 14px;
}
.sort-form {
  display: contents;
}
.sort-select-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}
.sort-select-label select {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
@media (max-width: 680px) {
  .catalog-heading-tools {
    flex-wrap: wrap;
  }
}
.save-filtered-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: -8px 0 20px;
  padding: 10px 14px;
  border: 1px dashed var(--line);
  border-radius: 13px;
  background: #f7f1e6;
}
.save-filtered-label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.save-filtered-form input[type="text"] {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-size: 0.85rem;
  width: 200px;
  max-width: 100%;
}
.save-filtered-form button {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

/* --- Wishlist ebook-tracking opt-in --- */
.wishlist-format-note {
  margin: 2px 0 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
}

/* --- Compact per-format price history: a small clickable sparkline card
   that opens a bigger <dialog> with the full chart (hotline.ua-style
   preview -> expand). Lives inside the book hero's sidebar (.book-price-panel
   below) rather than as its own full-width section. --- */
.price-chart-card {
  display: block;
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px 9px;
  box-shadow: var(--shadow, 0 8px 22px rgba(61, 42, 29, 0.06));
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.price-chart-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(61, 42, 29, 0.1);
}
.price-chart-paper { color: var(--accent); }
.price-chart-ebook { color: var(--accent2, #6f7f59); }
.price-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.price-chart-label {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--ink);
}
.price-chart-trend {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.price-chart-trend.trend-down { color: var(--green, #176d4f); }
.price-chart-trend.trend-up { color: var(--red, #a74434); }
.price-chart-svg {
  display: block;
  width: 100%;
  height: 32px;
}
.price-chart-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 4px;
  font-size: 0.7rem;
  color: var(--muted);
}
.price-chart-range { font-weight: 700; color: var(--ink); }
.price-chart-expand-hint {
  color: var(--accent);
  font-weight: 700;
}

/* The expanded view - same content, bigger chart, in a native <dialog> */
.price-chart-dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 24px 65px rgba(45, 31, 22, 0.28);
}
.price-chart-dialog::backdrop {
  background: rgba(38, 29, 22, 0.42);
}
/* svg.price-chart-svg-dialog (not the plain descendant-combinator form)
   so this beats .book-price-panel .price-chart-svg on specificity - the
   dialog is a sibling of the compact card *inside* .book-price-panel, so
   that 30px compact-card override was tying on specificity with this rule
   and winning on cascade order alone, forcing the dialog chart down to
   the compact card's height. */
svg.price-chart-svg.price-chart-svg-dialog {
  height: 220px;
}
.price-chart-dialog .price-chart-head {
  margin-bottom: 12px;
}
.price-chart-dialog .price-chart-label {
  font-size: 1.05rem;
}
/* The dialog chart carries its own point markers/date-price labels drawn
   straight into the SVG (see price-chart-svg-dialog below) instead of a
   table underneath - so, unlike the compact sparkline, its viewBox is
   real pixels (DIALOG_WIDTH/HEIGHT in price_history_chart.py) rather than
   a stretched preserveAspectRatio="none" box, or the label text would
   distort along with the line. */
.price-chart-svg-dialog {
  overflow: visible;
}
.price-chart-point circle {
  fill: var(--paper);
  stroke: currentColor;
  stroke-width: 1.6;
  transition: r 0.12s ease;
}
.price-chart-point.is-labeled circle {
  fill: currentColor;
}
.price-chart-point:hover circle {
  r: 5;
}
.price-chart-point-label {
  font-size: 10px;
  font-weight: 700;
  fill: var(--ink);
  font-variant-numeric: tabular-nums;
  paint-order: stroke;
  stroke: var(--paper);
  stroke-width: 3px;
  stroke-linejoin: round;
}
.price-chart-hover-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}
.price-chart-dialog-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.price-chart-dialog-stats > div {
  font-size: 0.8rem;
}

/* --- Cart: unavailable items, quantity stepper, icon-only actions --- */
.cart-editor > article.is-unavailable {
  opacity: 0.55;
}
.cart-editor > article.is-unavailable img {
  filter: grayscale(1);
}
.cart-qty-form {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--line, #dfd2c5);
  border-radius: 10px;
  overflow: hidden;
}
.cart-qty-form input[type="number"] {
  width: 40px;
  padding: 7px 2px;
  border: 0;
  border-left: 1px solid var(--line, #dfd2c5);
  border-right: 1px solid var(--line, #dfd2c5);
  text-align: center;
  font-weight: 700;
  -moz-appearance: textfield;
}
.cart-qty-form input[type="number"]::-webkit-outer-spin-button,
.cart-qty-form input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.qty-step {
  width: 30px;
  height: 32px;
  border: 0;
  background: #fbf6ee;
  color: #493d34;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.qty-step:hover {
  background: #f0e8dd;
}
.cart-icon-btn {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line, #dfd2c5);
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}
.cart-icon-btn .icon {
  width: 17px;
  height: 17px;
}
.cart-remove-btn {
  color: #a94737;
  border-color: #ecd4cd;
}
.cart-remove-btn:hover {
  background: #fbeeeb;
}
.cart-wishlist-btn {
  color: #a94737;
}
.cart-wishlist-btn:hover {
  background: #fbeeeb;
}
@media (max-width: 700px) {
  .cart-editor > article {
    grid-template-columns: 42px 1fr auto auto;
  }
}

/* --- Price history moved into the book hero as a compact right-side
   panel (was a large full-width section further down the page) --- */
@media (min-width: 1051px) {
  .book-summary.has-price-panel {
    grid-template-columns: 270px minmax(0, 1fr) 205px;
  }
}
@media (max-width: 1050px) {
  .book-summary.has-price-panel {
    grid-template-columns: 270px minmax(0, 1fr);
  }
  .book-price-panel {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .book-price-panel .price-chart-card {
    flex: 1 1 220px;
  }
}
@media (max-width: 760px) {
  .book-summary.has-price-panel {
    grid-template-columns: 180px minmax(0, 1fr);
  }
}
.book-price-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.book-price-panel .price-chart-card {
  padding: 10px 12px 9px;
}
.book-price-panel .price-chart-label {
  font-size: 0.74rem;
  line-height: 1.25;
}
.book-price-panel .price-chart-svg {
  height: 30px;
}
.price-chart-stats {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}
.price-chart-stats > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.72rem;
}
.price-chart-stats span {
  color: var(--muted);
}
.price-chart-stats strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.book-price-panel .price-chart-expand-hint {
  display: block;
  margin-top: 6px;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.7rem;
}

/* --- Compact filter sheet rework: tighter facet rows, more columns per
   row, and a real dual-handle price slider replacing the old two plain
   number inputs. The existing cascade (postgres-ui.css) sets facet-row
   height with !important at several breakpoints, so matching !important
   here is the only reliable way to win regardless of load order. Facet
   *behavior* (search-as-you-type, popover open/close, live option
   fetch) is untouched - see initFacets()/initPriceSlider() in
   storefront.js - only sizing/layout changes. --- */
.filter-sheet .filter-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  gap: 8px !important;
}
.filter-sheet .facet > summary {
  height: 38px !important;
  min-height: 38px !important;
  padding: 0 10px !important;
  font-size: 0.82rem;
  border-radius: 9px !important;
}
.filter-sheet .facet > summary span {
  font-size: 0.66rem;
}
.filter-sheet .stock-check {
  height: 38px !important;
  min-height: 38px !important;
  padding: 0 10px !important;
  font-size: 0.82rem;
  border-radius: 9px !important;
}
.filter-sheet .facet-popover {
  padding: 8px !important;
}
.filter-sheet .facet-options label {
  min-height: 32px !important;
  padding: 5px 7px !important;
  font-size: 0.82rem;
}

/* The price control is used often enough to deserve always-visible real
   estate rather than a click-to-open popover like the other facets, so
   it spans two grid columns and shows the slider inline. */
.price-facet {
  display: flex;
  flex-direction: column;
  grid-column: span 2;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}
.price-facet.has-selection {
  border-color: var(--accent);
}
.price-facet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
}
.price-facet-head strong {
  font-weight: 700;
}
.price-facet-head span {
  color: var(--muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}
.price-slider {
  position: relative;
  height: 16px;
  margin: 0 7px;
}
.price-slider-track {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 3px;
  transform: translateY(-50%);
  border-radius: 999px;
  background: var(--line);
}
.price-slider-range {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  background: var(--accent);
}
.price-thumb {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 16px;
  margin: 0;
  transform: translateY(-50%);
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  pointer-events: none;
}
.price-thumb::-webkit-slider-runnable-track {
  background: transparent;
}
.price-thumb::-moz-range-track {
  background: transparent;
}
.price-thumb::-webkit-slider-thumb {
  width: 15px;
  height: 15px;
  margin-top: 0;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: #fff;
  appearance: none;
  -webkit-appearance: none;
  pointer-events: auto;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.price-thumb::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: #fff;
  pointer-events: auto;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
@media (max-width: 700px) {
  .filter-sheet .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .price-facet {
    grid-column: 1 / -1;
  }
}

.cart-store-delivery {
  margin: 4px 0 0;
  color: #627366;
  font-size: 0.76rem;
}
.cart-store-delivery.muted {
  color: #a0948a;
  font-style: italic;
}
.cart-plan-tabs strong em {
  display: block;
  color: #81746a;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 600;
  text-align: right;
}
.cart-editor-link,
.cart-product-link {
  display: contents;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
/* The link wrapper (display:contents) sits between .cart-editor article /
   .cart-product and their img/div - postgres-ui.css's ">" direct-child
   selectors for those no longer match through it (display:contents changes
   rendering, not DOM parentage, so ">" still requires literal parentage),
   so those rules are restated here scoped to the wrapper class instead. */
.cart-editor-link img {
  width: 43px;
  height: 58px;
  object-fit: contain;
  border-radius: 5px;
}
.cart-editor-link > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
}
.cart-editor-link > div strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cart-editor-link > div span {
  color: #81746a;
  font-size: 0.7rem;
}
.cart-clear-form {
  margin-left: auto;
}
.cart-clear-btn {
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--accent, #a74434);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}
.cart-clear-btn:hover {
  background: rgba(167, 68, 52, 0.08);
}
.cart-product-link img {
  width: 58px;
  height: 78px;
  object-fit: contain;
  border-radius: 7px;
}
@media (max-width: 650px) {
  .cart-product-link img {
    width: 45px;
    height: 64px;
  }
}
.cart-store-pickup {
  margin: 2px 0 0;
  color: #a0948a;
  font-size: 0.7rem;
}
.cart-delivery-pref {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  margin-bottom: 18px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card, #fffaf3);
}
.cart-delivery-pref-field {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cart-delivery-pref label {
  color: var(--muted, #7b7067);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}
.cart-delivery-pref select {
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}
.cart-delivery-pref p {
  flex: 1 1 240px;
  margin: 0;
  color: #a0948a;
  font-size: 0.76rem;
  line-height: 1.4;
  text-align: right;
}
@media (max-width: 640px) {
  .cart-delivery-pref p {
    text-align: left;
  }
}
.cart-store-totals {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.cart-store-totals strong {
  font: 800 1.35rem Literata, serif;
  color: #176d4f;
}
.cart-store-totals small {
  color: #81746a;
  font-size: 0.72rem;
  white-space: nowrap;
}
.cart-total-row-grand {
  border-block: none;
  border-top: 2px solid #d9c8b5;
  font-weight: 800;
}
.cart-total-row-grand strong {
  font: 800 1.2rem Literata, serif;
  color: #176d4f;
}
.single-store-option small {
  display: block;
}
.filter-sheet>footer button[data-clear-all-filters] {
  background: transparent !important;
  color: #6e5c4e !important;
  padding: 9px 4px !important;
}
.offer-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}
.offer-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card, #fffaf3);
  color: var(--ink);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.15s ease;
}
.offer-filter-btn::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line);
  transition: 0.15s ease;
}
.offer-filter-btn:hover {
  border-color: var(--accent, #a74434);
}
.offer-filter-btn.is-active {
  border-color: var(--accent, #a74434);
  background: var(--accent, #a74434);
  color: #fff;
}
.offer-filter-btn.is-active::before {
  background: #fff;
}

/* Card grid/scroll-row sizing (gap, column count, card width) all in
   book-card.css now. */

/* --- .panel base chrome: this class is used all over (admin dashboard,
   jobs pages, cart, shop cards, merge review...) but its actual box styling
   only ever existed in production.css, a stylesheet that isn't loaded by
   base.html - every ".panel" on the site has been rendering with no border,
   background, or padding at all this whole time (plain stacked text/links).
   Scoped overrides like .shop-grid .panel already added their own layout on
   top of this missing base, which is why they only half-worked. This is the
   one real fix; the admin stats/links dashboards below build on it. */
.panel {
  padding: 22px;
  border: 1px solid var(--line, #e8ded2);
  border-radius: 18px;
  background: var(--card, #fffaf3);
  box-shadow: 0 6px 18px rgba(52, 36, 21, 0.05);
}
.panel h2 {
  margin: 0 0 6px;
  font-size: 1.1rem;
}
.panel > p,
.panel > .muted {
  margin: 0;
  color: var(--muted, #786f68);
}

/* --- Admin dashboard: top-line stat tiles (.stats) and the link grid to
   each admin sub-page (.admin-links), e.g. app/templates/admin.html and
   admin_popularity.html. Same missing-base-class problem as .panel above -
   these rendered as a bare vertical list of numbers with no card chrome. --- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin: 22px 0;
}
.stats article {
  padding: 18px 20px;
  border: 1px solid var(--line, #e8ded2);
  border-radius: 16px;
  background: var(--card, #fffaf3);
  box-shadow: 0 6px 18px rgba(52, 36, 21, 0.05);
}
.stats article strong {
  display: block;
  font-family: "Literata", Georgia, serif;
  font-size: 1.9rem;
  line-height: 1.15;
  color: var(--ink, #211b18);
}
.stats article span {
  color: var(--muted, #786f68);
  font-size: 0.82rem;
}

.admin-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin: 22px 0;
}
.admin-links .panel {
  display: block;
  cursor: pointer;
  text-decoration: none;
  transition: 0.18s ease;
}
.admin-links .panel h2 {
  text-decoration: none;
}
.admin-links .panel a {
  color: var(--accent, #a74434);
  text-decoration: underline;
}
.admin-links .panel:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(54, 38, 25, 0.09);
}
.admin-links .panel h2 {
  font-size: 1.05rem;
}
.admin-links .panel p {
  margin: 0;
  color: var(--muted, #786f68);
  font-size: 0.86rem;
}
