/* ── Avaratch ─────────────────────────────────────────────────────────
   Cumbrian slate ink on warm cream. Fell green for "go", rust for
   bargains. Flat, honest, readable — built like a good shop counter. */

:root {
  --ink: #26313a;
  --ink-soft: #4a5866;
  --paper: #faf6ee;
  --card: #fffdf8;
  --line: #e2dac8;
  --fell: #2e6248;
  --fell-dark: #234b37;
  --rust: #b4552d;
  --rust-dark: #93431f;
  --sky: #dcebe3;
  --warn: #8a5a13;
  --warn-bg: #fdf3dd;
  --danger: #a03a2a;
  --danger-bg: #fbe9e5;
  --ok-bg: #e6f2ea;
  --radius: 6px;
  --shadow: 0 1px 2px rgb(38 49 58 / 8%), 0 2px 8px rgb(38 49 58 / 6%);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html { font-size: 17px; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
}

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 1rem; }

h1, h2, h3 { font-family: var(--serif); line-height: 1.2; font-weight: 600; }
h1 { font-size: 1.9rem; margin: 0 0 .5rem; }
h2 { font-size: 1.4rem; margin: 2.2rem 0 .8rem; }
h3 { font-size: 1.1rem; margin: 0 0 .4rem; }
a { color: var(--fell-dark); }
a:hover { color: var(--fell); }

img { max-width: 100%; height: auto; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  left: -9999px;     /* offscreen can't create scrollbars even when a
                        table child keeps intrinsic width (§15 zoom fix) */
}

.skip {
  position: absolute; left: -999px; top: 0; background: var(--ink);
  color: #fff; padding: .6rem 1rem; z-index: 50; border-radius: 0 0 var(--radius) 0;
}
.skip:focus { left: 0; color: #fff; }

/* ── header ─────────────────────────────────────────────────────────── */
.site-head {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.head-row {
  display: flex; align-items: center; gap: 1rem;
  padding: .7rem 1rem; flex-wrap: wrap;
}
.brand {
  font-family: var(--serif); font-size: 1.6rem; font-weight: 700;
  color: var(--ink); text-decoration: none; letter-spacing: .01em;
  display: flex; flex-direction: column; line-height: 1;
}
.brand-tag {
  font-family: var(--sans); font-size: .68rem; font-weight: 500;
  color: var(--rust); letter-spacing: .04em; margin-top: .2rem;
  text-transform: lowercase;
}
.search {
  flex: 1 1 260px; display: flex; min-width: 200px; max-width: 560px;
}
.search input {
  flex: 1; min-width: 0;   /* inputs won't shrink below intrinsic size
                              without this — broke 320px layouts (§15) */
  border: 2px solid var(--ink); border-right: 0;
  border-radius: var(--radius) 0 0 var(--radius);
  padding: .55rem .8rem; font-size: 1rem; background: #fff;
}
.search button {
  border: 2px solid var(--ink); background: var(--fell); color: #fff;
  border-radius: 0 var(--radius) var(--radius) 0; padding: .55rem 1.1rem;
  font-size: 1rem; font-weight: 600; cursor: pointer;
}
.search button:hover { background: var(--fell-dark); }

.site-nav { display: flex; gap: .2rem; flex-wrap: wrap; }
.site-nav a {
  color: var(--ink); text-decoration: none; padding: .5rem .7rem;
  border-radius: var(--radius); font-weight: 600; font-size: .95rem;
}
.site-nav a:hover { background: var(--sky); color: var(--ink); }

/* ── buttons ────────────────────────────────────────────────────────── */
.btn, button.btn {
  display: inline-block; font: inherit; font-weight: 700; cursor: pointer;
  border-radius: var(--radius); padding: .8rem 1.4rem; text-decoration: none;
  border: 2px solid transparent; text-align: center; font-size: 1rem;
  min-height: 44px;
}
.btn-primary { background: var(--fell); color: #fff; border-color: var(--fell); }
.btn-primary:hover { background: var(--fell-dark); color: #fff; }
.btn-offer { background: #fff; color: var(--rust-dark); border-color: var(--rust); }
.btn-offer:hover { background: var(--rust); color: #fff; }
.btn-basket { background: var(--sky); color: var(--ink); border-color: var(--line); }
.btn-basket:hover { background: var(--card); }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-quiet:hover { background: var(--sky); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: .45rem .8rem; min-height: 36px; font-size: .9rem; }
.btn-block { display: block; width: 100%; }

/* ── hero / sections ────────────────────────────────────────────────── */
.hero {
  padding: 2.6rem 0 1.6rem; text-align: center;
}
.hero h1 { font-size: 2.4rem; }
.hero p { color: var(--ink-soft); max-width: 46ch; margin: .5rem auto 1.4rem; }
.hero .search { margin: 0 auto; max-width: 520px; }

.cat-row { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; margin: 1.2rem 0 .4rem; }
.cat-chip {
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  padding: .45rem .95rem; border-radius: 999px; text-decoration: none;
  font-weight: 600; font-size: .92rem;
}
.cat-chip:hover, .cat-chip[aria-current="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

.section-head { display: flex; align-items: baseline; justify-content: space-between; }
.section-head a { font-size: .9rem; font-weight: 600; }

/* ── item grid & cards ──────────────────────────────────────────────── */
.grid {
  display: grid; gap: 1.1rem; margin: 1rem 0 2rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; display: flex;
  flex-direction: column; box-shadow: var(--shadow);
  transition: box-shadow .15s ease;
}
.card:hover { box-shadow: 0 3px 10px rgb(38 49 58 / 15%); }
.card-photo {
  aspect-ratio: 4/3; background: #efe9db; display: block; position: relative;
}
.card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-photo .no-photo {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; color: var(--ink-soft); font-family: var(--serif);
  font-style: italic; font-size: .95rem;
}
.card-body { padding: .8rem .9rem 1rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.card-title {
  font-family: var(--serif); font-size: 1.02rem; font-weight: 600;
  color: var(--ink); text-decoration: none; line-height: 1.3;
}
.card-title:hover { color: var(--fell-dark); }
.card-meta { display: flex; gap: .5rem; align-items: center; margin-top: auto; flex-wrap: wrap; }
.price { font-weight: 800; font-size: 1.12rem; color: var(--ink); }
.price .was { font-weight: 500; font-size: .85rem; color: var(--ink-soft); text-decoration: line-through; margin-right: .4rem; }
.chip {
  font-size: .75rem; font-weight: 700; padding: .15rem .55rem;
  border-radius: 999px; background: var(--sky); color: var(--fell-dark);
}
.chip.sold { background: var(--danger-bg); color: var(--danger); }
.chip.rust { background: #fbe8dd; color: var(--rust-dark); }
.chip.grey { background: #ece7db; color: var(--ink-soft); }
.chip.sky { background: var(--sky); color: var(--ink); }

/* ── browse layout ──────────────────────────────────────────────────── */
.browse-layout { display: grid; grid-template-columns: 240px 1fr; gap: 1.6rem; margin-top: 1rem; }
.filters {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem; align-self: start; position: sticky; top: 84px;
}
.filters fieldset { border: 0; padding: 0; margin: 0 0 1.1rem; }
.filters legend, .filters .lbl { font-weight: 700; font-size: .9rem; margin-bottom: .35rem; }
.filters label { display: block; font-size: .92rem; margin: .2rem 0; }
.filters input[type="text"], .filters input[type="number"], .filters select,
.filters input[type="search"] {
  width: 100%; padding: .5rem .6rem; border: 1.5px solid var(--line);
  border-radius: var(--radius); font: inherit; background: #fff;
}
.price-row { display: flex; gap: .5rem; align-items: center; }
.price-row input { width: 6ch; }

.pagination { display: flex; gap: .4rem; justify-content: center; margin: 2rem 0; flex-wrap: wrap; }
.pagination a, .pagination .cur {
  padding: .5rem .85rem; border: 1.5px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: var(--ink); background: var(--card); font-weight: 600;
}
.pagination .cur { background: var(--ink); color: #fff; border-color: var(--ink); }

.empty {
  text-align: center; padding: 3rem 1rem; color: var(--ink-soft);
}
.empty .big { font-family: var(--serif); font-size: 1.4rem; color: var(--ink); }

/* ── item page ──────────────────────────────────────────────────────── */
.item-layout { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 2rem; margin-top: 1.4rem; }
.gallery-main {
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: #efe9db; aspect-ratio: 4/3; position: relative;
}
.gallery-main img { width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; }
.gallery-main.zoomed img { object-fit: cover; cursor: zoom-out; transform: scale(1.6); transform-origin: var(--zx,50%) var(--zy,50%); }
.gallery-thumbs { display: flex; gap: .5rem; margin-top: .6rem; flex-wrap: wrap; }
.gallery-thumbs button {
  border: 2px solid var(--line); border-radius: var(--radius); padding: 0;
  width: 76px; height: 57px; overflow: hidden; cursor: pointer; background: #efe9db;
}
.gallery-thumbs button[aria-current="true"] { border-color: var(--fell); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.no-photo-big {
  display: flex; align-items: center; justify-content: center; height: 100%;
  color: var(--ink-soft); font-family: var(--serif); font-style: italic;
}

.item-info .price { font-size: 1.7rem; }
.cond-line { display: flex; gap: .5rem; align-items: center; margin: .6rem 0; flex-wrap: wrap; }
.item-actions { display: flex; flex-direction: column; gap: .6rem; margin: 1.1rem 0; }
.item-note {
  background: var(--warn-bg); border: 1px solid #ecd9ac; color: var(--warn);
  padding: .7rem .9rem; border-radius: var(--radius); font-size: .92rem;
}
.item-desc { margin-top: 1.4rem; }
.item-desc p { white-space: pre-wrap; }

.spec-table { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: .95rem; }
.spec-table th, .spec-table td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.spec-table th { width: 40%; color: var(--ink-soft); font-weight: 600; }

/* ── forms ──────────────────────────────────────────────────────────── */
.form-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.4rem; max-width: 640px; margin: 1.4rem auto;
}
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; margin-bottom: .3rem; }
.field .hint { font-size: .85rem; color: var(--ink-soft); margin-top: .25rem; }
.field input, .field textarea, .field select {
  width: 100%; padding: .65rem .75rem; border: 1.5px solid var(--line);
  border-radius: var(--radius); font: inherit; background: #fff;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: 3px solid #bcd8cb; border-color: var(--fell);
}
.field input[aria-invalid="true"] { border-color: var(--danger); }
.form-error {
  background: var(--danger-bg); border: 1px solid #efc4bb; color: var(--danger);
  padding: .7rem .9rem; border-radius: var(--radius); margin-bottom: 1rem; font-weight: 600;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.check-line { display: flex; gap: .55rem; align-items: flex-start; margin: .35rem 0; }
.check-line input { width: auto; margin-top: .3rem; }

.flash {
  padding: .7rem 1rem; border-radius: var(--radius); margin: .8rem 0; font-weight: 600;
  background: var(--ok-bg); border: 1px solid #c8e0d2; color: var(--fell-dark);
}

/* ── tables & admin ─────────────────────────────────────────────────── */
.badge {
  display: inline-block; min-width: 1.4rem; text-align: center; background: var(--rust);
  color: #fff; border-radius: 999px; font-size: .75rem; font-weight: 800;
  padding: .05rem .35rem; vertical-align: middle;
}

.tbl { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); }
.tbl th, .tbl td { padding: .6rem .7rem; text-align: left; border-bottom: 1px solid var(--line); font-size: .93rem; }
.tbl th { background: #f2ecdf; font-weight: 700; }
.tbl tr:hover td { background: #f8f4ea; }
.tbl .thumb { width: 56px; height: 42px; object-fit: cover; border-radius: 4px; background: #efe9db; display: block; }
.tbl-wrap { overflow-x: auto; }

.status-pill { font-size: .78rem; font-weight: 700; padding: .15rem .55rem; border-radius: 999px; }
.st-available, .st-paid, .st-collected, .st-completed, .st-accepted { background: var(--ok-bg); color: var(--fell-dark); }
.st-draft, .st-pending_payment, .st-pending { background: #ece7db; color: var(--ink-soft); }
.st-reserved, .st-countered, .st-preparing, .st-ready_for_collection { background: var(--warn-bg); color: var(--warn); }
.st-sold, .st-dispatched { background: #e3ecf7; color: #2d4f7c; }
.st-declined, .st-cancelled, .st-payment_failed, .st-refunded, .st-expired, .st-archived, .st-unavailable, .st-withdrawn { background: var(--danger-bg); color: var(--danger); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .8rem; margin: 1rem 0; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
.stat-card .num { font-size: 1.7rem; font-weight: 800; font-family: var(--serif); }
.stat-card .lbl { font-size: .82rem; color: var(--ink-soft); font-weight: 600; }
.stat-card.hot .num { color: var(--rust-dark); }

.admin-split { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; align-items: start; }

/* photo manager */
.photo-grid { display: flex; gap: .6rem; flex-wrap: wrap; margin: .6rem 0; }
.photo-cell { width: 110px; }
.photo-cell img { width: 110px; height: 82px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); display: block; }
.photo-cell .cell-actions { display: flex; gap: .3rem; margin-top: .3rem; }
.photo-cell .cell-actions button { flex: 1; font-size: .75rem; padding: .2rem .3rem; }

/* messaging */
.thread { display: flex; flex-direction: column; gap: .6rem; margin: 1rem 0; }
.bubble {
  max-width: 78%; padding: .65rem .9rem; border-radius: 12px; white-space: pre-wrap;
}
.bubble.guest { align-self: flex-start; background: #fff; border: 1px solid var(--line); }
.bubble.owner { align-self: flex-end; background: var(--sky); }
.bubble.system { align-self: center; background: var(--paper,#f6f4ef); border: 1px dashed var(--line); font-size: .85rem; text-align: center; }
.bubble .who { font-size: .75rem; font-weight: 700; color: var(--ink-soft); margin-bottom: .2rem; }

/* simulator */
.sim-banner { background: #2b3a4a; color: #ffe9a8; text-align: center; padding: .45rem; font-size: .85rem; font-weight: 700; letter-spacing: .04em; }

/* footer */
.site-foot {
  border-top: 1px solid var(--line); margin-top: 3rem; padding: 1.6rem 0 2.4rem;
  color: var(--ink-soft); font-size: .9rem; background: var(--card);
}
.foot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 1.4rem; }
.site-foot h3 { font-size: .95rem; margin-bottom: .5rem; }
.site-foot ul { list-style: none; margin: 0; padding: 0; }
.site-foot li { margin: .3rem 0; }
.foot-note { margin-top: 1.4rem; font-size: .82rem; }

/* ── small screens ──────────────────────────────────────────────────── */
@media (max-width: 820px) {
  .browse-layout { grid-template-columns: 1fr; }
  .filters { position: static; }
  .item-layout { grid-template-columns: 1fr; }
  .admin-split { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  html { font-size: 16px; }
  .hero h1 { font-size: 1.9rem; }
}
@media (max-width: 480px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
  .head-row { gap: .5rem; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
}

/* How-it-works strip — three honest steps under the hero */
.how-it-works {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem;
  list-style: none; counter-reset: step; margin: 1.4rem auto 0; padding: 0;
  max-width: 900px;
}
.how-it-works li {
  counter-increment: step; background: var(--paper);
  border: 1px solid var(--line, #ddd0bd); border-radius: 10px;
  padding: .7rem .9rem .7rem 3rem; position: relative; font-size: .95rem;
}
.how-it-works li::before {
  content: counter(step); position: absolute; left: .8rem; top: 50%;
  transform: translateY(-50%); width: 1.6rem; height: 1.6rem; border-radius: 50%;
  background: var(--fell, #2e5d3a); color: #fff; display: grid;
  place-items: center; font-weight: 700; font-size: .9rem;
}
.how-it-works strong { display: block; }
@media (max-width: 640px) {
  .how-it-works { grid-template-columns: 1fr; }
}

/* Quick Add sticky action bar + thumbs */
.qa-entry { display: grid; gap: .5rem; }
.qa-thumbs { display: flex; flex-wrap: wrap; gap: 4px; }
.qa-sticky {
  position: sticky; bottom: 56px; display: flex; gap: .5rem;
  padding: .5rem; background: var(--card,#fff); border-top: 1px solid var(--line,#ddd0bd);
  z-index: 40;
}
.qa-sticky .btn { flex: 1; min-height: 46px; }
@media (max-width: 820px) {
  .qa-sticky { bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }
}
.qa-ai-card { border: 1px solid var(--line, #ddd0bd); border-radius: 10px;
  background: var(--card, #fff); padding: .55rem .7rem; font-size: .88rem; }
.qa-ai-card p { margin: .15rem 0; }
.qa-ai-lead { font-size: 1rem; }
.qa-ai-certainty { font-size: .8rem; color: var(--ink-soft); }
.qa-ai-chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.qa-ai-chips .chip { cursor: pointer; font: inherit; background: var(--paper, #f6f4ef); }
.qa-ai-chips .chip.on { background: var(--fell, #2e5d3a); color: #fff;
  border-color: var(--fell, #2e5d3a); }
.qa-ai-chips .chip:disabled { opacity: .75; cursor: default; }

/* ── Split-view Messenger inbox ───────────────────────────────── */
.inbox { margin: .8rem 0 0; }
.inbox-tools { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .6rem; }
.inbox-tools input[name=q] { flex: 1; min-width: 10rem; }
.inbox-split {
  display: grid; grid-template-columns: minmax(200px, 300px) 1fr;
  border: 1px solid var(--line, #ddd0bd); border-radius: 12px; overflow: hidden;
  height: calc(100dvh - 210px); min-height: 420px; background: var(--card, #fff);
}
.conv-list { overflow-y: auto; border-right: 1px solid var(--line, #ddd0bd); background: var(--paper, #f6f4ef); }
.conv-row {
  display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line, #ddd0bd);
  background: none; padding: .55rem .7rem; cursor: pointer; font: inherit; color: inherit;
  min-height: 44px;
}
.conv-row.active { background: var(--card, #fff); box-shadow: inset 3px 0 0 var(--fell, #2e5d3a); }
.conv-top { display: flex; align-items: center; gap: .35rem; }
.conv-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-time { font-size: .72rem; color: var(--ink-soft); white-space: nowrap; }
.conv-badge { margin-left: auto; }
.conv-item { display: block; font-size: .8rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-prev { display: block; font-size: .78rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-pane { display: flex; flex-direction: column; min-width: 0; }
.inbox-empty { margin: auto; padding: 2rem; }
.conv-head {
  padding: .55rem .8rem; border-bottom: 1px solid var(--line, #ddd0bd);
  background: var(--card, #fff); position: sticky; top: 0; z-index: 5;
}
.conv-head-name { display: block; font-size: 1.05rem; }
.conv-head-item { display: block; font-weight: 600; color: var(--fell, #2e5d3a); }
.conv-head-meta { display: block; font-size: .78rem; color: var(--ink-soft); }
.conv-thread-wrap { flex: 1; overflow-y: auto; padding: .6rem; min-height: 0; }
.conv-composer { border-top: 1px solid var(--line, #ddd0bd); padding: .5rem .6rem; background: var(--card, #fff); }
.conv-composer textarea { width: 100%; }

/* ── Messenger v2: compact, app-like ─────────────────────────── */
.inbox { display: flex; flex-direction: column; margin: 0; min-width: 0; }
body.admin-body .inbox { height: calc(100dvh - 56px - 2 * var(--a-gap, 1.6rem)); }
body:not(.admin-body) .inbox { height: calc(100dvh - 150px); }
.inbox-title { font-size: 1.1rem; margin: 0; flex: 1; }
.inbox-tools { display: flex; gap: .45rem; align-items: center; flex-wrap: wrap; padding: .45rem 0; }
.inbox-chips { display: flex; gap: .3rem; flex-wrap: wrap; }
.chip { padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--line, #ddd0bd);
        font-size: .82rem; color: inherit; text-decoration: none; }
.chip.on { background: var(--fell, #2e5d3a); color: #fff; border-color: var(--fell, #2e5d3a); }
.inbox-search { display: flex; gap: .35rem; flex: 1 1 12rem; min-width: 0; }
.inbox-search input { flex: 1; min-width: 0; padding: .3rem .55rem; }
.inbox-tools .btn-sm { white-space: nowrap; }

.inbox-split {
  display: grid; grid-template-columns: minmax(200px, 300px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  flex: 1; min-height: 0; overflow: hidden;
  border: 1px solid var(--line, #ddd0bd); border-radius: 10px;
  background: var(--card, #fff);
}
.conv-list { overflow-y: auto; min-width: 0; border-right: 1px solid var(--line, #ddd0bd);
             background: var(--paper, #f6f4ef); }
.conv-row {
  display: block; width: 100%; text-align: left; border: 0;
  border-bottom: 1px solid var(--line, #ddd0bd);
  background: none; padding: .45rem .65rem; cursor: pointer;
  font: inherit; color: inherit; min-width: 0;
}
.conv-row.active { background: var(--card, #fff); box-shadow: inset 3px 0 0 var(--fell, #2e5d3a); }
.conv-top { display: flex; align-items: center; gap: .3rem; min-width: 0; }
.conv-name { flex: 1; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.conv-time { font-size: .68rem; color: var(--ink-soft); white-space: nowrap; }
.conv-badge { margin-left: auto; }
.conv-item, .conv-prev { display: block; font-size: .76rem; color: var(--ink-soft);
                         overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.conv-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.inbox-empty { margin: auto; padding: 2rem; }
.conv-view { display: flex; flex-direction: column; flex: 1; min-height: 0; min-width: 0; }
.conv-page { max-width: 720px; margin: 0 auto; }
.conv-page .conv-view { min-height: 60dvh; border: 1px solid var(--line, #ddd0bd);
                        border-radius: 10px; overflow: hidden; background: var(--card, #fff); }

.conv-head {
  display: flex; align-items: center; gap: .55rem; min-width: 0; flex-wrap: wrap;
  padding: .4rem .7rem; border-bottom: 1px solid var(--line, #ddd0bd);
  background: var(--card, #fff); position: sticky; top: 0; z-index: 5;
}
.conv-thumb { width: 34px; height: 34px; object-fit: cover; border-radius: 6px;
              border: 1px solid var(--line, #ddd0bd); flex: none; }
.conv-head-txt { flex: 1 1 10rem; min-width: 0; line-height: 1.3; }
.conv-head-name { display: inline; font-size: .95rem; }
.conv-head-item { display: inline; font-size: .85rem; color: var(--fell, #2e5d3a); font-weight: 600; }
.conv-head-item::before { content: " · "; color: var(--ink-soft); font-weight: 400; }
.conv-head-meta { display: block; font-size: .72rem; color: var(--ink-soft);
                  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-actions { display: flex; gap: .3rem; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.conv-actions form { display: inline; }

button.conv-back { display: none; flex: none; font-size: .85rem; }

/* composer: one slim row, label tucked away for screen readers */
.conv-composer { padding: .45rem .6rem; }
.conv-composer form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .45rem; }
.conv-composer .field { flex: 1; min-width: 0; margin: 0; }
.conv-composer .field label { position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.conv-composer textarea { width: 100%; min-height: 2.5rem; max-height: 7.5rem;
  resize: none; padding: .45rem .6rem; border-radius: 10px; }
.conv-composer .btn { flex: none; }
.conv-composer .chat-note { margin: .25rem 0 0; font-size: .76rem; flex-basis: 100%; }
.conv-thread-wrap { padding: .5rem .65rem; }

/* compact bubbles — size to content, meta below like Messenger */
.thread { display: flex; flex-direction: column; gap: .45rem; margin: 0; }
.msg { display: flex; flex-direction: column; max-width: min(78%, 34rem);
       width: fit-content; min-width: 0; }
.msg.owner { align-self: flex-end; align-items: flex-end; }
.msg.guest { align-self: flex-start; align-items: flex-start; }
.msg.system { align-self: center; align-items: stretch; max-width: 92%; }
.msg-meta { font-size: .62rem; color: var(--ink-soft); opacity: .85;
            padding: 0 .35rem; margin-top: .1rem; }
.bubble { width: fit-content; max-width: 100%; padding: .3rem .6rem;
          margin: 0; border-radius: 12px; font-size: .9rem; line-height: 1.35;
          white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.owner { border-bottom-right-radius: 4px; }
.bubble.guest { border-bottom-left-radius: 4px; }
.bubble.system { font-size: .8rem; padding: .3rem .6rem; border-radius: 9px;
                 text-align: left; }

/* small tablets: split view stays, but the bottom nav needs room */
@media (min-width: 701px) and (max-width: 820px) {
  .conv-actions { margin-left: auto; }
}

/* compact phones: full-width list ↔ chat switch */
@media (max-width: 700px) {
  body.admin-body .inbox { height: calc(100dvh - 56px - 1.8rem); }
  body:not(.admin-body) .inbox { height: calc(100dvh - 235px); padding-bottom: 0; }
  .inbox-split { grid-template-columns: minmax(0, 1fr); }
  body.inbox-chat-open .conv-list { display: none; }
  body.inbox-chat-open .conv-pane { display: flex; }
  body:not(.inbox-chat-open) .conv-pane { display: none; }
  body:not(.inbox-chat-open) .inbox-split { flex: none; height: auto;
           max-height: calc(100dvh - 56px - 1.8rem); }
  /* chat open on a phone: the tools bar would starve the pane — give the
     space to the conversation; Back returns to the list + tools */
  body.inbox-chat-open .inbox-tools { display: none; }
  body.inbox-chat-open button.conv-back { display: inline-block; font-size: .78rem; padding: .1rem .45rem; }
  /* compress the chat head on phones — it must not eat the thread */
  .conv-head { padding: .3rem .5rem; gap: .35rem; }
  .conv-thumb { width: 28px; height: 28px; }
  .conv-head-meta { font-size: .66rem; }
  .conv-actions .btn { font-size: .68rem; padding: .12rem .4rem; min-height: 0; }
  .conv-actions { gap: .2rem; }
  .conv-actions { margin-left: auto; }
  .conv-row { padding: .6rem .8rem; }
  .inbox-search { flex-basis: 100%; order: 9; }
  .bubble { max-width: 86%; }
  .conv-actions .btn { padding: .25rem .5rem; }
  .conv-head-meta { white-space: normal; overflow-wrap: anywhere; }
}

/* ── Phase 28: eBay link-out cards ── */
.ebay-band { border-top: 2px dashed var(--line, #ddd0bd); margin-top: 1.4rem; }
.ebay-chip { background: #eaf1fb; color: #1d4e89; border-color: #c5d9f0; }
.ebay-card .card-body { display: flex; flex-direction: column; }
.ebay-visit { margin-top: .5rem; align-self: flex-start; }
.ebay-card .card-title:hover { color: var(--fell, #2e5d3a); }
/* §71: one-tap alternative-identification picks on the review page —
   finger-sized (the plain .chip is a label, not a target). */
.chip.altpick { font: inherit; font-size: .9rem; cursor: pointer;
  padding: .45rem .8rem; border: 1px solid var(--line, #d8d2c4); }
