@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:wght@700;800&display=swap');

:root {
  --bg: #f7f8f4;
  --surface: #ffffff;
  --surface-2: #eef6f3;
  --ink: #18211f;
  --muted: #687572;
  --line: #dce5e1;
  --brand: #0f766e;
  --brand-dark: #0a5b55;
  --brand-soft: #d9efea;
  --accent: #f59e0b;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(18, 38, 34, 0.10);
  --shadow-sm: 0 8px 24px rgba(18, 38, 34, 0.08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 0 0, rgba(15,118,110,.08), transparent 30rem),
    var(--bg);
  color: var(--ink);
  font-family: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }

.hidden { display: none !important; }

.app-shell {
  width: min(100%, 1480px);
  min-height: 100vh;
  margin: 0 auto;
  padding-bottom: calc(92px + var(--safe-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 12px clamp(16px, 4vw, 56px);
  background: rgba(247,248,244,.88);
  border-bottom: 1px solid rgba(220,229,225,.85);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  color: inherit;
  text-align: left;
  border: 0;
  background: transparent;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  aspect-ratio: 1;
  color: white;
  font-family: "Playfair Display", serif;
  font-size: 1.7rem;
  font-weight: 800;
  border-radius: 15px 15px 15px 5px;
  background: var(--brand);
  box-shadow: var(--shadow-sm);
}

.brand strong { display: block; font-size: 1.12rem; }
.brand small { display: block; color: var(--muted); font-size: .72rem; }

.top-actions { display: flex; align-items: center; gap: 10px; }
.cloud-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 11px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}
.cloud-status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #98a2a0;
}
.cloud-status.online { color: #087443; border-color: #a8dfc4; background: #effbf5; }
.cloud-status.online i { background: #12a663; box-shadow: 0 0 0 4px rgba(18,166,99,.12); }
.cloud-status.connecting { color: #8a5a00; border-color: #ead39b; background: #fff9e8; }
.cloud-status.connecting i { background: #e5a000; animation: cloud-pulse 1s infinite alternate; }
.cloud-status.offline { color: #8b3a32; border-color: #ecc1bc; background: #fff5f4; }
.cloud-status.offline i { background: #d04a3a; }
@keyframes cloud-pulse { to { opacity: .35; transform: scale(.75); } }


.icon-btn, .avatar-btn {
  display: grid;
  place-items: center;
  width: 43px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 4px 14px rgba(18,38,34,.05);
}

.icon-btn { color: var(--brand); font-size: 1.35rem; }
.avatar-btn { color: white; font-weight: 800; background: var(--ink); }

main { padding: 0 clamp(16px, 4vw, 56px); }

.view { display: none; animation: view-in .24s ease; }
.view.active { display: block; }

@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero {
  position: relative;
  overflow: hidden;
  margin-top: 18px;
  padding: clamp(28px, 6vw, 72px);
  color: white;
  border-radius: var(--radius-xl);
  background:
    linear-gradient(115deg, rgba(7,63,59,.97), rgba(15,118,110,.87)),
    radial-gradient(circle at 90% 15%, rgba(255,255,255,.22), transparent 28%);
  box-shadow: var(--shadow);
}

.hero::after {
  content: "BOOK";
  position: absolute;
  right: -22px;
  bottom: -56px;
  color: rgba(255,255,255,.06);
  font-family: "Playfair Display", serif;
  font-size: clamp(6rem, 18vw, 17rem);
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

.hero-copy { position: relative; z-index: 1; max-width: 760px; }
.hero h1, .page-heading h1 {
  margin: 8px 0 14px;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(2.25rem, 5vw, 5rem);
  line-height: .98;
  letter-spacing: -.035em;
}
.hero p { max-width: 620px; margin: 0; color: rgba(255,255,255,.78); font-size: clamp(1rem, 2vw, 1.2rem); }

.eyebrow {
  display: block;
  color: var(--brand);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.hero .eyebrow, .sell-banner .eyebrow { color: #a7f3d0; }

.search-box {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  max-width: 760px;
  margin-top: 30px;
  padding: 8px 8px 8px 17px;
  border-radius: 18px;
  background: white;
  box-shadow: 0 18px 45px rgba(0,0,0,.18);
}
.search-box > span { color: var(--brand); font-size: 1.45rem; }
.search-box input {
  min-width: 0;
  padding: 12px 4px;
  color: var(--ink);
  border: 0;
  outline: 0;
  background: transparent;
}
.search-box button {
  padding: 12px 18px;
  color: white;
  font-weight: 800;
  border: 0;
  border-radius: 12px;
  background: var(--brand);
}
.search-box.standalone {
  max-width: none;
  margin: 22px 0 18px;
  border: 1px solid var(--line);
  box-shadow: none;
}

.hero-stats {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin-top: 34px;
}
.hero-stats div { display: grid; gap: 2px; }
.hero-stats strong { font-size: 1.35rem; }
.hero-stats span { color: rgba(255,255,255,.68); font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; }

.section-block { padding: 42px 0 10px; }
.soft-block {
  margin-inline: calc(clamp(16px, 4vw, 56px) * -1);
  padding-inline: clamp(16px, 4vw, 56px);
  background: linear-gradient(180deg, transparent, rgba(217,239,234,.44), transparent);
}
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.section-heading h2, .sell-banner h2, .data-tools h2 {
  margin: 4px 0 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

.text-btn {
  padding: 8px 0;
  color: var(--brand);
  font-weight: 800;
  border: 0;
  background: transparent;
}
.danger-text { color: var(--danger); }

.category-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(150px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  scrollbar-width: thin;
}
.category-card {
  display: grid;
  gap: 16px;
  min-height: 144px;
  padding: 18px;
  color: var(--ink);
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 5px 18px rgba(18,38,34,.05);
  transition: .18s ease;
}
.category-card:hover { transform: translateY(-3px); border-color: var(--brand); }
.category-card .category-icon { font-size: 1.8rem; }
.category-card strong { font-size: .98rem; }
.category-card small { color: var(--muted); }

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

.book-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 8px 25px rgba(18,38,34,.06);
  transition: .2s ease;
}
.book-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); }
.book-card.sold { opacity: .72; }
.book-card-cover {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: linear-gradient(135deg, #dce9e5, #f4efe2);
}
.book-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 18px;
  color: white;
  text-align: center;
  background: linear-gradient(145deg, var(--brand), #123d42);
}
.cover-fallback span { font-family: "Playfair Display", serif; font-size: 1.05rem; }
.card-badge {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 6px 9px;
  color: white;
  font-size: .68rem;
  font-weight: 800;
  border-radius: 999px;
  background: rgba(24,33,31,.84);
  backdrop-filter: blur(8px);
}
.card-distance {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 5px 8px;
  color: var(--ink);
  font-size: .68rem;
  font-weight: 700;
  border-radius: 999px;
  background: rgba(255,255,255,.9);
}
.favorite-btn {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 38px;
  aspect-ratio: 1;
  color: var(--ink);
  font-size: 1.2rem;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.91);
  box-shadow: 0 6px 14px rgba(0,0,0,.12);
}
.favorite-btn.active { color: #d92d20; }

.book-card-body { padding: 14px; }
.book-card-body h3 {
  min-height: 2.55em;
  margin: 0 0 4px;
  overflow: hidden;
  font-size: .98rem;
  line-height: 1.28;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.book-card-body .author {
  min-height: 1.3em;
  margin: 0 0 12px;
  overflow: hidden;
  color: var(--muted);
  font-size: .78rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 12px;
}
.meta-pill {
  padding: 5px 7px;
  color: #49605b;
  font-size: .66rem;
  border-radius: 999px;
  background: var(--surface-2);
}
.card-footer { display: flex; align-items: end; justify-content: space-between; gap: 8px; }
.card-footer .location { color: var(--muted); font-size: .72rem; }
.price { color: var(--brand-dark); font-size: 1.12rem; font-weight: 900; }
.book-card-click {
  position: absolute;
  inset: 0;
  z-index: 1;
  border: 0;
  background: transparent;
}
.favorite-btn, .book-card a { z-index: 3; }

.sell-banner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 22px;
  margin: 46px 0;
  padding: clamp(24px, 5vw, 44px);
  color: white;
  border-radius: var(--radius-xl);
  background: var(--ink);
}
.sell-banner p { margin: 8px 0 0; color: #b5c5c1; }
.sell-banner-icon {
  display: grid;
  place-items: center;
  width: 64px;
  aspect-ratio: 1;
  color: var(--ink);
  font-size: 2rem;
  border-radius: 20px;
  background: #a7f3d0;
}

.primary-btn, .secondary-btn, .danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 17px;
  font-weight: 800;
  border-radius: 12px;
  transition: .18s ease;
}
.primary-btn { color: white; border: 1px solid var(--brand); background: var(--brand); }
.primary-btn:hover { background: var(--brand-dark); }
.secondary-btn { color: var(--ink); border: 1px solid var(--line); background: var(--surface); }
.secondary-btn:hover { border-color: var(--brand); }
.danger-btn { color: var(--danger); border: 1px solid #f3b8b3; background: #fff5f4; }
.compact { min-height: 38px; padding: 8px 12px; font-size: .82rem; }
.icon-only { min-width: 44px; padding: 0; }

.page-heading { max-width: 850px; padding: 52px 0 6px; }
.page-heading h1 { color: var(--ink); font-size: clamp(2.4rem, 6vw, 4.7rem); }
.page-heading p { margin: 0; color: var(--muted); font-size: 1.05rem; }

.filter-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.filter-panel label { display: grid; gap: 6px; }
.filter-panel label span { color: var(--muted); font-size: .72rem; font-weight: 700; }
.filter-panel select, .field input, .field select, .field textarea {
  width: 100%;
  min-height: 45px;
  padding: 10px 12px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: white;
}
.field textarea { resize: vertical; }
.filter-panel select:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15,118,110,.12); }

.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 0 14px;
}

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 310px;
  padding: 35px;
  text-align: center;
  border: 1px dashed #b8c9c4;
  border-radius: var(--radius-xl);
  background: rgba(255,255,255,.55);
}
.empty-state > div { font-size: 3rem; }
.empty-state h3 { margin: 12px 0 4px; }
.empty-state p { max-width: 450px; margin: 0 0 18px; color: var(--muted); }

.profile-hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  margin-top: 34px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.profile-hero h1 { margin: 4px 0; font-family: "Playfair Display", serif; font-size: clamp(2rem, 5vw, 3.5rem); }
.profile-hero p { margin: 0; color: var(--muted); }
.profile-avatar {
  display: grid;
  place-items: center;
  width: 82px;
  aspect-ratio: 1;
  color: white;
  font-size: 1.5rem;
  font-weight: 900;
  border-radius: 25px;
  background: var(--brand);
}
.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 18px 0 42px;
}
.profile-stats div {
  display: grid;
  gap: 2px;
  padding: 20px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.profile-stats strong { font-size: 1.5rem; }
.profile-stats span { color: var(--muted); font-size: .75rem; }

.manage-list { display: grid; gap: 10px; }
.manage-item {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.manage-cover { width: 58px; aspect-ratio: 4/5; overflow: hidden; border-radius: 8px; background: var(--surface-2); }
.manage-cover img { width: 100%; height: 100%; object-fit: cover; }
.manage-item h3 { margin: 0 0 4px; font-size: .94rem; }
.manage-item p { margin: 0; color: var(--muted); font-size: .75rem; }
.manage-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 6px; }

.data-tools {
  margin: 44px 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface-2);
}
.data-tools p { color: var(--muted); }
.tool-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.file-btn { position: relative; cursor: pointer; }
.file-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: max(12px, var(--safe-bottom));
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: min(calc(100% - 24px), 620px);
  min-height: 67px;
  padding: 7px;
  border: 1px solid rgba(220,229,225,.9);
  border-radius: 22px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 16px 48px rgba(18,38,34,.18);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
}
.nav-item {
  display: grid;
  place-items: center;
  gap: 2px;
  color: var(--muted);
  border: 0;
  border-radius: 15px;
  background: transparent;
}
.nav-item span { font-size: 1.25rem; line-height: 1; }
.nav-item small { font-size: .66rem; font-weight: 700; }
.nav-item.active { color: var(--brand); background: var(--brand-soft); }
.sell-nav {
  align-self: center;
  justify-self: center;
  width: 58px;
  height: 58px;
  margin-top: -25px;
  color: white;
  border-radius: 19px;
  background: var(--brand);
  box-shadow: 0 10px 22px rgba(15,118,110,.32);
}
.sell-nav small { color: white; }

.app-dialog {
  width: min(94vw, 850px);
  max-height: 92vh;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-xl);
  background: transparent;
  box-shadow: var(--shadow);
}
.app-dialog::backdrop { background: rgba(7,20,18,.66); backdrop-filter: blur(5px); }
.dialog-card {
  max-height: 92vh;
  padding: clamp(20px, 4vw, 34px);
  overflow-y: auto;
  background: var(--surface);
}
.small-card { max-width: 540px; margin: 0 auto; }
.dialog-header { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.dialog-header h2 { margin: 4px 0 0; font-family: "Playfair Display", serif; font-size: 2rem; }
.close-btn {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  aspect-ratio: 1;
  color: var(--ink);
  font-size: 1.55rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
}
.form-grid { display: grid; gap: 14px; }
.two-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { color: #40514d; font-size: .76rem; font-weight: 800; }
.field-note { margin: -4px 0 18px; color: var(--muted); font-size: .76rem; }
.grow { flex: 1; margin: 0; }
.isbn-panel { display: flex; align-items: end; gap: 8px; }
.cover-editor {
  display: grid;
  grid-template-columns: 145px 1fr;
  gap: 18px;
  margin-top: 4px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fbfcfb;
}
.cover-preview {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  aspect-ratio: 4/5;
  overflow: hidden;
  color: var(--muted);
  text-align: center;
  border: 1px dashed #b8c9c4;
  border-radius: 12px;
  background: var(--surface-2);
}
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.cover-preview span { font-size: 2rem; }
.cover-controls { align-self: center; }
.check-row { display: flex; align-items: center; gap: 10px; margin: 18px 0; color: #40514d; font-size: .86rem; }
.check-row input { width: 18px; height: 18px; accent-color: var(--brand); }
.dialog-actions { display: flex; justify-content: end; gap: 10px; margin-top: 24px; }

.details-card { padding: 0; }
.details-layout { display: grid; grid-template-columns: minmax(260px, .8fr) 1.2fr; }
.details-cover { min-height: 530px; background: var(--surface-2); }
.details-cover img { width: 100%; height: 100%; object-fit: cover; }
.details-copy { position: relative; padding: clamp(24px, 5vw, 45px); }
.details-copy .close-btn { position: absolute; right: 20px; top: 20px; }
.details-copy h2 { max-width: 90%; margin: 10px 0 4px; font-family: "Playfair Display", serif; font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1.02; }
.details-author { margin: 0 0 18px; color: var(--muted); }
.details-price { margin: 18px 0; color: var(--brand-dark); font-size: 2rem; font-weight: 900; }
.details-description { color: #40514d; line-height: 1.65; }
.seller-box {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 22px;
  padding: 16px;
  border-radius: 16px;
  background: var(--surface-2);
}
.seller-avatar {
  display: grid;
  place-items: center;
  width: 48px;
  aspect-ratio: 1;
  color: white;
  font-weight: 900;
  border-radius: 15px;
  background: var(--brand);
}
.seller-box strong, .seller-box small { display: block; }
.seller-box small { margin-top: 3px; color: var(--muted); }
.contact-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }

.scanner-card { overflow: hidden; }
.camera-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4/3;
  border-radius: 18px;
  background: #0b1614;
}
.camera-frame video { width: 100%; height: 100%; object-fit: cover; }
.scan-guide {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 35%;
  height: 28%;
  border: 3px solid #a7f3d0;
  border-radius: 14px;
  box-shadow: 0 0 0 999px rgba(0,0,0,.25);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(98px + var(--safe-bottom));
  z-index: 90;
  max-width: min(90vw, 520px);
  padding: 13px 18px;
  color: white;
  font-weight: 700;
  text-align: center;
  border-radius: 999px;
  background: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 15px);
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 760px) {
  .book-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
  .book-card-body { padding: 17px; }
}
@media (min-width: 1120px) {
  .book-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 920px) {
  .filter-panel { grid-template-columns: repeat(2, 1fr); }
  .filter-panel .secondary-btn { grid-column: 1 / -1; }
  .details-layout { grid-template-columns: .8fr 1.2fr; }
}
@media (max-width: 700px) {
  .cloud-status span:last-child { display: none; }
  .cloud-status { width: 38px; padding: 0; justify-content: center; }
  .topbar { min-height: 66px; }
  .brand small { display: none; }
  .hero { margin-top: 10px; padding: 28px 20px 24px; }
  .hero h1 { font-size: clamp(2.25rem, 12vw, 3.6rem); }
  .hero-stats { gap: 20px; }
  .section-block { padding-top: 34px; }
  .sell-banner { grid-template-columns: auto 1fr; padding: 24px 20px; }
  .sell-banner .primary-btn { grid-column: 1 / -1; }
  .page-heading { padding-top: 36px; }
  .profile-hero { grid-template-columns: auto 1fr; padding: 20px; }
  .profile-hero .secondary-btn { grid-column: 1 / -1; }
  .manage-item { grid-template-columns: 50px 1fr; }
  .manage-actions { grid-column: 1 / -1; justify-content: stretch; }
  .manage-actions button { flex: 1; }
  .two-cols { grid-template-columns: 1fr; }
  .cover-editor { grid-template-columns: 110px 1fr; }
  .details-layout { grid-template-columns: 1fr; }
  .details-cover { min-height: 350px; max-height: 48vh; }
  .details-copy { padding: 25px 20px 30px; }
}
@media (max-width: 480px) {
  main { padding-inline: 12px; }
  .topbar { padding-inline: 12px; }
  .book-grid { gap: 10px; }
  .book-card-body { padding: 11px; }
  .book-card-body h3 { font-size: .88rem; }
  .price { font-size: 1rem; }
  .filter-panel { grid-template-columns: 1fr; }
  .filter-panel .secondary-btn { grid-column: auto; }
  .search-box button { padding-inline: 12px; }
  .profile-stats div { padding: 15px 6px; }
  .isbn-panel { flex-wrap: wrap; }
  .isbn-panel .grow { flex-basis: 100%; }
  .cover-editor { grid-template-columns: 1fr; }
  .cover-preview { width: 140px; justify-self: center; }
  .contact-actions { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* BookSale V3: account, legal, moderation and anti-spam */
.account-top-btn { white-space: nowrap; }
.account-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 18px 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}
.account-panel h2 { margin: 4px 0; font-family: "Playfair Display", serif; }
.account-panel p { margin: 0; color: var(--muted); }
.account-panel-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 20px; padding: 5px; border-radius: 14px; background: var(--surface-2); }
.auth-tab { min-height: 42px; border: 0; border-radius: 10px; color: var(--muted); font-weight: 800; background: transparent; }
.auth-tab.active { color: white; background: var(--brand); }
.auth-form { display: grid; }
.full-btn { width: 100%; margin-top: 14px; }
.inline-link { display: inline; padding: 0; color: var(--brand); font-weight: 800; border: 0; background: transparent; text-decoration: underline; }
.security-check { margin: 18px 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fbfcfb; }
.security-check > strong { display: block; margin-bottom: 10px; }
.turnstile-warning { margin: 8px 0; padding: 10px; color: #8a3b12; border-radius: 10px; background: #fff5e8; }
.danger-outline { color: var(--danger); border-color: #efc1bd; }
.moderation-note { margin-top: 5px !important; color: var(--danger) !important; }
.site-footer { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; padding: 20px 16px 110px; color: var(--muted); font-size: .8rem; }
.site-footer button, .site-footer a { padding: 0; color: var(--brand); border: 0; background: transparent; text-decoration: none; }
.legal-dialog { width: min(94vw, 850px); }
.legal-copy { line-height: 1.65; }
.legal-copy h3 { margin: 24px 0 5px; }
.legal-copy p { color: #40514d; }
.legal-warning { padding: 14px; border-left: 4px solid var(--accent); border-radius: 8px; background: #fff9e8; }
.admin-dialog { width: min(96vw, 1100px); }
.admin-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.admin-columns h3 { font-family: "Playfair Display", serif; font-size: 1.4rem; }
.admin-list { display: grid; gap: 10px; }
.admin-item { padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.admin-item strong, .admin-item small { display: block; }
.admin-item small { margin-top: 4px; color: var(--muted); }
.admin-item p { color: #40514d; font-size: .86rem; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.cf-turnstile { max-width: 100%; }

@media (max-width: 760px) {
  .account-top-btn { max-width: 80px; overflow: hidden; text-overflow: ellipsis; }
  .account-panel { align-items: stretch; flex-direction: column; }
  .account-panel-actions > * { flex: 1; }
  .admin-columns { grid-template-columns: 1fr; }
}
