:root {
  color-scheme: light;
  --paper: #f8f8f6;
  --surface: #fff;
  --ink: #252729;
  --muted: #6d7475;
  --line: #dedfda;
  --green: #233d36;
  --green-dark: #152c27;
  --red: #7d3940;
  --blue: #405768;
  --gold: #9b7a35;
  --shadow: 0 10px 24px rgba(37, 39, 41, .05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header,
.layout,
.book-page,
.checkout-page,
.site-footer {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
}

.site-header {
  padding: 16px 0 22px;
}

.topline {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) auto auto;
  align-items: center;
  gap: 28px;
  padding: 8px 0 20px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brand-mark {
  display: block;
  width: 106px;
  flex: 0 0 auto;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: auto;
}

.brand strong {
  display: block;
  font-family: Georgia, serif;
  font-size: clamp(18px, 1.6vw, 24px);
  font-weight: 500;
  line-height: 1.15;
}

.brand strong span {
  display: block;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px 18px;
  color: var(--blue);
  font-size: 13px;
}

.main-nav a:hover,
.book-card h3 a:hover,
.filter-link:hover,
.breadcrumbs a:hover {
  color: var(--red);
}

.cart-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 68px;
  height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.cart-icon {
  width: 36px;
  height: 36px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.45;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.catalog-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(280px, 520px);
  align-items: end;
  gap: 26px;
  padding-top: 22px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  letter-spacing: 0;
}

h1 {
  margin-bottom: 0;
  font-family: Georgia, serif;
  font-size: clamp(30px, 3.4vw, 44px);
  font-weight: 500;
  line-height: 1.08;
}

.search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.search input {
  min-width: 0;
  border: 0;
  padding: 10px 12px;
  outline: none;
}

.search button,
.book-meta button,
.detail-buy button,
.cart-actions button,
.checkout-form button {
  border: 0;
  background: var(--green);
  color: #fff;
  padding: 9px 14px;
  cursor: pointer;
}

.search button:hover,
.book-meta button:hover,
.detail-buy button:hover,
.cart-actions button:hover,
.checkout-form button:hover {
  background: var(--green-dark);
}

button:disabled {
  cursor: not-allowed;
  background: #bac1bd;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 276px;
  align-items: start;
  gap: 24px;
  padding-bottom: 46px;
}

.catalog {
  min-width: 0;
}

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

.catalog-head h2,
.filters h2 {
  margin-bottom: 4px;
  font-family: Georgia, serif;
  font-size: 21px;
  font-weight: 500;
  line-height: 1.15;
}

.catalog-head p {
  margin-bottom: 0;
  color: var(--muted);
}

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

.book-card {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 14px;
  min-height: 214px;
  padding: 14px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.cover {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 168px;
  background: #eeeee9;
}

.cover img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 190px;
  object-fit: contain;
}

.book-info {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  min-width: 0;
}

.tag {
  width: fit-content;
  max-width: 100%;
  color: var(--red);
  font-size: 12px;
  line-height: 1.25;
}

.book-card h3 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
}

.book-card h3 a {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}

.book-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.book-meta strong {
  min-width: 0;
  font-size: 13px;
  line-height: 1.25;
}

.book-meta button {
  flex: 0 0 auto;
  max-width: 96px;
  padding: 7px 9px;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.is-out .cover img {
  opacity: .72;
}

.filters {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 8px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.filter-link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid #ecece8;
  color: var(--blue);
  font-size: 14px;
}

.filter-link small {
  color: var(--muted);
}

.filter-link.is-active {
  color: var(--red);
  font-weight: 600;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 28px;
}

.page-number,
.page-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--blue);
  font-weight: 600;
}

.page-number.is-active,
.page-number:hover,
.page-control:hover {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.page-control.is-disabled {
  pointer-events: none;
  color: #a6adaa;
}

.book-page {
  padding-bottom: 54px;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 22px;
  color: var(--muted);
  font-size: 14px;
}

.book-detail {
  display: grid;
  grid-template-columns: minmax(220px, 360px) minmax(0, 760px);
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
}

.detail-gallery {
  min-width: 0;
}

.detail-cover {
  display: flex;
  justify-content: center;
  width: 100%;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

button.detail-cover {
  cursor: zoom-in;
}

button.detail-cover[aria-disabled="true"] {
  cursor: default;
}

.detail-cover img {
  display: block;
  width: 100%;
  max-height: 620px;
  object-fit: contain;
}

.gallery-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.gallery-thumb {
  display: grid;
  grid-template-rows: 96px auto;
  gap: 6px;
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: zoom-in;
  text-align: left;
}

.gallery-thumb:hover,
.gallery-thumb.is-active {
  border-color: var(--green);
}

.gallery-thumb img {
  display: block;
  width: 100%;
  height: 96px;
  object-fit: contain;
  background: #eeeee9;
}

.gallery-thumb span {
  display: -webkit-box;
  min-height: 30px;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.gallery-lightbox.is-open {
  display: flex;
}

.has-open-lightbox body {
  overflow: hidden;
}

.gallery-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 23, 22, .78);
}

.gallery-lightbox__panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  width: min(1180px, 100%);
  height: min(88vh, 980px);
  padding: 18px;
  background: #f9f9f7;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.gallery-lightbox__figure {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  grid-column: 2;
  grid-row: 1 / 3;
  min-width: 0;
  min-height: 0;
  margin: 0;
}

.gallery-lightbox__figure img {
  align-self: center;
  justify-self: center;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.gallery-lightbox__figure figcaption {
  max-width: 72ch;
  margin: 12px auto 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.35;
  text-align: center;
}

.gallery-lightbox__close,
.gallery-lightbox__nav {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--green);
  cursor: pointer;
  font-family: Georgia, serif;
  line-height: 1;
}

.gallery-lightbox__close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 40px;
  height: 40px;
  font-size: 30px;
}

.gallery-lightbox__nav {
  align-self: center;
  width: 48px;
  height: 64px;
  font-size: 42px;
}

.gallery-lightbox__nav--prev {
  grid-column: 1;
  grid-row: 1 / 3;
}

.gallery-lightbox__nav--next {
  grid-column: 3;
  grid-row: 1 / 3;
}

.gallery-lightbox__close:hover,
.gallery-lightbox__nav:hover {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.gallery-lightbox__count {
  position: absolute;
  left: 18px;
  bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.detail-info h1 {
  margin-bottom: 18px;
}

.detail-buy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.detail-buy strong {
  font-size: 20px;
}

.category-line {
  color: var(--muted);
  font-size: 14px;
}

.description {
  margin-top: 24px;
  max-width: 72ch;
  font-size: 17px;
  line-height: 1.62;
}

.description a {
  color: var(--red);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.technical-description {
  margin-top: 30px;
  max-width: 72ch;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: #3c4242;
  font-size: 14px;
  line-height: 1.55;
}

.technical-description p {
  margin: 0 0 18px;
}

.technical-description p:last-child {
  margin-bottom: 0;
}

.technical-description a {
  color: var(--red);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.checkout-page {
  padding-bottom: 54px;
}

.page-head {
  margin-bottom: 22px;
}

.cart-panel,
.order-result {
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.payment-panel {
  max-width: 760px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.payment-panel h1 {
  margin-bottom: 14px;
}

.payment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 22px 0;
}

.payment-actions form {
  margin: 0;
}

.payment-actions button,
.primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  padding: 10px 16px;
  background: var(--green);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}

.payment-debug {
  margin-top: 18px;
  color: var(--muted);
}

.payment-debug summary {
  cursor: pointer;
}

.payment-debug dl {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  font-size: 13px;
}

.payment-debug div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 10px;
}

.payment-debug dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
}

.empty-note {
  margin: 0;
  color: var(--muted);
}

.cart-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid #ecece8;
}

.cart-cover {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  background: #eeeee9;
}

.cart-cover img {
  display: block;
  max-width: 100%;
  max-height: 104px;
  object-fit: contain;
}

.cart-row-main h2,
.order-summary h2 {
  margin-bottom: 6px;
  font-family: Georgia, serif;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.2;
}

.cart-row-main p {
  margin-bottom: 0;
  color: var(--muted);
}

.cart-quantity {
  display: grid;
  grid-template-columns: 34px 54px 34px;
  gap: 4px;
}

.cart-quantity button,
.cart-remove,
.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--blue);
  cursor: pointer;
}

.cart-quantity button {
  height: 34px;
}

.cart-quantity input {
  width: 54px;
  height: 34px;
  border: 1px solid var(--line);
  text-align: center;
}

.cart-line-total {
  white-space: nowrap;
}

.cart-remove {
  padding: 7px 10px;
}

.cart-total,
.summary-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  font-size: 20px;
}

.cart-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.cart-actions .secondary-button {
  background: var(--surface);
  color: var(--blue);
}

.checkout-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: start;
  gap: 24px;
}

.checkout-form,
.order-summary {
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

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

.form-grid label,
.form-options label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

.form-grid label span b,
.country-field span b {
  color: var(--red);
  font-weight: 600;
}

.form-grid input,
.form-grid textarea,
.form-options select {
  width: 100%;
  border: 1px solid var(--line);
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
}

.span-2 {
  grid-column: 1 / -1;
}

.country-field {
  align-items: start;
}

.country-field strong {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  color: var(--ink);
  font-size: 16px;
}

.form-options {
  display: grid;
  gap: 14px;
  margin: 18px 0;
}

.shipping-fields {
  padding: 16px;
  border: 1px solid var(--line);
  background: #fbfbf8;
}

.shipping-fields[hidden] {
  display: none;
}

.checkbox-line {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
}

.checkbox-line input {
  margin-top: 3px;
}

.form-error {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #d8b9b9;
  background: #fff4f2;
  color: var(--red);
}

.summary-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #ecece8;
  font-size: 14px;
}

.summary-line strong {
  white-space: nowrap;
}

.text-link {
  color: var(--red);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.admin-body {
  min-height: 100vh;
  background: #f4f5f2;
}

.admin-login {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.admin-login-panel {
  width: min(100%, 420px);
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.admin-login-panel h1,
.admin-main h1 {
  font-size: 34px;
}

.admin-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-sidebar {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
  padding: 22px;
  background: #233d36;
  color: #fff;
}

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

.admin-brand .brand-mark {
  width: 72px;
  padding: 6px;
  background: #fff;
}

.admin-menu {
  display: grid;
  align-content: start;
  gap: 8px;
}

.admin-menu a,
.admin-logout {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: transparent;
  color: #fff;
  text-align: left;
  cursor: pointer;
}

.admin-menu a.is-active,
.admin-menu a:hover,
.admin-logout:hover {
  background: rgba(255, 255, 255, .12);
}

.admin-main {
  min-width: 0;
  padding: 24px;
}

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

.admin-user {
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
}

.admin-panel {
  min-width: 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.admin-panel h2 {
  margin-bottom: 16px;
  font-family: Georgia, serif;
  font-size: 22px;
  font-weight: 500;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 20px;
  align-items: start;
}

.admin-form,
.admin-filters {
  display: grid;
  gap: 14px;
}

.admin-form label,
.admin-filters label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

.admin-form input,
.admin-form select,
.admin-filters input,
.admin-filters select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
}

.admin-form button,
.admin-filters button {
  border: 0;
  background: var(--green);
  color: #fff;
  padding: 10px 14px;
  cursor: pointer;
}

.admin-inline-action {
  color: var(--red);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.admin-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 12px;
}

.admin-filters {
  grid-template-columns: minmax(140px, 220px) minmax(140px, 220px) minmax(220px, 1fr) auto;
  align-items: end;
  margin-bottom: 18px;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th,
.admin-table td {
  padding: 11px 10px;
  border-bottom: 1px solid #ecece8;
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.admin-table small {
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  background: #eef2ee;
  color: var(--green);
  font-size: 12px;
  font-weight: 600;
}

.admin-footer-line {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  flex-direction: column;
  justify-content: flex-start;
  gap: 10px;
  margin-top: 16px;
  color: var(--muted);
}

.admin-page-picker {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  align-self: flex-start;
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
}

.admin-page-picker select {
  height: 38px;
  min-width: 68px;
  border: 1px solid var(--line);
  padding: 0 28px 0 10px;
  background: #fff;
  color: var(--ink);
  font-weight: 600;
}

.admin-page-size-label {
  margin-left: 8px;
  white-space: nowrap;
  color: var(--muted);
}

.admin-section-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.admin-section-head h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.admin-section-head p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.admin-settings-form {
  max-width: none;
  justify-items: stretch;
}

.admin-settings-panel {
  width: clamp(760px, 56%, 940px);
  max-width: 100%;
}

.settings-status-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  padding: 16px;
  border: 1px solid #d9cfc0;
  background: #fffaf2;
}

.settings-status-card.is-ok {
  border-color: #bdd0bf;
  background: #f1fbf2;
}

.settings-status-card strong {
  display: block;
  margin-bottom: 6px;
}

.settings-status-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.settings-status-card dl {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: 12px 0 0;
}

.settings-status-card dl div {
  min-width: 96px;
}

.settings-status-card dt {
  color: var(--muted);
  font-size: 12px;
}

.settings-status-card dd {
  margin: 2px 0 0;
  font-weight: 700;
}

.settings-status-card form {
  flex: 0 0 auto;
}

.settings-status-card button {
  border: 1px solid var(--green);
  background: #fff;
  color: var(--green);
  padding: 9px 12px;
  cursor: pointer;
}

.settings-status-card button:hover {
  background: var(--green);
  color: #fff;
}

.settings-info-card {
  margin-bottom: 22px;
  padding: 16px;
  border: 1px solid var(--line);
  background: #fff;
}

.settings-info-card strong {
  display: block;
  margin-bottom: 10px;
}

.settings-info-card dl {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
}

.settings-info-card dl div {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 12px;
}

.settings-info-card dt {
  color: var(--muted);
  font-size: 12px;
}

.settings-info-card dd {
  min-width: 0;
  margin: 0;
}

.settings-info-card code {
  white-space: normal;
  overflow-wrap: anywhere;
}

.settings-info-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.admin-settings-separator {
  margin: 28px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.settings-stack {
  display: grid;
  gap: 22px;
}

.settings-group {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 18px 0 0;
  border: 0;
  border-top: 2px solid #d8d4ca;
}

.settings-group legend {
  padding: 0 12px 0 0;
  color: var(--green);
  font-family: Georgia, serif;
  font-size: 19px;
  font-weight: 500;
}

.settings-field-list {
  display: grid;
  gap: 15px;
}

.settings-field-list .settings-field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.settings-field input,
.settings-field select {
  width: 100%;
}

.settings-field--number input {
  max-width: 160px;
}

.settings-field--short input,
.settings-field--short select,
.settings-field--select select {
  max-width: 240px;
}

.settings-field--medium input,
.settings-field--medium select {
  max-width: 420px;
}

.settings-field--long input,
.settings-field--long select {
  max-width: 520px;
}

.settings-field--toggle {
  max-width: 360px;
}

.settings-field-label {
  color: var(--muted);
}

.settings-toggle {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}

.settings-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.settings-toggle__track {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex: 0 0 48px;
  border: 1px solid #c9c3b7;
  border-radius: 999px;
  background: #eee9df;
  transition: background 160ms ease, border-color 160ms ease;
}

.settings-toggle__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(45, 39, 31, 0.28);
  transition: transform 160ms ease;
}

.settings-toggle input:checked + .settings-toggle__track {
  border-color: var(--green);
  background: var(--green);
}

.settings-toggle input:checked + .settings-toggle__track::after {
  transform: translateX(22px);
}

.settings-toggle input:focus-visible + .settings-toggle__track {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.settings-toggle__state {
  min-width: 82px;
  color: var(--ink);
  font-size: 14px;
}

.settings-toggle__state::before {
  content: attr(data-off);
}

.settings-toggle input:checked + .settings-toggle__track + .settings-toggle__state::before {
  content: attr(data-on);
}

.settings-field-list small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.admin-settings-form .settings-submit-button {
  justify-self: start;
  width: auto;
  min-width: 0;
  margin-top: 2px;
  padding: 10px 18px;
}

.form-notice {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #bdd0bf;
  background: #f1fbf2;
  color: var(--green);
}

.site-footer {
  display: grid;
  gap: 22px;
  padding: 28px 0 38px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.footer-social {
  display: flex;
  justify-content: center;
}

.footer-body {
  display: grid;
  grid-template-columns: minmax(0, 760px) minmax(260px, 1fr);
  gap: 24px;
  align-items: start;
}

.footer-requisites h2 {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.footer-requisites strong {
  color: var(--ink);
}

.footer-requisites p {
  margin: 0 0 5px;
  max-width: 76ch;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 18px;
  align-items: center;
}

.footer-links a:hover {
  color: var(--red);
}

.vk-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--blue);
  font-weight: 600;
}

.vk-link img {
  display: block;
  width: 48px;
  height: 48px;
}

@media (max-width: 1120px) {
  .book-card h3 a {
    -webkit-line-clamp: 4;
  }

  .book-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .book-meta button {
    max-width: 100%;
  }
}

@media (max-width: 980px) {
  .topline,
  .catalog-bar,
  .layout,
  .book-detail,
  .checkout-layout,
  .admin-shell,
  .admin-grid,
  .admin-filters {
    grid-template-columns: 1fr;
  }

  .settings-status-card {
    display: block;
  }

  .settings-status-card form {
    margin-top: 14px;
  }

  .admin-sidebar {
    position: static;
    grid-template-rows: auto auto auto;
  }

  .topline {
    gap: 14px;
  }

  .main-nav {
    justify-content: flex-start;
  }

  .filters {
    position: static;
    order: -1;
  }

  .gallery-thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .gallery-thumb {
    flex: 0 0 112px;
  }

  .book-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .site-header,
  .layout,
  .book-page,
  .checkout-page,
  .site-footer {
    width: min(100% - 28px, 1440px);
  }

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

  .footer-links {
    justify-content: flex-start;
  }

  .brand-mark {
    width: 72px;
  }

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

  .book-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .book-card {
    grid-template-columns: 88px minmax(0, 1fr);
    min-height: 0;
    padding: 12px;
  }

  .cover {
    min-height: 136px;
  }

  .cover img {
    max-height: 150px;
  }

  .cart-row {
    grid-template-columns: 62px minmax(0, 1fr);
  }

  .cart-quantity,
  .cart-line-total,
  .cart-remove {
    grid-column: 2;
    justify-self: start;
  }

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

  .settings-field input,
  .settings-field select {
    max-width: none;
  }

  .settings-field--toggle {
    max-width: none;
  }

  .gallery-lightbox {
    padding: 12px;
  }

  .gallery-lightbox__panel {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 8px;
    height: min(90vh, 760px);
    padding: 14px;
  }

  .gallery-lightbox__figure {
    grid-column: 1 / 3;
    grid-row: 1;
  }

  .gallery-lightbox__nav {
    grid-row: 2;
    width: 100%;
    height: 42px;
    font-size: 30px;
  }

  .gallery-lightbox__nav--prev {
    grid-column: 1;
  }

  .gallery-lightbox__nav--next {
    grid-column: 2;
  }

  .gallery-lightbox__count {
    left: 14px;
    bottom: 62px;
  }

}

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