:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --ink: #12263f;
  --muted: #58708c;
  --accent: #0a7a6a;
  --accent-2: #ffb703;
  --danger: #d64045;
  --ring: rgba(10, 122, 106, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Segoe UI", "Trebuchet MS", "Verdana", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 20% 10%, #ddeeff 0, transparent 35%),
    radial-gradient(circle at 80% 90%, #fff0d0 0, transparent 30%),
    var(--bg);
}

.top {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  background: linear-gradient(110deg, #0f2540, #214a73);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.brand-logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  text-decoration: none;
}

.brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  display: block;
}

.brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-wordmark {
  width: 112px;
  height: auto;
  display: block;
  margin-bottom: 2px;
}

.brand h1 {
  margin: 0;
  font-size: 1.35rem;
}

.brand p {
  margin: 2px 0 0;
  font-size: 0.82rem;
  opacity: 0.85;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-item {
  color: #fff;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 8px 12px;
  border-radius: 10px;
  transition: 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.2);
}

.badge {
  display: inline-block;
  min-width: 20px;
  text-align: center;
  border-radius: 999px;
  background: #fff;
  color: #1a2f49;
  padding: 1px 7px;
  font-size: 0.78rem;
  margin-left: 4px;
}

.login-trigger {
  color: #173252;
  text-decoration: none;
  font-weight: 700;
  background: #f7c34f;
  border: 1px solid #ffc74f;
  padding: 8px 14px;
  border-radius: 10px;
}

.account-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.account-pill {
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.24);
  font-size: 0.9rem;
}

.ghost-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.34);
  color: #fff;
  padding: 8px 11px;
}

.hero {
  width: 100%;
  max-width: 1200px;
  margin: 22px auto 0;
  padding: 0 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.hero-content {
  grid-column: span 2;
  width: 100%;
  background: linear-gradient(130deg, #214a73, #0a7a6a);
  color: #fff;
  border-radius: 18px;
  padding: 26px;
}

.hero-content h2 {
  margin: 4px 0 10px;
  font-size: 2rem;
}

.hero-content p {
  margin: 0;
  opacity: 0.95;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
  opacity: 0.8;
}

.search-card {
  grid-column: span 1;
  width: 100%;
  background: var(--panel);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 10px 24px rgba(22, 47, 77, 0.08);
  border: 1px solid #e8eef5;
}

.search-card label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
}

.filters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
  margin-bottom: 8px;
}

.more-filters {
  margin-top: 10px;
}

.more-filters summary {
  cursor: pointer;
  font-weight: 700;
  color: #214a73;
  user-select: none;
}

.more-filters[open] summary {
  margin-bottom: 4px;
}

.filters-grid input,
.filters-grid select {
  width: 100%;
}

.price-range-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.price-range-row label {
  font-size: 0.82rem;
  color: var(--muted);
}

.search-suggest {
  display: none;
  border: 1px solid #d5e2ee;
  border-radius: 10px;
  margin-top: 6px;
  max-height: 220px;
  overflow: auto;
}

.search-suggest.open {
  display: block;
}

.suggest-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-decoration: none;
  color: #163654;
  padding: 8px 10px;
  border-bottom: 1px solid #ebf1f7;
}

.suggest-item:last-child {
  border-bottom: 0;
}

.suggest-item small {
  color: #617c96;
}

.catalog-wrap {
  max-width: 1200px;
  margin: 18px auto 26px;
  padding: 0 16px;
}

.wrap {
  max-width: 1200px;
  margin: 18px auto 26px;
  padding: 0 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid #e8eef5;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 6px 16px rgba(14, 38, 64, 0.05);
}

.panel h2,
.panel h3 {
  margin: 0 0 12px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}

.panel-head span {
  color: var(--muted);
  font-size: 0.9rem;
}

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

.book-card {
  border: 1px solid #e5edf5;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  display: grid;
  grid-template-columns: 128px 1fr;
  min-height: 190px;
}

.book-cover {
  background: linear-gradient(160deg, #f0f5fb, #dae9f8);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.book-cover.no-cover {
  background: #eef3f9;
}

.availability {
  position: absolute;
  left: 8px;
  bottom: 8px;
  font-size: 0.7rem;
  border-radius: 99px;
  padding: 4px 8px;
  font-weight: 600;
}

.availability.ok {
  background: #ddf8f2;
  color: #0a6f60;
}

.availability.ko {
  background: #ffe3e5;
  color: #af1f31;
}

.book-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.book-body h4 {
  margin: 0;
  line-height: 1.25;
}

.book-body h4 a {
  color: inherit;
  text-decoration: none;
}

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

.price {
  margin: 0;
  color: #0c5a52;
  font-weight: 700;
}

.add-form {
  margin-top: auto;
  display: flex;
  gap: 8px;
}

.stack-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

input,
select,
button,
.cta-link {
  border-radius: 10px;
  border: 1px solid #d6e1ec;
  padding: 9px 10px;
  font-size: 0.95rem;
}

input {
  width: 100%;
  margin-top: 4px;
}

input:focus,
select:focus {
  outline: 3px solid var(--ring);
  border-color: var(--accent);
}

button,
.cta-link {
  background: linear-gradient(135deg, #0a7a6a, #0e8f7b);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
}

button:hover,
.cta-link:hover {
  filter: brightness(1.05);
}

button:disabled {
  background: #b8c3cf;
  border-color: #b8c3cf;
  cursor: not-allowed;
}

.muted {
  color: var(--muted);
  margin: 0 0 8px;
}

.order-status {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.82rem;
  font-weight: 700;
}

.order-status.paid {
  background: #ddf8f2;
  color: #0a6f60;
}

.order-status.failed {
  background: #ffe3e5;
  color: #af1f31;
}

.order-status.pending {
  background: #edf2fa;
  color: #3c5a76;
}

.inline-form {
  display: inline-flex;
  margin-right: 6px;
}

.inline-form button {
  padding: 6px 9px;
  font-size: 0.82rem;
}

.danger-btn {
  background: linear-gradient(135deg, #c7393c, #a61f30);
  border-color: #a61f30;
}

.mini-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: #0f4f78;
  font-weight: 700;
  margin-right: 8px;
  font-size: 0.86rem;
}

.book-detail-panel {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
}

.book-detail-cover {
  background: #edf3fa;
  border: 1px solid #e0eaf5;
  border-radius: 12px;
  min-height: 380px;
  overflow: hidden;
}

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

.book-detail-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.flash {
  max-width: 1200px;
  margin: 12px auto 0;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
}

.flash.ok {
  background: #dff8ec;
  color: #0a6f60;
}

.flash.err {
  background: #ffe5e7;
  color: #a5202f;
}

table {
  width: 100%;
  border-collapse: collapse;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.orders-table {
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid #e8eef5;
  padding: 10px 8px;
  text-align: left;
}

.cart-remove-cell {
  width: 44px;
  text-align: right;
}

.remove-item-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 9px;
  background: #fff;
  border: 1px solid #d8e4ef;
  color: #6d7f92;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.remove-item-btn:hover {
  color: #af1f31;
  border-color: #efc4cb;
  background: #fff5f6;
}

.remove-item-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.total-line {
  margin: 14px 0 8px;
}

.cart-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.cgv-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-weight: 500;
  line-height: 1.4;
}

.cgv-line input {
  width: auto;
  margin-top: 2px;
}

.search-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.search-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 24, 42, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 74px 26px 20px;
  z-index: 25;
}

.auth-modal {
  width: 390px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid #dfe8f1;
  box-shadow: 0 20px 44px rgba(9, 28, 48, 0.26);
  overflow: hidden;
}

.auth-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 8px;
}

.auth-head-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.auth-head-title img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.auth-head h3 {
  margin: 0;
}

.close-auth {
  text-decoration: none;
  color: #3e546b;
  font-size: 1.6rem;
  line-height: 1;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid #e5edf5;
}

.tab-btn {
  background: #f8fbff;
  color: #35506a;
  border: 0;
  border-radius: 0;
  border-right: 1px solid #e5edf5;
  padding: 11px 8px;
  font-size: 0.84rem;
}

.tab-btn:last-child {
  border-right: 0;
}

.tab-btn.active {
  background: #fff;
  color: #0f2942;
  box-shadow: inset 0 -3px 0 #0a7a6a;
}

.tab-panel {
  display: none;
  padding: 14px 16px 16px;
}

.tab-panel.active {
  display: block;
}

.switch-text {
  color: #56718c;
  margin: 10px 0 0;
  font-size: 0.9rem;
}

.auth-help-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0 0;
}

.inline-reset-form {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #dbe6f1;
}

.text-btn {
  border: 0;
  background: transparent;
  color: #0d7a6b;
  padding: 0;
  font-weight: 700;
  cursor: pointer;
}

.catalog-panel {
  min-height: 420px;
}

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

.pagination a {
  text-decoration: none;
  color: #0e3a5b;
  border: 1px solid #d5e1ec;
  background: #fff;
  padding: 7px 11px;
  border-radius: 8px;
  font-weight: 600;
}

.pagination a.disabled {
  pointer-events: none;
  opacity: 0.45;
}

.pagination span {
  color: #48617c;
  font-size: 0.92rem;
}

.page-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
}

.page-jump label {
  color: #48617c;
  font-size: 0.88rem;
}

.page-jump input {
  width: 84px;
  margin-top: 0;
}

.page-jump button {
  padding: 7px 10px;
}

.site-footer {
  margin-top: auto;
  padding: 20px 16px 26px;
  background: #0f2540;
  color: #d9e8f7;
  display: grid;
  grid-template-columns: auto repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.footer-brand {
  align-self: end;
  display: inline-flex;
  align-items: flex-end;
  padding-right: 8px;
}

.footer-brand img {
  width: 115px;
  height: auto;
  opacity: 0.95;
}

.footer-col h4 {
  margin: 0 0 8px;
  color: #fff;
}

.footer-col p {
  margin: 4px 0;
  font-size: 0.9rem;
}

.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 30;
  background: #ffffff;
  border: 1px solid #d7e4ef;
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(10, 30, 50, 0.2);
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cookie-banner[hidden] {
  display: none;
}

.cookie-banner p {
  margin: 0;
  color: #26435f;
  font-size: 0.92rem;
}

.cookie-actions {
  display: flex;
  gap: 8px;
}

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

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

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

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

  .book-cover {
    min-height: 150px;
  }

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

  .nav-links {
    width: 100%;
    flex-wrap: wrap;
  }

  .auth-overlay {
    padding: 64px 10px 10px;
    justify-content: center;
  }

  .auth-modal {
    width: min(100%, 390px);
  }

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

  .book-detail-panel {
    grid-template-columns: 1fr;
  }

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

  .cookie-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .orders-table td,
  .orders-table th {
    white-space: nowrap;
  }

  .orders-table {
    min-width: 100%;
  }

  .orders-table thead {
    display: none;
  }

  .orders-table tbody {
    display: block;
  }

  .orders-table tbody tr {
    display: block;
    border: 1px solid #e8eef5;
    border-radius: 10px;
    background: #fff;
    margin-bottom: 10px;
    padding: 8px 10px;
  }

  .orders-table tbody td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    white-space: normal;
    border-bottom: 1px solid #eef3f8;
    padding: 8px 0;
  }

  .orders-table tbody td:last-child {
    border-bottom: 0;
  }

  .orders-table tbody td::before {
    content: attr(data-label);
    font-weight: 700;
    color: #385772;
    min-width: 92px;
  }

  .orders-table .inline-form {
    margin-right: 4px;
    margin-top: 6px;
  }
}
