/* Tabled — mobile-first stylesheet.
 *
 * Palette is lifted from the logo: deep navy, warm cream, amber accent. Light
 * theme only, per the spec — a marketplace where photos are doing the selling
 * wants a neutral warm ground, not a dark one that shifts every box's colour.
 *
 * Layout rule throughout: single column, 640px cap, big tap targets. Anything
 * that grows past one column does so with auto-fill grid, never with a
 * breakpoint-per-view.
 */

:root {
  --navy:      #1c2260;
  --navy-700:  #2b3382;
  --navy-050:  #eceef7;
  --cream:     #faf7ec;
  --paper:     #ffffff;
  --amber:     #f5b301;
  --amber-dim: #fff4d1;
  --ink:       #171a2e;
  --muted:     #6a7089;
  --line:      #e6e2d5;
  --line-soft: #f0ede2;
  --good:      #1f7a4d;
  --good-bg:   #e6f4ec;
  --warn:      #8a5a00;
  --warn-bg:   #fff3d6;
  --bad:       #a32626;
  --bad-bg:    #fbe9e9;

  --r-sm: 8px;
  --r:    14px;
  --r-lg: 20px;
  --shadow: 0 1px 2px rgba(23, 26, 46, .06), 0 6px 20px rgba(23, 26, 46, .06);
  --tap: 44px;

  /* Content measures. "Desktop width" is not one number: a grid of cards wants
     the screen, a form wants a readable line length, and a chat wants something
     between. Mobile ignores all three -- everything is one column under
     1024px -- so these only take effect in the desktop block at the foot of
     this file. */
  --page-wide:   1200px;   /* feed, watchlist, profile, admin */
  --page-mid:     820px;   /* listing detail, thread, dashboard */
  --page-narrow:  640px;   /* every form */

  /* Height of the navy bar on desktop. The nav is pinned against this, so it
     has to be a known number rather than whatever the padding adds up to --
     guessing it is what makes stacked sticky headers drift apart on scroll. */
  --topbar-h: 3rem;
}

* { box-sizing: border-box; }

/* Any explicit `display` beats the [hidden] attribute's default display:none,
 * so every element this app toggles with .hidden needs this backstop. Without
 * it #boot and #gate keep their grid layout and stay on screen underneath the
 * app — visible, interactive, and extremely confusing. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

/* App shell: a full-height flex column so the sticky bottom nav is pushed to
   the screen bottom even on short views (e.g. an empty Requests tab). Without
   this, `position: sticky` only pins the nav once the page is tall enough to
   scroll, so a short page left it floating partway up. */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
/* The active view fills the space between the top bar and the nav. */
#view { flex: 1 0 auto; }

body.modal-open { overflow: hidden; }

a { color: var(--navy-700); }

h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.125rem; margin: 0 0 .5rem; letter-spacing: -.005em; }
h3 { font-size: 1rem; margin: 0; }
h4 { font-size: .875rem; margin: 0 0 .5rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* ---- Shell --------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1rem;
  padding-top: max(.75rem, env(safe-area-inset-top));
  background: var(--navy);
  color: var(--cream);
}
.topbar .brand {
  font-weight: 700;
  letter-spacing: .14em;
  font-size: .9rem;
}
.topbar .mark {
  width: 22px; height: 22px;
  border-radius: 5px;
  background: var(--cream);
  display: inline-grid;
  place-items: center;
  color: var(--navy);
  font-weight: 800;
  font-size: .8rem;
  flex: none;
}
.topbar .build-tag {
  margin-left: auto;
  font-size: .68rem;
  opacity: .5;
  font-variant-numeric: tabular-nums;
}

#env-banner {
  background: var(--amber-dim);
  color: var(--warn);
  font-size: .82rem;
  padding: .5rem 1rem;
  border-bottom: 1px solid #f0dfae;
}

#nav {
  position: sticky;
  bottom: 0;
  z-index: 40;
  display: flex;
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
#nav button {
  flex: 1;
  min-height: 56px;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: .78rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
}
#nav button .ico { font-size: 1.15rem; line-height: 1; }
#nav button.on { color: var(--navy); }

main {
  display: block;
  max-width: 640px;
  margin: 0 auto;
  /* Bottom padding clears the sticky nav bar. Without it the last line of a
   * long view sits underneath the tab bar while scrolling. */
  padding: 1rem 1rem calc(72px + env(safe-area-inset-bottom));
  min-height: 60vh;
}

/* ---- Boot & gate --------------------------------------------------------- */

#boot {
  min-height: 70vh;
  display: grid;
  place-items: center;
  padding: 2rem 1.5rem;
  text-align: center;
}

/* ---- Landing page (signed-out first visit) ------------------------------- */
#gate { display: block; }
.landing { color: var(--ink); }

.lp-hero {
  background: var(--navy);
  color: var(--cream);
  padding: 3rem 1.5rem 3.25rem;
  text-align: center;
}
.lp-hero-inner { max-width: 40rem; margin: 0 auto; }
.lp-brand { display: flex; align-items: center; justify-content: center; gap: .6rem; margin-bottom: 1.5rem; }
.lp-brand .logo {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--amber); color: var(--navy);
  display: grid; place-items: center; font-size: 1.4rem; font-weight: 800;
}
.lp-brandname { font-size: 1.4rem; font-weight: 800; letter-spacing: .02em; }
.lp-title { font-size: clamp(1.7rem, 6vw, 2.6rem); line-height: 1.12; margin: 0 0 .9rem; }
.lp-sub { color: #d7deea; font-size: 1.05rem; line-height: 1.5; margin: 0 auto 1.6rem; max-width: 34rem; }
.lp-cta { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }
.lp-btn { min-width: 12rem; }
.lp-hero .lp-btn.ghost { background: transparent; color: var(--cream); border-color: rgba(255,255,255,.4); }
.lp-hero .lp-btn.ghost:hover { border-color: var(--cream); }
.lp-fineline { color: #aeb8c9; font-size: .82rem; margin: 1.1rem 0 0; }

.lp-section { max-width: 46rem; margin: 0 auto; padding: 2.5rem 1.5rem; }
.lp-section.lp-alt { max-width: none; background: var(--paper); border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.lp-section.lp-alt > * { max-width: 46rem; margin-left: auto; margin-right: auto; }
.lp-h2 { font-size: 1.5rem; margin: 0 0 1.25rem; text-align: center; }

.lp-pitch p { font-size: 1.15rem; line-height: 1.55; text-align: center; color: var(--ink); margin: 0; }
.lp-pitch em { font-style: normal; font-weight: 700; color: var(--navy); }

.lp-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.1rem; }
.lp-steps li { display: flex; gap: 1rem; align-items: flex-start; }
.lp-step-n {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: var(--navy); color: var(--cream);
  display: grid; place-items: center; font-weight: 700;
}
.lp-steps strong { display: block; margin-bottom: .15rem; }
.lp-steps p { margin: 0; color: var(--muted); }

.lp-cards { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.lp-card {
  background: var(--cream); border: 1px solid var(--line); border-radius: var(--r);
  padding: 1.1rem 1.15rem;
}
.lp-section.lp-alt .lp-card { background: #fff; }
.lp-card h3 { font-size: 1.05rem; margin: 0 0 .35rem; color: var(--navy); }
.lp-card p { margin: 0; color: var(--muted); line-height: 1.45; }

.lp-trust { text-align: center; }
.lp-trust p { color: var(--muted); line-height: 1.55; margin: 0; }
.lp-trust strong { color: var(--ink); }

.lp-close { text-align: center; padding-bottom: 3rem; }
.lp-close .fine { max-width: 30rem; margin: .6rem auto 0; }
.lp-credit { margin-top: 1.4rem; }

@media (min-width: 620px) {
  .lp-cards { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) {
  .lp-cards { grid-template-columns: 1fr 1fr 1fr; }
}
.boot-error { max-width: 26rem; }

.spin {
  width: 18px; height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: .9rem;
  grid-column: 1 / -1;
}

/* ---- Buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: var(--tap);
  padding: 0 1.1rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--navy);
  color: var(--cream);
  font: inherit;
  font-weight: 600;
  font-size: .95rem;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
.btn:hover { background: var(--navy-700); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: var(--paper); color: var(--navy); border-color: var(--line); }
.btn.ghost:hover { background: var(--navy-050); }
.btn.danger { background: var(--bad); }
.btn.danger.ghost { background: var(--paper); color: var(--bad); border-color: #eccaca; }
.btn.wide { width: 100%; }
.btn.small { min-height: 36px; font-size: .85rem; padding: 0 .8rem; }

.icon-btn {
  min-width: var(--tap);
  min-height: var(--tap);
  border: 0;
  background: none;
  border-radius: 50%;
  font-size: 1.15rem;
  color: var(--muted);
  cursor: pointer;
  flex: none;
}
.icon-btn:hover { background: var(--navy-050); color: var(--ink); }
.icon-btn.danger:hover { background: var(--bad-bg); color: var(--bad); }

.linkish {
  border: 0; background: none; padding: 0;
  font: inherit; font-weight: 600;
  color: var(--navy-700); text-decoration: underline; cursor: pointer;
}

/* ---- Chips & pills ------------------------------------------------------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 36px;
  padding: 0 .75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: .85rem;
  cursor: pointer;
  text-align: left;
}
.chip:hover { border-color: var(--navy); }
.chip.on { background: var(--navy); color: var(--cream); border-color: var(--navy); }
.chip.static { cursor: default; background: var(--line-soft); border-color: transparent; }
.chip.static:hover { border-color: transparent; }
.chip.disabled, .chip:disabled { opacity: .4; cursor: not-allowed; }
.chip .x { opacity: .7; font-size: 1rem; }
.chip.clear-all { border-style: dashed; }

.chip-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip-row.tight { gap: .3rem; }

.pill {
  min-height: 38px;
  padding: 0 .85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  font: inherit;
  font-size: .875rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.pill.on { background: var(--navy); border-color: var(--navy); color: var(--cream); }
.pill .count {
  display: inline-grid;
  place-items: center;
  min-width: 18px; height: 18px;
  border-radius: 9px;
  background: var(--amber);
  color: var(--navy);
  font-size: .7rem;
  margin-left: .25rem;
}

.badge {
  display: inline-block;
  padding: .12rem .5rem;
  border-radius: 999px;
  background: var(--navy-050);
  color: var(--navy);
  font-size: .74rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge.deal     { background: var(--amber); color: var(--navy); }
.badge.verified { background: var(--good-bg); color: var(--good); }
.badge.sold     { background: var(--bad-bg); color: var(--bad); }
.badge.hold     { background: var(--warn-bg); color: var(--warn); }
.badge.cond     { background: var(--line-soft); color: var(--ink); }

/* ---- Feed ---------------------------------------------------------------- */

.feed-head { margin-bottom: 1rem; }

.searchbar { position: relative; margin-bottom: .75rem; }
.searchbar input {
  width: 100%;
  min-height: var(--tap);
  padding: 0 2.4rem 0 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  font: inherit;
  font-size: 1rem;
}
.searchbar input:focus { outline: 2px solid var(--navy); outline-offset: 1px; }
.clear-q {
  position: absolute;
  right: .35rem; top: 50%;
  transform: translateY(-50%);
  width: 34px; height: 34px;
  border: 0; border-radius: 50%;
  background: var(--line-soft);
  font-size: 1.1rem; line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.feed-tools {
  display: flex;
  align-items: center;
  gap: .4rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.feed-tools::-webkit-scrollbar { display: none; }
.sorts { display: flex; gap: .4rem; }
.filter-btn { margin-left: auto; flex: none; }

.active-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .6rem; }

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .85rem;
}
@media (min-width: 480px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

.card {
  display: block;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform .12s, box-shadow .12s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(23,26,46,.08), 0 12px 28px rgba(23,26,46,.1); }

.card-photo {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--navy-050) center/cover no-repeat;
}
.card-photo.noimg {
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, var(--navy-050), #dfe3f2);
}
.noimg-mark { font-size: 1.8rem; font-weight: 800; color: #9aa2c8; letter-spacing: .05em; }
.card-badges { position: absolute; left: .5rem; bottom: .5rem; display: flex; gap: .3rem; }

.card-body { padding: .7rem .8rem .85rem; }
.card-title {
  font-size: .98rem;
  font-weight: 650;
  margin: 0 0 .3rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-title .plus { color: var(--muted); font-weight: 500; }
.card-meta { display: flex; align-items: center; gap: .5rem; margin-bottom: .2rem; }
.price { font-weight: 700; font-variant-numeric: tabular-nums; }
.price.big { font-size: 1.15rem; }
.price .ask { font-weight: 600; color: var(--muted); }
.card-meta .cond {
  font-size: .74rem; font-weight: 700; color: var(--muted);
  background: var(--line-soft); border-radius: 4px; padding: .05rem .35rem;
}
.card-sub { font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .3rem; }
.dot { opacity: .5; }

.feed-foot { margin-top: 1.25rem; }

/* ---- Listing detail ------------------------------------------------------ */

.detail-head { display: flex; align-items: flex-start; gap: .5rem; margin-bottom: .75rem; }
.detail-head > div:first-child { flex: 1; min-width: 0; }
.detail-sub { color: var(--muted); font-size: .85rem; margin: 0; }
.ful-row { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: 1rem; }

.entries { display: grid; gap: 1rem; }
.entry {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: .9rem;
  box-shadow: var(--shadow);
}
.entry-head { display: flex; gap: .75rem; }
.entry-title { flex: 1; min-width: 0; }
.entry-title h2 { margin: 0 0 .35rem; }
.entry-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.entry-deal { margin-top: .4rem; }
.entry-notes { margin: .7rem 0 0; white-space: pre-wrap; }
.year { color: var(--muted); font-weight: 400; font-size: .9em; }

.boxart {
  width: 74px; height: 74px;
  object-fit: contain;
  background: var(--line-soft);
  border-radius: var(--r-sm);
  flex: none;
}
.boxart.sm { width: 48px; height: 48px; }

.shots { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .75rem; }
.shot {
  width: 84px; height: 84px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--line-soft) center/cover no-repeat;
  padding: 0;
  cursor: pointer;
  position: relative;
  flex: none;
}
.shot.add { display: grid; place-items: center; font-size: 1.6rem; color: var(--muted); border-style: dashed; cursor: pointer; }
.shot-x {
  position: absolute;
  top: -6px; right: -6px;
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--bad);
  font-size: 1rem; line-height: 1;
  cursor: pointer;
}
.lightbox { width: 100%; height: auto; border-radius: var(--r-sm); display: block; cursor: zoom-out; }

.seller-card {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: 1.25rem;
  padding: .8rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  text-decoration: none;
  color: inherit;
}
.seller-card > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.seller-card .chev { color: var(--muted); font-size: 1.4rem; }

.cta-bar { margin-top: 1.5rem; }
.owner-actions { display: flex; gap: .5rem; margin-top: 1.5rem; }

/* ---- Forms --------------------------------------------------------------- */

.form-page { display: grid; gap: 1.1rem; }

.field { display: block; }
.field > span:first-child {
  display: block;
  font-size: .85rem;
  font-weight: 650;
  margin-bottom: .3rem;
}
.field > span:first-child em { font-weight: 400; font-style: normal; color: var(--muted); }
.field input[type=text],
.field input[type=search],
.field input[type=number],
.field textarea,
.field select,
select {
  width: 100%;
  min-height: var(--tap);
  padding: .5rem .75rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--paper);
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
}
.field textarea { min-height: 72px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus, select:focus {
  outline: 2px solid var(--navy);
  outline-offset: 1px;
}
.fine { font-size: .8rem; color: var(--muted); margin: .35rem 0 0; }
.fine.pad { padding: .75rem; }
/* Post-save confirmation of the resolved area. Reads as an answer, not as
   more fine print, because it is the one field the user did not type. */
.area-result {
  color: var(--good);
  background: var(--good-bg);
  border-radius: .4rem;
  padding: .5rem .65rem;
  margin: .5rem 0 0;
}
.center { text-align: center; margin-top: 1rem; }

.row2 { display: grid; grid-template-columns: 1fr; gap: .75rem; }
@media (min-width: 460px) { .row2 { grid-template-columns: 1fr 1fr; } }

.block {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1rem;
}
.block > h2 { margin-bottom: .75rem; }

.entry-edit {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: .85rem;
  margin-bottom: .85rem;
  display: grid;
  gap: .8rem;
  background: var(--cream);
}
.entry-edit-head { display: flex; align-items: center; gap: .6rem; }
.grow { flex: 1; min-width: 0; }

.add-game { margin-top: .5rem; }
.bgg-results {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  margin-bottom: .6rem;
  background: var(--paper);
  max-height: 300px;
  overflow-y: auto;
}
.bgg-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  width: 100%;
  min-height: 46px;
  padding: .5rem .75rem;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.bgg-row:last-child { border-bottom: 0; }
.bgg-row:hover { background: var(--navy-050); }

.form-actions { display: flex; gap: .5rem; justify-content: flex-end; }
.form-actions .btn { flex: 1; }
@media (min-width: 460px) { .form-actions .btn { flex: none; } }

/* ---- Profile ------------------------------------------------------------- */

.profile { display: grid; gap: 1rem; }
.profile-head { display: flex; align-items: flex-start; gap: .85rem; }
.bio { margin: 0; white-space: pre-wrap; }

.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex: none;
  display: inline-grid;
  place-items: center;
  background: var(--navy-050);
  color: var(--navy);
  font-weight: 700;
  font-size: .85rem;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.lg { width: 48px; height: 48px; }
.avatar.xl { width: 68px; height: 68px; font-size: 1.3rem; }

.stat-row { display: flex; gap: .75rem; }
.stat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: .6rem .9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 90px;
}
.stat strong { font-size: 1.3rem; line-height: 1.1; }
.stat span { font-size: .78rem; color: var(--muted); }
.stat.wide { flex: 1; align-items: flex-start; justify-content: center; }
.stars { color: var(--amber); letter-spacing: .06em; }

.profile-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.profile-actions .btn { flex: 1; }

/* ---- Profile: section counts, sold, in-progress, promo ------------------- */
.block > h2 .count {
  font-weight: 600;
  color: var(--muted);
  font-size: .8rem;
}
.section-foot { margin-top: .75rem; display: flex; justify-content: center; }

/* A sold card is a record, not an offer: desaturate it and let the "Sold"
   badge and dimming carry the state. Still clickable through to the listing. */
.card.is-sold { opacity: .72; }
.card.is-sold .card-photo { filter: grayscale(.35); }
.card.is-sold:hover { opacity: .9; }

/* In-progress (seller's own mid-trade items) */
.progress-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.progress-row {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .55rem .7rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--ink);
  text-decoration: none;
}
.progress-row:hover { border-color: var(--navy-050); }
.progress-row .grow { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.progress-row strong { font-size: .95rem; }
.progress-thumb {
  width: 40px; height: 40px; flex: none;
  border-radius: var(--r-sm);
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; color: var(--muted);
}
.progress-thumb.noimg { background: var(--line-soft); }

/* Seller promotion banner (public profile + preview) */
.promo-banner {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  background: var(--amber-dim);
  border: 1px solid var(--amber);
  border-radius: var(--r);
  padding: .7rem .85rem;
  font-size: .9rem;
  line-height: 1.35;
}
.promo-mark {
  flex: none;
  background: var(--amber);
  color: var(--navy);
  font-weight: 800;
  font-size: .68rem;
  letter-spacing: .08em;
  padding: .18rem .4rem;
  border-radius: var(--r-sm);
  margin-top: .05rem;
}

/* Promo editor (settings) */
.promo-toggle { display: flex; align-items: center; gap: .5rem; margin: .25rem 0 .5rem; }
.promo-fields { display: grid; gap: .5rem; margin-bottom: .6rem; }
.promo-line { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; font-size: .9rem; }
.promo-line input[type="number"] { width: 4.5rem; }
.promo-preview { color: var(--good); font-style: italic; min-height: 1em; }

.blocked { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.blocked li { display: flex; align-items: center; gap: .6rem; }

/* ---- Dashboard ----------------------------------------------------------- */

.dash { display: grid; gap: 1rem; }
.count-pill {
  display: inline-grid; place-items: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px;
  background: var(--navy-050); color: var(--navy);
  font-size: .72rem; font-weight: 700;
  vertical-align: 2px;
}

.dash-row {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  padding: .7rem 0;
  border-top: 1px solid var(--line-soft);
  text-decoration: none;
  color: inherit;
}
.dash-row:first-of-type { border-top: 0; }
.dash-top { display: flex; align-items: baseline; gap: .5rem; }
.dash-top strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-sub { display: flex; align-items: center; gap: .4rem; margin: .1rem 0 .15rem; }
.dash-sub .who { font-size: .82rem; color: var(--muted); }
.dash-preview {
  font-size: .85rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-row.unread .dash-preview { color: var(--ink); font-weight: 550; }
.dot-unread {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--amber);
  flex: none;
  margin-top: .55rem;
}

.nav-badge {
  position: absolute;
  top: -4px; left: 52%;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--amber);
  color: var(--navy);
  font-size: .65rem;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
}
#nav button .ico { position: relative; }

/* ---- Thread -------------------------------------------------------------- */

/* The composer is pinned to the bottom of the viewport and the message list
 * scrolls between the header and it — so the thread behaves like a chat app
 * rather than like a long document with an input at the end.
 *
 * The height comes from JS (ThreadView.sizeThread) rather than a calc(), because
 * the chrome above it isn't a fixed size: the demo/env banner is conditional and
 * wraps to two lines on narrow screens, and a hardcoded calc() silently pushes
 * the composer off the bottom of the screen whenever it's showing. */
.thread {
  display: flex;
  flex-direction: column;
  height: var(--thread-h, 70vh);
  min-height: 20rem;
  margin: -1rem -1rem calc(-72px - env(safe-area-inset-bottom));
}

.thread-head {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem .9rem;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.thread-who { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 0; text-decoration: none; color: inherit; }
.thread-who > div { display: flex; flex-direction: column; min-width: 0; }
.thread-who .fine { margin: 0; }

.thread-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .9rem;
  background: var(--navy-050);
  text-decoration: none;
  color: inherit;
  font-size: .88rem;
}
.ti-photo {
  width: 34px; height: 34px;
  border-radius: 6px;
  background: var(--line-soft) center/cover no-repeat;
  flex: none;
}

.sched {
  padding: .7rem .9rem;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}
.sched-state { margin: 0; flex: 1; min-width: 12rem; font-size: .9rem; }
.sched .fine { flex-basis: 100%; margin: 0; }
.sched-actions { display: flex; gap: .4rem; }
.sched.queued    { background: var(--navy-050); border-bottom-color: #d7dcf0; }
.sched.proposed  { background: var(--warn-bg); border-bottom-color: #f0dfae; }
.hold-warn { color: var(--warn); font-weight: 600; }
.sched.confirmed { background: var(--good-bg); border-bottom-color: #cfe6d9; }
.sched.closed    { background: var(--line-soft); color: var(--muted); }
.cancel-req {
  display: block;
  width: 100%;
  padding: .4rem .9rem;
  text-align: left;
  font-size: .8rem;
  color: var(--muted);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: .9rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  overscroll-behavior: contain;
}

.day-sep {
  text-align: center;
  margin: .8rem 0 .4rem;
  font-size: .74rem;
  color: var(--muted);
}
.day-sep span { background: var(--line-soft); padding: .15rem .6rem; border-radius: 999px; }

.msg { max-width: 82%; align-self: flex-start; }
.msg.mine { align-self: flex-end; }
.bubble {
  padding: .5rem .75rem;
  border-radius: 16px 16px 16px 4px;
  background: var(--paper);
  border: 1px solid var(--line);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg.mine .bubble {
  background: var(--navy);
  color: var(--cream);
  border-color: var(--navy);
  border-radius: 16px 16px 4px 16px;
}
.msg.pending .bubble { opacity: .6; }
.msg-meta {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .7rem;
  color: var(--muted);
  padding: .1rem .3rem 0;
}
.msg.mine .msg-meta { justify-content: flex-end; }
.msg-report {
  border: 0; background: none; padding: 0 .2rem;
  color: var(--muted); cursor: pointer; font-size: .8rem;
  opacity: .45;
}
.msg-report:hover { opacity: 1; color: var(--bad); }

.composer {
  display: flex;
  align-items: flex-end;
  gap: .5rem;
  padding: .6rem .9rem;
  padding-bottom: max(.6rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.composer textarea {
  flex: 1;
  min-height: 42px;
  max-height: 140px;
  padding: .6rem .85rem;
  border: 1px solid var(--line);
  border-radius: 21px;
  background: var(--cream);
  font: inherit;
  font-size: 1rem;
  resize: none;
  overflow-y: auto;
}
.composer textarea:focus { outline: 2px solid var(--navy); outline-offset: 1px; }
.btn.send {
  width: 42px; min-height: 42px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.1rem;
  flex: none;
}

.entry-cta { margin-top: .85rem; }
.entry-cta .fine { margin: 0; }

/* ---- Availability editor (M6) -------------------------------------------- */

.avail { display: grid; gap: .4rem; margin-bottom: .75rem; }
.avail-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  padding: .45rem .6rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--cream);
}
.avail-row.on { background: var(--paper); border-color: var(--navy); }
.avail-day {
  display: flex;
  align-items: center;
  gap: .45rem;
  min-width: 5.5rem;
  font-weight: 650;
  font-size: .9rem;
  cursor: pointer;
}
.avail-day input { width: 20px; height: 20px; accent-color: var(--navy); }
.avail-times { display: flex; align-items: center; gap: .4rem; flex: 1; }
.avail-times input[type=time] {
  flex: 1;
  min-width: 6.5rem;
  min-height: 38px;
  padding: .3rem .5rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--paper);
  font: inherit;
  font-size: .95rem;
}
.avail-times .dash { color: var(--muted); font-size: .85rem; }

/* ---- Slot picker (M6) ---------------------------------------------------- */

.slot-day { margin-bottom: 1.1rem; }
.slot-day h4 { margin-bottom: .45rem; }
.chip.slot { min-height: 42px; font-variant-numeric: tabular-nums; }
.chip.slot:disabled { opacity: .5; }
.slot-alt { color: var(--muted); font-size: .78em; }
.chip.slot.on .slot-alt, .chip.slot:hover .slot-alt { color: inherit; opacity: .8; }

/* ---- Reviews (M7) -------------------------------------------------------- */

.review {
  padding: .7rem 0;
  border-top: 1px solid var(--line-soft);
}
.review:first-child { border-top: 0; }
.review-head { display: flex; align-items: center; gap: .6rem; }
.review-head > div { display: flex; flex-direction: column; min-width: 0; }
.review-head .fine { margin: 0; }
.review-body { margin: .5rem 0 0; white-space: pre-wrap; }

.review-prompt { border-color: var(--amber); background: var(--amber-dim); }
.review-prompt .dash-row { border-top-color: rgba(0,0,0,.08); align-items: center; }

/* Star rating input. Big targets — this is the last thing someone does after a
 * trade, on a phone, probably standing in a car park. */
.rate { display: flex; gap: .25rem; justify-content: center; margin-bottom: .25rem; }
.star {
  border: 0;
  background: none;
  font-size: 2.2rem;
  line-height: 1;
  padding: .2rem .3rem;
  color: var(--muted);
  cursor: pointer;
  transition: transform .1s;
}
.star.on { color: var(--amber); }
.star:active { transform: scale(.9); }
.rate-hint { text-align: center; min-height: 1.2em; margin-top: 0; font-weight: 600; }

/* ---- Events (M9) --------------------------------------------------------- */

.event-banner {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .8rem .9rem;
  margin: -1rem -1rem 1rem;
  background: var(--navy);
  color: var(--cream);
}
.event-banner h1 { margin: 0; font-size: 1.2rem; }
.event-banner .fine { color: rgba(250, 247, 236, .72); margin: 0; }
.event-banner .icon-btn { color: rgba(250, 247, 236, .8); }
.event-banner .icon-btn:hover { background: rgba(250, 247, 236, .15); color: var(--cream); }
.event-banner.over { background: var(--muted); }

.event-list { display: grid; gap: .4rem; }
.event-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  padding: .7rem .8rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--paper);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.event-row:hover { border-color: var(--navy); }
.event-row .grow { display: flex; flex-direction: column; min-width: 0; }
.event-row .fine { margin: 0; }

.event-pick { margin-top: .75rem; }
.event-chosen {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem .75rem;
  border: 1px solid var(--navy);
  border-radius: var(--r-sm);
  background: var(--navy-050);
}
.event-chosen .grow { display: flex; flex-direction: column; min-width: 0; }
.event-chosen .fine { margin: 0; }

.event-link {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem .8rem;
  margin-bottom: 1rem;
  border-radius: var(--r-sm);
  background: var(--navy-050);
  color: var(--navy);
  text-decoration: none;
  font-size: .9rem;
}
.event-link .chev { font-size: 1.2rem; }

/* ---- Trade proposals (M10) ----------------------------------------------- */

.pay-row { align-items: center; }
.pay-row .fine { margin: 0; }

.trade-pane { margin: .75rem 0; }
.event-row.picked { border-color: var(--navy); background: var(--navy-050); }

.trade-offer {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .9rem;
  background: var(--amber-dim);
  border-bottom: 1px solid #f0dfae;
}
.trade-offer .grow { display: flex; flex-direction: column; min-width: 0; }
.trade-offer .fine { margin: 0; }

.entry-cta { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.entry-cta .fine { flex-basis: 100%; margin: .2rem 0 0; }

/* ---- BGG attribution ----------------------------------------------------- */

/* Licence condition, not decoration: BGG require public-facing apps to show
   the mark, linking back, wherever their data appears. */
.bgg-attrib { margin: .6rem 0 0; font-size: .75rem; }
.bgg-attrib a {
  display: inline-block;
  padding: .15rem .5rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: .02em;
}
.bgg-attrib a:hover { color: var(--navy); border-color: var(--navy); }

/* "Powered by BGG" logo badge (BGG XML API terms require their mark, linked and
   legible, on public-facing use of their data). */
.bgg-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .2rem .5rem .2rem .45rem;
  border-radius: 5px;
  background: #182F44;              /* BGG's dark navy */
  text-decoration: none;
  line-height: 1;
  vertical-align: middle;
}
.bgg-badge-pre {
  color: #cfd8e2;
  font-size: .72rem;
  letter-spacing: .01em;
}
.bgg-badge-mark {
  color: #ff5100;                  /* BGG orange */
  font-weight: 800;
  font-size: .92rem;
  letter-spacing: .02em;
}
.bgg-badge:hover { filter: brightness(1.12); }

/* ---- Watch / watchlist --------------------------------------------------- */
.watch-row { display: flex; align-items: center; gap: .7rem; margin: .1rem 0 .4rem; }
.watch-btn.on { color: var(--navy); border-color: var(--navy); background: var(--navy-050); }
.watch-count { color: var(--muted); font-size: .85rem; }
.watch-count.solo { margin: .1rem 0 .5rem; }

/* ---- Lots (Phase 3) ------------------------------------------------------ */

.lot-field { border-top: 1px dashed var(--line); padding-top: .7rem; }
.lot-list { display: grid; gap: .35rem; margin-bottom: .5rem; }
.lot-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .6rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--paper);
}
.lot-item .grow { display: flex; flex-direction: column; min-width: 0; }
.lot-item .fine { margin: 0; }

.lot-contents {
  margin-top: .75rem;
  padding: .6rem .8rem;
  background: var(--amber-dim);
  border-radius: var(--r-sm);
}
.lot-contents ul { margin: .4rem 0 0; padding-left: 1.1rem; }
.lot-contents li { margin-bottom: .15rem; }
.lot-contents .fine { display: inline; margin: 0; }
.lot-contents > .fine { display: block; margin-top: .4rem; }

/* ---- Admin console ------------------------------------------------------- */

.admin { display: grid; gap: 1rem; }
.admin-head { display: flex; align-items: center; gap: .6rem; }
.admin-head h1 { margin: 0; }
.admin-tabs { overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.admin-tabs::-webkit-scrollbar { display: none; }

.report-group {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: .85rem;
  margin-bottom: .85rem;
  box-shadow: var(--shadow);
}
.rg-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
.rg-head .fine { margin: 0; }

.rg-preview { margin-bottom: .6rem; }
.rg-target {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .7rem;
  background: var(--navy-050);
  border-radius: var(--r-sm);
  text-decoration: none;
  color: inherit;
}
.rg-target .grow { display: flex; flex-direction: column; min-width: 0; }
.rg-target .fine { margin: 0; }
.rg-target .chev { color: var(--muted); font-size: 1.3rem; }

.rg-reasons { margin: 0 0 .7rem; padding-left: 1.1rem; font-size: .9rem; }
.rg-reasons li { margin-bottom: .25rem; }
.rg-reasons .fine { display: inline; margin: 0; }

.rg-actions { display: flex; flex-wrap: wrap; gap: .4rem; }

.admin-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .65rem 0;
  border-top: 1px solid var(--line-soft);
}
.admin-row:first-child { border-top: 0; }
.admin-row .grow { display: flex; flex-direction: column; min-width: 0; }
.admin-row .fine { margin: 0; }

.audit { display: grid; }
.audit-row {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .6rem 0;
  border-top: 1px solid var(--line-soft);
  font-size: .9rem;
}
.audit-row:first-child { border-top: 0; }
.audit-reason { color: var(--muted); font-size: .85rem; margin-top: .15rem; }
.audit-who { display: flex; flex-direction: column; align-items: flex-end; flex: none; }
.audit-who .fine { margin: 0; }

/* ---- Meeting toolkit & address exchange --------------------------------- */

.meet-toolkit { background: var(--navy-050); border-bottom-color: #d7dcf0; }
.meet-toolkit .fine { flex-basis: 100%; margin: 0 0 .4rem; }

.addr-waiting {
  flex-basis: 100%;
  margin-top: .5rem;
  padding: .6rem .7rem;
  background: var(--amber-dim);
  border-radius: var(--r-sm);
}
.addr-waiting .fine { margin: 0 0 .4rem; }

.addr-reveal {
  padding: 1rem;
  background: var(--cream);
  border: 2px solid var(--navy);
  border-radius: var(--r);
  text-align: center;
  margin-bottom: .75rem;
}
.addr-line { margin: 0; font-size: 1.15rem; font-weight: 650; white-space: pre-wrap; }

/* ---- Overflow menu ------------------------------------------------------- */

.overflow { position: relative; flex: none; }
.of-menu {
  position: absolute;
  right: 0; top: calc(100% + 4px);
  z-index: 30;
  min-width: 200px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.of-menu button {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0 .9rem;
  border: 0;
  background: none;
  font: inherit;
  font-size: .9rem;
  text-align: left;
  cursor: pointer;
}
.of-menu button:hover { background: var(--navy-050); }

/* ---- Modal --------------------------------------------------------------- */

.modal-wrap { position: fixed; inset: 0; z-index: 100; display: grid; place-items: end center; }
.modal-scrim { position: absolute; inset: 0; background: rgba(23, 26, 46, .45); }
.modal {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--cream);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: 0 -8px 40px rgba(23, 26, 46, .25);
  animation: sheet-up .18s ease-out;
}
@keyframes sheet-up { from { transform: translateY(18px); opacity: .6; } }
@media (min-width: 640px) {
  .modal-wrap { place-items: center; }
  .modal { border-radius: var(--r-lg); max-height: 84vh; }
}
.modal-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { flex: 1; margin: 0; font-size: 1.05rem; }
.modal-x {
  width: var(--tap); height: var(--tap);
  border: 0; background: none;
  font-size: 1.5rem; line-height: 1;
  color: var(--muted); cursor: pointer;
  border-radius: 50%;
}
.modal-body {
  padding: 1rem;
  overflow-y: auto;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}
.modal-msg { margin: 0 0 1rem; }
.modal-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1.25rem; }
.modal-actions .btn { flex: 1; }
.modal-actions.sticky {
  position: sticky;
  bottom: -1rem;
  background: var(--cream);
  padding: .75rem 0;
  margin-bottom: -.5rem;
  border-top: 1px solid var(--line);
}

/* ---- Plain-text export --------------------------------------------------
   The preview is a real <textarea>, not a <pre>. On iOS Safari the clipboard
   API rejects whenever the call drifts from the user's tap, and a textarea
   means the fallback is "it is already selected, copy it" instead of a dead
   button. Monospace so the seller can see the shape of what they are about to
   paste, even for the formats that will not be monospace at the far end. */
.export-formats { margin-bottom: .75rem; }
.export-hint { margin: 0 0 .5rem; }
.export-hint:empty { display: none; }

.export-preview {
  width: 100%;
  min-height: 14rem;
  max-height: 40vh;
  resize: vertical;
  padding: .6rem .7rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--paper);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .8rem;
  line-height: 1.5;
  /* Long game titles and URLs must wrap rather than force a horizontal
     scrollbar the seller has to hunt sideways in. */
  white-space: pre-wrap;
  word-break: break-word;
}

.export-count { margin: .4rem 0 0; }
.export-count.warn { color: var(--warn); font-weight: 600; }
.export-count.bad { color: var(--bad); font-weight: 600; }
.export-privacy { margin: .6rem 0 0; }

.filter-group { margin-bottom: 1.35rem; }
/* ---- Filter facets (include / exclude chips) ----------------------------- */
.filter-howto { margin: 0 0 1rem; }
.facet-search {
  width: 100%;
  margin: 0 0 .5rem;
  padding: .4rem .6rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font: inherit;
  font-size: .9rem;
}
.facet-chips { max-height: 190px; overflow-y: auto; padding: 2px; }
.fchip.inc { background: var(--navy); color: var(--cream); border-color: var(--navy); }
.fchip.exc { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
/* Active-filter chips in the feed head: excludes read as red "not X". */
.active-chips .chip.exc {
  background: var(--bad-bg); color: var(--bad); border-color: var(--bad);
}

/* ---- Safe-spot: precise-location controls -------------------------------- */
.ss-locbar { margin-bottom: .6rem; }
.ss-locbar .linkish { margin-left: .25rem; }
.ss-addr {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r); padding: .75rem; margin-bottom: .9rem;
}
.ss-addr input[type="text"] {
  width: 100%; padding: .5rem .6rem; border: 1px solid var(--line);
  border-radius: var(--r-sm); font: inherit; margin-bottom: .5rem;
}
.ss-addr-actions { display: flex; gap: .5rem; }
.ss-save { display: flex; align-items: center; gap: .4rem; margin: .6rem 0 .2rem; font-size: .85rem; }
.reason-chips { display: grid; gap: .45rem; }
.reason-chips .chip { min-height: 48px; padding: .5rem .9rem; }
.reason-other .field, .reason-other label { display: block; font-weight: 650; font-size: .85rem; margin-bottom: .3rem; }
.reason-other input {
  width: 100%; min-height: var(--tap);
  padding: .5rem .75rem;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  font: inherit; font-size: 1rem;
}

/* ---- Banners, empties, toast --------------------------------------------- */

.banner {
  padding: .7rem .9rem;
  border-radius: var(--r-sm);
  font-size: .88rem;
  margin-bottom: 1rem;
}
.banner.warn { background: var(--warn-bg); color: var(--warn); }

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
}
.empty h3 { color: var(--ink); margin-bottom: .35rem; }
.empty p { margin: 0; }

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(72px + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  z-index: 200;
  max-width: min(92vw, 30rem);
  padding: .7rem 1.1rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--cream);
  font-size: .9rem;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.warn { background: var(--warn); }
#toast.bad  { background: var(--bad); }

/* ---- Desktop (>= 1024px) --------------------------------------------------
 *
 * Everything above this line is the mobile app and is deliberately untouched.
 * The whole desktop layout lives in this one block, which is the same bargain
 * the rest of the file makes at the top: one shell-level breakpoint, not a
 * breakpoint per view.
 *
 * Two things change. The 640px cap becomes a three-step measure, so a card grid
 * can use the screen while a form keeps a readable line length. And the tab bar
 * stops being a tab bar -- a thumb rail pinned to the bottom of a monitor
 * nobody is holding -- and merges into the navy header instead.
 */
@media (min-width: 1024px) {

  /* The nav is lifted out of the bottom of the page and into the header
     WITHOUT moving it in the DOM: body is already a flex column, so `order`
     re-sequences it, and a negative margin equal to the bar height pulls it up
     into the same band as the brand. Keeping the element where it is means
     App.setNav() ('#nav [data-nav]') and the onboarding `navBar.hidden` toggle
     go on working untouched. */
  .topbar     { order: 0; height: var(--topbar-h); padding-block: 0; }
  #nav        { order: 1; }
  #env-banner { order: 2; }
  #boot, #gate { order: 3; }
  #view       { order: 4; }

  #nav {
    position: sticky;
    top: 0;
    z-index: 41;
    height: var(--topbar-h);
    margin-top: calc(-1 * var(--topbar-h));
    background: none;
    border-top: 0;
    padding-bottom: 0;
    justify-content: center;
    gap: .25rem;
    /* The bar spans the full width to centre its buttons, which would otherwise
       swallow clicks meant for the brand and the build-tag tooltip underneath. */
    pointer-events: none;
  }
  #nav button {
    pointer-events: auto;
    flex: none;
    flex-direction: row;
    gap: .45rem;
    min-height: 0;
    height: var(--topbar-h);
    padding: 0 1rem;
    font-size: .85rem;
    color: rgba(250, 247, 236, .7);
    box-shadow: inset 0 -2px 0 transparent;
  }
  #nav button .ico { font-size: 1rem; }
  #nav button:hover { color: var(--cream); }
  #nav button.on {
    color: var(--cream);
    box-shadow: inset 0 -2px 0 var(--amber);
  }

  /* Wide by default; the narrow views cap themselves below. The bottom padding
     was only ever there to clear the tab bar that no longer sits there.

     `width: 100%` is load-bearing and not decoration. body is a column flex
     container, and an `auto` cross-axis margin on a flex item suppresses the
     default `stretch` -- so `margin: 0 auto` alone leaves main shrink-wrapped to
     its content instead of filling to max-width. That is why the feed rendered
     as one ~380px column of cards on a 1440px screen rather than the two the
     640px cap should already have given: main was never 640 wide either. */
  main {
    width: 100%;
    max-width: var(--page-wide);
    padding: 1.5rem 1.5rem 3rem;
  }

  /* .form-page carries no max-width of its own -- it has always relied on
     main's 640px cap -- so without this every form stretches to 1200px. */
  .form-page { max-width: var(--page-narrow); }
  .detail,
  .dash      { max-width: var(--page-mid); }
  .form-page, .detail, .dash { margin-inline: auto; }

  /* A 1200px-wide search field looks like a mistake. The tools row is capped to
     match, so `.filter-btn`'s `margin-left: auto` parks Filters at the end of
     the sorts rather than marooning it 800px away at the far right. */
  .feed-head .searchbar,
  .feed-head .feed-tools { max-width: 32rem; }

  /* Three buttons sharing 1200px is not a button row, it's a banner. They only
     stretch (`flex: 1`) because on a phone they have to fill the width. */
  .profile-actions { max-width: var(--page-mid); }
  .profile-actions .btn { flex: 0 1 auto; min-width: 10rem; }

  /* 220px cards five-across read cramped once there's a mouse pointer. */
  .grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

  /* The chat bleeds to the viewport edges on mobile via negative margins. Once
     it is a centred column that bleed has nothing to bleed into, so it becomes
     a panel instead. */
  .thread {
    max-width: var(--page-mid);
    margin: 0 auto;
    border: 1px solid var(--line);
    border-radius: var(--r);
    overflow: hidden;
    background: var(--paper);
  }

  /* Was offset to clear the tab bar. */
  #toast { bottom: 1.5rem; }
}

/* Pointer-only affordances. Gated on (hover: hover) so a touch device never
   gets a lift stuck on the last card tapped. */
@media (hover: hover) {
  .card { transition: transform .12s ease-out, box-shadow .12s ease-out; }
  .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(23, 26, 46, .07), 0 12px 28px rgba(23, 26, 46, .10);
  }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
