/* Kitob ADTI -- Modernist look, adapted from the Marketplace design. */

@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/9a97d8ee-9ad8-4c28-9a49-6b6cbe50ee6f.woff2') format('woff2');
}
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/ca51ae33-0574-4f00-b894-633fdb92bb8c.woff2') format('woff2');
}
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('/assets/fonts/8bede65b-2418-4bb0-acfc-e9cc245d8c8e.woff2') format('woff2');
}

:root {
  --ink: #201e1d;
  --ink-soft: rgba(32, 30, 29, 0.68);
  --paper: #ffffff;
  --bg: #f5f4f2;
  --surface: #edebe8;
  --line: #e0ddd8;
  --accent: #e2553a;
  --accent-soft: #f9e3dc;
  --accent-deep: #c03a1f;
  --ok: #2d9c5b;
  --ok-soft: #e2f4ea;
  --ko: #e0493a;
  --warn: #e6a23c;
  --warn-soft: #fbf0dc;
  --radius: 10px;
  --radius-lg: 18px;
  --shadow: 0 1px 2px rgba(32, 30, 29, 0.05), 0 4px 16px rgba(32, 30, 29, 0.05);
  --ff: 'Archivo', 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --sb: 250px;
  --top: 62px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ff);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }

button { cursor: pointer; background: none; border: none; padding: 0; }

img { display: block; }

/* ── shell ─────────────────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--sb) 1fr;
  max-width: 1320px;
  margin: 0 auto;
  min-height: 100vh;
}

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--top);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  z-index: 40;
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}
.brand .logo { width: 30px; height: 30px; flex: none; }
.brand > div { display: flex; flex-direction: column; }
.brand b {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.brand b em { font-style: normal; color: var(--accent); }
.brand span {
  font-size: 12.5px;
  color: var(--ink-soft);
}
.toplang { margin-left: auto; }
.toplang .langbox { flex-wrap: nowrap; gap: 4px; }
.toplang .langbox button { padding: 4px 8px; font-size: 11.5px; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 26px 22px;
  background: var(--paper);
  border-right: 1px solid var(--line);
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav .ni {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14.5px;
  color: var(--ink-soft);
  transition: background 0.12s, color 0.12s;
}
.nav .ni svg { width: 20px; height: 20px; stroke: currentColor; flex: none; }
.nav .ni:hover { background: var(--surface); color: var(--ink); }
.nav .ni.on {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(226, 85, 58, 0.35);
}
.nav .ni .bdg {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 800;
  background: var(--accent-soft);
  color: var(--accent-deep);
  border-radius: 999px;
  padding: 1px 8px;
}
.nav .ni.on .bdg { background: rgba(255, 255, 255, 0.95); color: var(--accent-deep); }

.sidefoot {
  margin-top: auto;
  font-size: 12px;
  color: var(--ink-soft);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.langbox {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.langbox button {
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-soft);
}
.langbox button.on { background: var(--ink); border-color: var(--ink); color: #fff; }

.main {
  padding: 30px 34px 80px;
  min-width: 0;
}

/* strip: the live order bar every screen shows */
.strip {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.strip .sm { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.strip .st { font-size: 14.5px; font-weight: 800; }
.strip .sp { margin-left: auto; color: var(--accent); font-weight: 800; font-size: 13px; }
.strip .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  flex: none;
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.6; }
}

/* ── home ──────────────────────────────────────────────────────────────── */
.hp {
  display: grid;
  grid-template-columns: var(--sb2, 248px) 1fr;
  gap: 26px;
}
.home-side { min-width: 0; }
.home-main { min-width: 0; }

.searchbar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 4px 8px 4px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  flex: 1;
}
.searchbar svg { width: 18px; height: 18px; stroke: var(--ink-soft); flex: none; }
.searchbar input {
  flex: 1;
  border: none;
  outline: none;
  background: none;
  padding: 11px 4px;
}
.searchbar button {
  background: var(--accent);
  color: #fff;
  font-size: 13.5px;
  font-weight: 800;
  padding: 9px 18px;
  border-radius: 12px;
}

.range { width: 100%; accent-color: var(--accent); height: 4px; }
.range-lab {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--ink-soft);
  font-weight: 600;
}

.filterblock { margin-bottom: 26px; }
.filterblock h4 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: 13px;
  font-weight: 600;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}
.chip.on {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.chip.muted { color: var(--ink-soft); }

.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px;
}

.book-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.book-card:hover { transform: translateY(-3px); box-shadow: 0 6px 22px rgba(32,30,29,0.10); }
.cover {
  position: relative;
  aspect-ratio: 3 / 4;
  background:
    radial-gradient(140% 90% at 20% 0%, #3c3a38 0%, #262422 55%, #191816 100%);
  display: flex;
  align-items: flex-end;
  padding: 13px 14px;
  overflow: hidden;
}
.cover img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: 3;
  background: #262422;
}
/* the book icon on thumbnails that have no photo */
.ci {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, 0.55);
}
.ci svg { width: 45%; height: 45%; }
.ob-cover .ci svg { width: 40%; height: 40%; }
.cover .ct { position: relative; z-index: 2; }
.cover .ct b {
  display: block;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.22;
  text-shadow: 0 1px 6px rgba(0,0,0,0.45);
  max-width: 92%;
}
.cover .ct i {
  display: block;
  margin-top: 4px;
  font-style: normal;
  color: rgba(255,255,255,0.72);
  font-size: 12px;
}
.card-body { padding: 13px 15px 15px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.card-body .bt {
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-body .cs {
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 600;
}
.card-foot {
  margin-top: auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
}
.price { font-size: 17px; font-weight: 800; }
.price small { font-size: 11.5px; font-weight: 600; color: var(--ink-soft); }

.cond-pill {
  align-self: flex-start;
  font-size: 11.5px;
  font-weight: 800;
  color: #fff;
  background: var(--accent);
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.cond-pill.good { background: var(--warn); }
.cond-pill.worn { background: #8a857e; }
.cond-pill.new { background: var(--ok); }
.cond-pill.held { background: var(--ink); }
.cond-pill.stock { background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.pills { display: flex; flex-wrap: wrap; gap: 5px; }
.results { font-size: 13px; color: var(--ink-soft); font-weight: 600; margin: -6px 0 12px; }

.sellerline {
  font-size: 12.5px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
}
.sellerline.mine { color: var(--accent-deep); }

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 64px 18px;
  color: var(--ink-soft);
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
}
.empty svg { width: 46px; height: 46px; stroke: var(--line); margin: 0 auto 14px; }
.empty h2 { margin: 0 0 6px; font-weight: 800; color: var(--ink); font-size: 18px; }
.empty p { margin: 0 0 18px; font-size: 14px; }

.hrow {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.hrow h1 { margin: 0; font-size: 23px; font-weight: 800; letter-spacing: -0.01em; }
.hrow .hc { color: var(--ink-soft); font-size: 13.5px; font-weight: 600; }
.hrow .searchbar { margin-bottom: 0; }
.hrow .searchbar + .filterbtn { flex: none; }

/* the "Filtr" toggle only exists on phones; desktop shows the filter column */
.filterbtn {
  display: none;
  align-items: center;
  gap: 7px;
  height: 50px;
  padding: 0 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  font-weight: 700;
  font-size: 14px;
}
.filterbtn svg { width: 18px; height: 18px; }
.filterbtn.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.filterbtn .fcount {
  background: var(--accent);
  color: #fff;
  font-size: 11.5px;
  font-weight: 800;
  border-radius: 999px;
  padding: 1px 7px;
}
.hrow.existing .btn { margin-left: auto; }

/* ── detail ────────────────────────────────────────────────────────────── */
.detail {
  display: grid;
  grid-template-columns: minmax(220px, 380px) 1fr;
  gap: 30px;
  align-items: start;
}
.dcover {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #262422;
  position: sticky;
  top: 24px;
}
.dcover .cover { aspect-ratio: 3 / 4; padding: 18px; }
/* The cover and the extra photos, swiped sideways. */

.gtrack { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.gtrack::-webkit-scrollbar { display: none; }
.gslide { flex: 0 0 100%; scroll-snap-align: center; padding: 0; display: block; cursor: zoom-in; }
.gslide .cover img { object-fit: contain; background: #262422; }
.gdots { display: flex; justify-content: center; gap: 6px; padding: 9px 0 10px; pointer-events: none; }
.gdots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,0.45); transition: background 0.15s, transform 0.15s; }
.gdots i.on { background: #fff; transform: scale(1.2); }
.meta .mstock { background: var(--accent-soft); color: var(--accent-deep); }
.dinfo .dtag { color: var(--ink-soft); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.dinfo h1 { margin: 8px 0 6px; font-size: 30px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.15; }
.dinfo .dsub { color: var(--ink-soft); font-size: 15px; font-weight: 600; }
.dprice { margin: 20px 0 4px; font-size: 30px; font-weight: 800; }
.dfees { font-size: 13.5px; color: var(--ink-soft); margin-bottom: 20px; }

.meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 4px; }
.meta span {
  font-size: 13px;
  font-weight: 600;
  background: var(--surface);
  border-radius: 999px;
  padding: 7px 13px;
}

.dsect {
  margin-top: 22px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.dsect h3 { margin: 0 0 4px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); }
.dsect p { margin: 8px 0 0; font-size: 14.5px; color: var(--ink); white-space: pre-wrap; }

.sellerblock {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 15px 18px;
}
.avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.sellerblock .nn { font-weight: 800; }
.sellerblock .nn small { display: block; font-weight: 600; color: var(--accent-deep); font-size: 12.5px; }
.sellerblock .st { margin-left: auto; font-weight: 800; color: var(--accent-deep); font-size: 13px; }

.cta {
  margin-top: 24px;
  width: 100%;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  font-size: 15px;
  padding: 13px 22px;
  border-radius: var(--radius);
  transition: transform 0.1s, box-shadow 0.1s, background 0.12s;
  text-decoration: none;
  border: 1px solid transparent;
}
.btn:active { transform: scale(0.98); }
.btn.solid { background: var(--accent); color: #fff; box-shadow: 0 6px 18px rgba(226,85,58,0.32); }
.btn.solid:hover { background: var(--accent-deep); }
.btn.ghost { background: var(--paper); border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { border-color: var(--ink); }
.btn.link { color: var(--accent-deep); font-weight: 700; font-size: 13.5px; padding: 8px 2px; }
.btn.soft { background: var(--surface); }
.btn.danger {
  background: var(--paper);
  border-color: #f0c4bd;
  color: var(--ko);
}
.btn.big { font-size: 16.5px; padding: 16px 26px; border-radius: 14px; }
.btn[disabled] { opacity: 0.55; pointer-events: none; }

/* ── dialog ────────────────────────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(32, 30, 29, 0.45);
  backdrop-filter: blur(3px);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 60;
}
.overlay.open { display: flex; }
.obox {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  background: var(--paper);
  border-radius: 22px 22px 0 0;
  padding: 22px 22px 18px;
  animation: rise 0.18s ease;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.16);
}
@keyframes rise { from { transform: translateY(26px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.otitle { font-size: 19px; font-weight: 800; margin: 0 0 8px; }
.osub { font-size: 14.5px; color: var(--ink-soft); margin: 0 0 4px; white-space: pre-wrap; }
.oacts { display: flex; gap: 10px; margin-top: 18px; }
.oacts .btn { flex: 1; }

/* ── orders ────────────────────────────────────────────────────────────── */

.seg {
  display: inline-flex;
  background: var(--surface);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 20px;
}
.seg button {
  font-size: 13.5px;
  font-weight: 700;
  padding: 9px 18px;
  border-radius: 999px;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.seg button .bdg {
  font-weight: 800;
  font-size: 11px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  border-radius: 999px;
  padding: 1px 8px;
}
.seg button.on { background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }

.orderslist { display: flex; flex-direction: column; gap: 12px; }

.order-card {
  display: flex;
  gap: 14px;
  align-items: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.order-card:hover { border-color: var(--accent); }
.oc-cover {
  width: 52px; height: 68px;
  border-radius: 8px;
  overflow: hidden;
  flex: none;
  position: relative;
  background: radial-gradient(120% 90% at 20% 0%, #3c3a38, #191816);
}
.oc-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 2; }
.oc-body { min-width: 0; flex: 1; }
.oc-body .ot {
  font-weight: 800;
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.oc-body .os {
  font-size: 12.5px;
  color: var(--ink-soft);
  font-weight: 600;
  margin-top: 2px;
}
.oc-foot { text-align: right; flex: none; }
.oc-foot .op { font-weight: 800; }
.oc-foot .oa { color: var(--accent-deep); font-weight: 700; font-size: 12.5px; margin-top: 3px; }

.ost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
}
.ost::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ost.live { background: var(--accent-soft); color: var(--accent-deep); }
.ost.ok { background: var(--ok-soft); color: var(--ok); }
.ost.warn { background: var(--warn-soft); color: #a8690f; }
.ost.dead { background: var(--surface); color: var(--ink-soft); }

/* ── order detail / timeline ───────────────────────────────────────────── */
.ocard {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  box-shadow: var(--shadow);
  max-width: 620px;
}
.ocard .ob {
  display: flex;
  gap: 16px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.ob-cover {
  width: 84px; height: 110px;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  flex: none;
  background: radial-gradient(120% 90% at 20% 0%, #3c3a38, #191816);
}
.ob-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 2; }
.ob-t h2 { margin: 0 0 4px; font-size: 20px; font-weight: 800; }
.ob-t .ob-c { color: var(--ink-soft); font-size: 13.5px; font-weight: 600; }
.ob-t .ob-p { font-size: 20px; font-weight: 800; margin-top: 8px; }
.ob-t .ob-p small { font-weight: 600; font-size: 12px; color: var(--ink-soft); }

.hint.nr {
  margin: 16px 0 0;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--warn-soft);
  color: #8a5a07;
  font-size: 13.5px;
  font-weight: 700;
  padding: 11px 14px;
  border-radius: var(--radius);
}

.timeline { margin: 22px 0 0; display: flex; flex-direction: column; gap: 0; }
/* the gap lives inside the body so the rail's connecting line spans it */
.step { display: flex; gap: 14px; position: relative; }
.step .st-body { padding-bottom: 22px; }
.step:last-child .st-body { padding-bottom: 0; }
.step .rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: none;
  width: 26px;
}
.step .rad {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2.5px solid var(--line);
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  flex: none;
}
.step .lobe { flex: 1; width: 2.5px; background: var(--line); margin: 4px 0; }
.step.done .lobe { background: var(--accent); }
.step.done .rad, .step.cur .rad { border-color: var(--accent); }
.step.done .rad::after {
  content: '✓';
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}
.step.done .rad { background: var(--accent); }
.step.cur .rad { background: #fff; }
.step.cur .rad::after { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.step .st-body { padding-top: 1px; }
.step .stt { font-weight: 800; font-size: 15px; }
.step .sth { font-size: 13px; color: var(--ink-soft); margin-top: 1px; }
.step .sth.note { color: var(--accent-deep); font-weight: 700; margin-top: 4px; }
.step.cur .stt { color: var(--accent-deep); }

.odo { margin: 18px 0 0; }
.odo button { width: 100%; }
.odo .divdiv {
  margin: 0 0 14px;
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}
.odo .divdiv b { font-weight: 800; }

.ocard .parties {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 13.5px;
}
.ocard .parties b { color: var(--ink); font-weight: 700; }

/* ── gate ──────────────────────────────────────────────────────────────── */
.gate {
  max-width: 430px;
  margin: 9vh auto 0;
  text-align: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 38px 28px 30px;
  box-shadow: var(--shadow);
}
.gate .glock {
  width: 58px; height: 58px;
  margin: 0 auto 16px;
  border-radius: 18px;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-deep);
}
.gate .glock svg { width: 28px; height: 28px; stroke: currentColor; }
.gate h1 { margin: 0 0 8px; font-size: 21px; font-weight: 800; }
.gate p { margin: 0 0 22px; color: var(--ink-soft); font-size: 14.5px; }
.gate .glist { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.gch {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 11px 14px;
  text-decoration: none;
  color: var(--ink);
}
.gch .gl {
  width: 38px; height: 38px; border-radius: 10px; overflow: hidden; flex: none; position: relative;
  background: var(--accent); color: #fff; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.gch .gl img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.gch .gn { font-weight: 800; font-size: 14px; }
.gch .gn small { display: block; font-weight: 600; color: var(--ink-soft); font-size: 12px; }
.gch .gok { margin-left: auto; color: var(--ok); flex: none; }
.gch .gok svg { width: 22px; height: 22px; stroke: currentColor; }
.gch .garr { margin-left: auto; color: var(--ink-soft); flex: none; font-weight: 800; }
.gate .gwarn { color: #a8690f; font-weight: 700; font-size: 13.5px; }
.gate .langbox { justify-content: center; }

/* ── sell form ─────────────────────────────────────────────────────────── */
.sellwrap { max-width: 560px; }
.sellwrap h1 { font-size: 24px; font-weight: 800; margin: 0 0 4px; }
.sellwrap .slead { color: var(--ink-soft); font-size: 14px; margin: 0 0 22px; }

.cover-drop {
  border: 2px dashed var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 18px;
  transition: border-color 0.12s, background 0.12s;
}
.cover-drop:hover, .cover-drop.drag { border-color: var(--accent); background: #fff9f6; }
.cover-drop .cd-img {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  max-width: 170px;
  margin: 0 auto;
  aspect-ratio: 3 / 4;
  background: #262422;
}
.cover-drop .cd-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover-drop .cd-blank { color: var(--ink-soft); font-weight: 600; font-size: 14px; padding: 18px 0 6px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.cover-drop .cd-blank svg { width: 34px; height: 34px; }
.cover-drop .cd-hint { color: var(--ink-soft); font-size: 12.5px; margin-top: 10px; font-weight: 600; }
.cover-drop .cd-del { position: absolute; top: 6px; right: 6px; z-index: 3; background: rgba(32,30,29,0.72); color: #fff; font-size: 15px; font-weight: 800; width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }

.field { margin-bottom: 15px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  margin: 0 0 7px;
}
.field input, .field select, .field textarea {
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 15px;
  outline: none;
  box-shadow: var(--shadow);
}
.field textarea { resize: vertical; min-height: 84px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fhint { font-size: 12.5px; color: var(--ink-soft); margin-top: 7px; line-height: 1.4; }
.field label .lnote { font-weight: 700; letter-spacing: 0; text-transform: none; margin-left: 4px; }

/* Extra listing photos: a row of squares with a "+" tile at the end. */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.pthumb { position: relative; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.pthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pthumb .cd-del { position: absolute; top: 4px; right: 4px; background: rgba(32,30,29,0.72); color: #fff; font-size: 14px; font-weight: 800; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.pthumb.padd { border: 1.5px dashed var(--line); background: var(--paper); color: var(--ink-soft); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-weight: 800; }
.pthumb.padd svg { width: 24px; height: 24px; }
.pthumb.padd:hover { border-color: var(--accent); color: var(--accent-deep); }

/* Card or cash for the seller's money. */
.payopts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.payopt { display: flex; align-items: center; gap: 10px; text-align: left; background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); color: var(--ink); }
.payopt .pico { font-size: 22px; line-height: 1; }
.payopt b { display: block; font-size: 14.5px; }
.payopt small { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 2px; line-height: 1.3; }
.payopt.on { border-color: var(--accent); background: var(--accent-soft); }
.payfile { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 13.5px; background: var(--surface); border-radius: var(--radius); padding: 6px 6px 6px 12px; }
.paycardin { margin-top: 10px; }
.paycardin input { letter-spacing: 0.06em; font-variant-numeric: tabular-nums; }
@media (max-width: 360px) { .payopts { grid-template-columns: 1fr; } }

/* − [n] + for the number of copies. */
.stepper { display: flex; align-items: stretch; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.stepper button { width: 46px; font-size: 20px; font-weight: 800; color: var(--ink); }
.stepper button:disabled { opacity: 0.3; }
.field .stepper input { border: 0; box-shadow: none; border-radius: 0; text-align: center; padding: 13px 0; min-width: 0; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.paycard { font-variant-numeric: tabular-nums; letter-spacing: 0.03em; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; margin-left: 6px; }

.fee-note {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 15px;
  font-size: 13.5px;
  color: var(--ink);
  font-weight: 600;
  margin: 4px 0 18px;
}
.fee-note b { color: var(--accent-deep); }

/* ── misc ──────────────────────────────────────────────────────────────── */
.spinner {
  text-align: center;
  color: var(--ink-soft);
  padding: 40vh 0 0;
  font-size: 14px;
}
.spinner::after {
  content: '';
  display: block;
  width: 30px; height: 30px;
  margin: 12px auto 0;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.err {
  max-width: 460px;
  margin: 12vh auto 0;
  text-align: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 34px 24px;
}
.err h1 { font-size: 20px; font-weight: 800; margin: 0 0 8px; }
.err p { color: var(--ink-soft); margin: 0 0 18px; font-size: 14px; }

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 12px 20px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 80;
  animation: rise 0.2s ease;
  max-width: 90vw;
}

.onlytg {
  max-width: 430px;
  margin: 9vh auto 0;
  text-align: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 36px 26px;
  box-shadow: var(--shadow);
}
.onlytg .glock {
  width: 58px; height: 58px;
  margin: 0 auto 16px;
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  display: flex; align-items: center; justify-content: center;
}
.onlytg .glock svg { width: 28px; height: 28px; }
.onlytg h1 { font-size: 20px; font-weight: 800; margin: 0 0 8px; }
.onlytg p { color: var(--ink-soft); margin: 0; }

.bn {
  font-size: 12px;
  color: var(--ink-soft);
  padding: 2px 0 0;
  font-weight: 600;
}

.hint {
  font-size: 13.5px;
  color: var(--ink-soft);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 15px;
  font-weight: 600;
}
.hint.warnbox { background: var(--warn-soft); color: #8a5a07; }
.rangebox { margin-bottom: 10px; }

/* ── support chat (Telegram look) ──────────────────────────────────────── */
.main.chatmode { display: flex; flex-direction: column; height: 100vh; padding: 20px 34px; }
.chat {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: var(--paper);
  max-width: 760px;
  width: 100%;
}
.chead {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  flex: none;
}
.chead .logo { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.chead b { display: block; font-size: 15.5px; font-weight: 800; }
.chead small { display: block; color: #3390ec; font-size: 13px; font-weight: 600; }
.chatlog {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px 12px;
  /* Telegram's default green wallpaper */
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,0.35) 0 2px, transparent 3px) 0 0 / 38px 38px,
    radial-gradient(circle at 70% 60%, rgba(255,255,255,0.25) 0 1.5px, transparent 2.5px) 0 0 / 52px 52px,
    linear-gradient(160deg, #cfe0b8 0%, #aecb9a 50%, #c7d9a6 100%);
  -webkit-overflow-scrolling: touch;
}
.cempty {
  margin: 18vh auto 0;
  max-width: 300px;
  text-align: center;
  background: rgba(0, 0, 0, 0.22);
  color: #fff;
  border-radius: 16px;
  padding: 18px 18px 14px;
  font-size: 14px;
  font-weight: 600;
}
.cempty svg { width: 36px; height: 36px; }
.cempty p { margin: 8px 0 0; }
.cday { text-align: center; margin: 10px 0 8px; position: sticky; top: 4px; z-index: 2; }
.cday span {
  display: inline-block;
  background: rgba(0, 0, 0, 0.24);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}
.cmsg { display: flex; margin: 2px 0; }
.cmsg.tail { margin-bottom: 7px; }
.cmsg.out { justify-content: flex-end; }
.cbubble {
  position: relative;
  max-width: min(78%, 440px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 1px 1.5px rgba(0, 0, 0, 0.13);
  font-size: 15px;
  line-height: 1.35;
  overflow: hidden;
}
.cmsg.out .cbubble { background: #effdde; }
.cmsg.in.tail .cbubble { border-bottom-left-radius: 5px; }
.cmsg.out.tail .cbubble { border-bottom-right-radius: 5px; }
.cwho { padding: 6px 11px 0; font-size: 13px; font-weight: 800; color: #3390ec; }
.ctext { padding: 6px 11px 7px; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
/* time + ticks float at the end of the last line, as in Telegram */
.cmeta {
  float: right;
  margin: 8px 0 -4px 10px;
  font-size: 11.5px;
  color: #8a9a86;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  user-select: none;
}
.cmsg.in .cmeta { color: #a0a5a8; }
.cmsg.out .cmeta { color: #5fae57; }
.ctick { display: inline-flex; }
.ctick svg { height: 11px; width: auto; }
.cphoto { display: block; position: relative; width: min(280px, 64vw); padding: 0; background: #d9e3d0; }
.cphoto::before { content: ''; display: block; padding-top: calc(var(--r, 0.75) * 100%); }
.cphoto img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cmsg.bare .cbubble { background: transparent; }
.cphoto .cmeta {
  position: absolute;
  right: 6px; bottom: 6px;
  float: none;
  margin: 0;
  background: rgba(0, 0, 0, 0.4);
  color: #fff !important;
  padding: 1px 6px;
  border-radius: 999px;
}
.cbar { flex: none; background: var(--paper); border-top: 1px solid var(--line); }
.ccompose { display: flex; align-items: flex-end; gap: 4px; padding: 6px 8px; }
.ccompose textarea {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  font-size: 16px;   /* 16px keeps iOS from zooming into the field */
  line-height: 1.35;
  padding: 10px 6px;
  max-height: 140px;
}
.cbtn {
  width: 42px; height: 42px;
  flex: none;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #8a9aa6;
}
.cbtn svg { width: 24px; height: 24px; }
.cbtn.send { color: #3390ec; }
.cbtn:hover { background: var(--surface); }
.cattach {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 0;
  font-size: 13.5px;
  font-weight: 700;
  color: #3390ec;
}
.cattach img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; }
.cattach button { margin-left: auto; font-size: 20px; color: var(--ink-soft); width: 32px; height: 32px; }
.cviewer {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.9);
  display: flex; align-items: center; justify-content: center;
  animation: rise 0.15s ease;
}
.cviewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.cavatar {
  position: relative;
  flex: none;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.cavatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* ── profile ───────────────────────────────────────────────────────────── */
.profile { max-width: 620px; }
.pcard {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.phead { text-align: center; padding: 26px 18px 20px; }
.phead h1 { margin: 12px 0 2px; font-size: 22px; font-weight: 800; }
.phead .puser { color: #3390ec; font-weight: 600; font-size: 14.5px; }
.premium { color: #a695e7; font-size: 18px; }
.pinfo { padding: 4px 0; }
.prow {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 11px 18px;
  width: 100%;
  text-align: left;
}
.prow + .prow { border-top: 1px solid var(--surface); }
.prow > svg { width: 22px; height: 22px; color: var(--ink-soft); flex: none; }
.prow > div { flex: 1; min-width: 0; }
.prow .pv { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.prow .pl { font-size: 12.5px; color: var(--ink-soft); margin-top: 1px; }
.prow .langbox { margin-top: 6px; }
.prow.link:hover { background: var(--surface); }
.prow .chev { color: var(--ink-soft); font-size: 20px; }
.muted { color: var(--ink-soft); font-weight: 500; }
/* iOS-style switch */
.switch {
  appearance: none; -webkit-appearance: none;
  width: 46px; height: 28px; flex: none; margin: 0;
  border-radius: 999px; background: var(--line);
  position: relative; cursor: pointer; transition: background 0.15s;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.15s;
}
.switch:checked { background: #3390ec; }
.switch:checked::after { transform: translateX(18px); }
.cardrow { display: flex; gap: 8px; margin: 6px 0; }
.cardrow input {
  flex: 1; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 9px 12px; font-size: 16px; letter-spacing: 0.06em; outline: none;
}
.cardrow input:focus { border-color: var(--accent); }
.btn.small { padding: 7px 12px; font-size: 13px; flex: none; }
.pstats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.pstats div {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
  text-align: center;
}
.pstats b { display: block; font-size: 22px; font-weight: 800; }
.pstats span { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.psect { font-size: 17px; font-weight: 800; margin: 22px 0 12px; }
.pnote { font-size: 12.5px; color: var(--ink-soft); margin: 18px 0 0; }

/* ── responsive ────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .app { display: block; }
  .topbar { display: flex; }
  .sidebar {
    position: fixed;
    bottom: 0;
    top: auto;
    left: 0; right: 0;
    height: auto;
    flex-direction: row;
    justify-content: center;
    gap: 2px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    border-right: none;
    border-top: 1px solid var(--line);
    z-index: 50;
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(10px);
  }
  .sidebar .brand, .sidebar .sidefoot { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-around; }
  .nav .ni {
    position: relative;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 7px 6px;
    font-size: 11px;
    text-align: center;
  }
  .nav .ni.on { box-shadow: none; }
  /* on the tab bar the badge sits on the icon's corner */
  .nav .ni .bdg {
    position: absolute;
    top: 2px;
    left: calc(50% + 6px);
    margin: 0;
    background: var(--accent);
    color: #fff;
    padding: 0 6px;
    font-size: 10.5px;
  }
  .nav .ni.on .bdg { background: #fff; color: var(--accent-deep); }
  .main { padding: calc(var(--top) + env(safe-area-inset-top) + 14px) 16px 110px; }
  .topbar { height: calc(var(--top) + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); }

  /* filters become swipeable chip rows above the results */
  .hp { grid-template-columns: 1fr; gap: 4px; }
  .hrow:has(.filterbtn) { flex-wrap: nowrap; gap: 8px; }
  .hrow .searchbar { min-width: 0; padding-left: 12px; gap: 6px; }
  .searchbar input { min-width: 0; width: 100%; }
  .searchbar button { padding: 9px 14px; }
  .filterbtn { display: inline-flex; }
  .home-side { display: none; }
  .home-side.open { display: block; }
  .filterblock { margin-bottom: 12px; }
  .filterblock h4 { font-size: 11.5px; margin-bottom: 6px; }
  .home-side .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 0 -16px;
    padding: 0 16px 2px;
    scrollbar-width: none;
  }
  .home-side .chips::-webkit-scrollbar { display: none; }
  .home-side .chip { flex: none; padding: 7px 12px; }
  .home-side .rangebox { display: none; }
  .home-side > .btn { margin-bottom: 12px; padding: 9px 16px; font-size: 13.5px; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .nav .ni.deskonly { display: none; }
  .nav .ni { padding: 7px 2px; font-size: 10.5px; min-width: 0; flex: 1; }
  /* the chat fills the space between the top bar and the tab bar */
  .main.chatmode {
    height: 100vh;
    height: 100dvh;
    padding: calc(var(--top) + env(safe-area-inset-top)) 0 calc(69px + env(safe-area-inset-bottom));
  }
  .chat { border: none; border-radius: 0; box-shadow: none; max-width: none; }
  .cbubble { max-width: 84%; }
  .obox { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .detail { grid-template-columns: 1fr; }
  .dcover { position: static; max-width: 300px; margin: 0 auto; }
  .row2 { grid-template-columns: 1fr; }
  .books-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .card-body { padding: 10px 12px 12px; }
  .price { font-size: 15px; }
  .book-card .cond-pill { padding: 3px 8px; font-size: 10.5px; }
  .hrow h1 { font-size: 20px; }
  .hrow { margin-bottom: 14px; }
  .seg { width: 100%; display: flex; }
  .seg button { flex: 1; justify-content: center; }
}

@media (min-width: 901px) {
  .topbar { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}