/* ============================================================================
   3vade design system
   Light + dark themes on one token set. Brand ink #14161b (--ink), brand orange
   #f5821f (--brand).
   ========================================================================== */

:root {
  color-scheme: light;

  --brand: #f5821f;
  --brand-strong: #b05205;
  --brand-soft: #fff2e3;
  --brand-ring: rgba(245, 130, 31, 0.35);

  /*
   * What sits *on* a solid fill.
   *
   * A filled brand or state chip keeps its fill between themes, but not its
   * lightness: white on the brand orange is 2.4:1 (below AA at any size), and in
   * dark mode the state colours are light pastels, where white is worse still.
   * So the label flips instead of the fill: ink on orange is 7:1, and dark ink on
   * a light green or red reads the same way it looks. Same reasoning as the
   * placeholder tiles below.
   */
  --on-brand: #14161b;
  --on-ok: #ffffff;
  --on-warn: #14161b;
  --on-danger: #ffffff;
  /* The brand, one step darker, for the one place a *fill* darkens on hover. It
     cannot be --brand-strong: that now has to stay light enough for orange text,
     which makes ink-on-orange unreadable. */
  --brand-hover: #e0761c;

  /*
   * Generated placeholder marks (a product or store with no image). The hue is
   * per-mark and inline; the rest is the theme's, so a pastel on white becomes a
   * deep tint on black rather than a bright tile with washed-out initials.
   */
  --tile-sat: 78%;
  --tile-l-1: 93%;
  --tile-l-2: 82%;

  --ink: #14161b;
  --ink-2: #3b414d;
  /*
   * Secondary text and the brand/secondary state inks were each a shade too light
   * to clear AA once they sat on a tinted panel rather than white — muted came out
   * at 4.31:1 on --bg, brand-strong at 3.15:1 on --brand-soft, and the two state
   * inks just under 4.5:1 on their own soft fills. These are the same colours, one
   * step darker, so nothing about the palette changes except that it can be read.
   */
  --muted: #5f6675;
  --line: #e7e9ee;
  --line-strong: #d6dae2;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --surface-3: #eef0f4;
  --bg: #f4f5f8;

  --ok: #0b7a42;
  --ok-soft: #e6f6ec;
  --warn: #8f5306;
  --warn-soft: #fdf3e3;
  --danger: #c23636;
  --danger-soft: #fdecec;
  --info: #1a4bb3;
  --info-soft: #eaf0fe;

  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  --shadow-1: 0 1px 2px rgba(16, 20, 30, 0.06);
  --shadow-2: 0 2px 4px rgba(16, 20, 30, 0.05), 0 10px 26px rgba(16, 20, 30, 0.07);
  --shadow-3: 0 18px 48px rgba(16, 20, 30, 0.14);
  --glass: rgba(255, 255, 255, 0.82);

  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --step-0: 0.9375rem;
  --step--1: 0.8125rem;
  --step-1: 1.0625rem;
  --step-2: 1.375rem;
  --step-3: 1.9rem;
  --step-4: 2.4rem;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 220ms;
}

[data-theme="dark"] {
  color-scheme: dark;

  --brand-soft: #2a1c0d;
  /* Lighter, so brand text on the dark brand tint stays legible — #d96b0c on a
     near-black surface is 3.4:1, this is 8:1. */
  --brand-strong: #ff9d4d;
  --brand-hover: #ff9d4d;
  --on-ok: #0d0f13;
  --on-warn: #0d0f13;
  --on-danger: #0d0f13;
  --tile-sat: 34%;
  --tile-l-1: 24%;
  --tile-l-2: 17%;
  --ink: #f2f4f8;
  --ink-2: #c7ccd6;
  --muted: #8f96a3;
  --line: #262a33;
  --line-strong: #333844;
  --surface: #14161c;
  --surface-2: #1a1d24;
  --surface-3: #21252e;
  --bg: #0d0f13;

  --ok: #4ade80;
  --ok-soft: #10261a;
  --warn: #fbbf24;
  --warn-soft: #2a2110;
  --danger: #f87171;
  --danger-soft: #2b1516;
  --info: #7aa2ff;
  --info-soft: #131c33;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.45);
  --shadow-3: 0 20px 56px rgba(0, 0, 0, 0.6);
  --glass: rgba(20, 22, 28, 0.78);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

h1, h2, h3, h4 { margin: 0 0 0.4em; line-height: 1.15; letter-spacing: -0.02em; font-weight: 700; }
h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p { margin: 0 0 0.8em; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/*
 * Icons are 24x24 line drawings that sit in running text. Without a base size
 * an icon dropped into an unsized container stretches to fill it, so give every
 * icon a text-sized default; the context rules below override it where a
 * deliberate size is wanted.
 */
svg { width: 1.05em; height: 1.05em; flex-shrink: 0; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

::selection { background: var(--brand-ring); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------------------------ top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.7rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand { flex-shrink: 0; display: flex; align-items: center; }
.brand img { height: 40px; width: auto; }

.search { position: relative; flex: 1; max-width: 620px; }
.search__row { display: flex; gap: 0.5rem; }
.search input {
  flex: 1;
  min-width: 0;
  padding: 0.62rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: var(--step-0);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.search input::placeholder { color: var(--muted); }
.search input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-ring);
}

.suggestions {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-3);
  overflow: hidden;
  z-index: 50;
}
.suggestions[hidden] { display: none; }
.suggestions a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--line);
  transition: background var(--dur) var(--ease);
}
.suggestions a:last-child { border-bottom: none; }
.suggestions a:hover, .suggestions a[data-active="1"] { background: var(--surface-2); }
.suggestions img, .suggestions .suggestions__tile {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-xs);
  object-fit: cover;
  flex-shrink: 0;
}
.suggestions__tile {
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--surface-3);
}
.suggestions__meta { min-width: 0; }
.suggestions__title { font-weight: 600; font-size: var(--step-0); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggestions__sub { color: var(--muted); font-size: var(--step--1); }

.nav { display: flex; align-items: center; gap: 0.15rem; margin-left: auto; }
.nav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.48rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav__link:hover { background: var(--surface-3); color: var(--ink); }
.nav__link--accent { color: var(--brand-strong); }
[data-theme="dark"] .nav__link--accent { color: var(--brand); }
.nav__count {
  min-width: 1.15rem;
  padding: 0 0.3rem;
  border-radius: var(--radius-pill);
  background: var(--brand);
  color: var(--on-brand);
  font-size: 0.7rem;
  font-weight: 800;
  text-align: center;
  line-height: 1.15rem;
}
.nav__avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--surface);
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
}
.topbar__tools { display: flex; align-items: center; gap: 0.35rem; }
.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }

.currency-select {
  padding: 0.42rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--step--1);
  font-weight: 600;
  cursor: pointer;
}

.menu-btn { display: none; }
.drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
}
.drawer[data-open="1"] { display: block; }
.drawer__scrim {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 14, 0.5);
  backdrop-filter: blur(2px);
  animation: fade-in 180ms var(--ease);
}
.drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 86vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-3);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  animation: slide-in 220ms var(--ease);
  overflow-y: auto;
}
.drawer__panel a {
  padding: 0.7rem 0.6rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}
.drawer__panel a:last-of-type { border-bottom: none; }
.drawer__panel a:hover { background: var(--surface-2); }

/* --------------------------------------------------------------------- layout */

.app {
  flex: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 4rem;
}
.section { margin-bottom: 2.25rem; }
.section__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.muted { color: var(--muted); font-size: var(--step--1); }
.row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.row--between { justify-content: space-between; }
.spacer { flex: 1; }
.crumbs { font-size: var(--step--1); color: var(--muted); margin-bottom: 0.9rem; }
.crumbs a:hover { color: var(--brand-strong); }

@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in { from { transform: translateX(100%); } to { transform: none; } }
.page-enter { animation: fade-up 320ms var(--ease); }

/* ---------------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  box-shadow: var(--shadow-1);
}
.card--flat { box-shadow: none; }
.card--pad0 { padding: 0; overflow: hidden; }
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.grid { display: grid; gap: 1.1rem; }
.grid--products { grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid--two { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.grid--three { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
@media (max-width: 880px) { .grid--two { grid-template-columns: 1fr; } }

/* ----------------------------------------------------------------------- hero */

.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  margin-bottom: 2.25rem;
  background:
    radial-gradient(1100px 380px at 12% -10%, var(--brand-soft), transparent 62%),
    radial-gradient(700px 300px at 100% 0%, var(--surface-3), transparent 60%),
    var(--surface);
  display: flex;
  align-items: center;
  gap: 2.25rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow-1);
}
.hero__brand { flex-shrink: 0; }
.hero__brand img { height: 104px; width: auto; }
.hero__text { flex: 1; min-width: 280px; }
.hero h1 { font-size: var(--step-4); margin-bottom: 0.5rem; }
.hero p { color: var(--ink-2); max-width: 52ch; font-size: var(--step-1); }
.hero__points { display: flex; gap: 1.15rem; flex-wrap: wrap; font-size: var(--step--1); color: var(--ink-2); }
.hero__points span { display: inline-flex; align-items: center; gap: 0.4rem; }
.hero__points svg { width: 15px; height: 15px; color: var(--ok); }
.hero__cta { display: flex; gap: 0.6rem; margin-top: 1.25rem; flex-wrap: wrap; }

/* -------------------------------------------------------------- product cards */

.product {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.product:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-2);
  border-color: var(--line-strong);
}
.product__media {
  position: relative;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  overflow: hidden;
}
.product__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 420ms var(--ease); }
.product:hover .product__media img { transform: scale(1.045); }
.product__tile { font-size: 2rem; font-weight: 800; letter-spacing: 0.02em; color: rgba(20, 22, 28, 0.28); }
[data-theme="dark"] .product__tile { color: rgba(255, 255, 255, 0.34); }
.product__badges { position: absolute; top: 0.55rem; left: 0.55rem; display: flex; gap: 0.3rem; flex-wrap: wrap; z-index: 2; }
.chip-off {
  background: var(--brand);
  color: var(--on-brand);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-xs);
}
.chip-ghost {
  background: var(--glass);
  backdrop-filter: blur(6px);
  color: var(--ink);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line);
}
.product__body { padding: 0.85rem 0.95rem 1rem; display: flex; flex-direction: column; gap: 0.3rem; flex: 1; }
.product__title { font-weight: 650; font-size: var(--step-0); line-height: 1.35; }
.product__title:hover { color: var(--brand-strong); }
.product__store { font-size: var(--step--1); color: var(--muted); display: inline-flex; align-items: center; gap: 0.35rem; }
.product__store:hover { color: var(--brand-strong); }
.product__price { font-weight: 750; font-size: var(--step-1); margin-top: auto; display: flex; align-items: baseline; gap: 0.4rem; }
.product__compare { color: var(--muted); text-decoration: line-through; font-size: var(--step--1); font-weight: 500; }
.product__listing { font-size: 0.72rem; color: var(--muted); }
.product__actions { padding: 0 0.95rem 0.95rem; }
/*
 * A rating, drawn as five stars rather than set as ★ / ☆ characters.
 *
 * The SVGs are inline-flex siblings of the text beside them, so they sit on the
 * same optical line as the number instead of on the text baseline where the
 * glyphs used to land. `1em` sizing means the row scales with whatever type it
 * is dropped into — a product card, a store header, a partner row.
 */
.stars {
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  gap: 0.08em;
  vertical-align: -0.12em;
}
.stars svg { width: 1em; height: 1em; flex: none; }

/* -------------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--step-0);
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform 90ms var(--ease), box-shadow var(--dur) var(--ease);
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; }
.btn--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
  box-shadow: 0 1px 2px rgba(245, 130, 31, 0.35);
}
.btn--primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn--ink { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.btn--ink:hover { opacity: 0.9; background: var(--ink); }
.btn--ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn--danger { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.btn--sm { padding: 0.38rem 0.66rem; font-size: var(--step--1); border-radius: var(--radius-xs); }
.btn--lg { padding: 0.78rem 1.35rem; font-size: var(--step-1); border-radius: var(--radius-md); }
.btn--block { width: 100%; }

/* ---------------------------------------------------------------------- forms */

.field { display: flex; flex-direction: column; gap: 0.32rem; margin-bottom: 0.9rem; }
.field label { font-size: var(--step--1); font-weight: 650; color: var(--ink-2); }
.field input, .field select, .field textarea {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--step-0);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-ring);
}
.field .hint { font-size: 0.76rem; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 0.9rem; }
.inline-form { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.inline-form input {
  padding: 0.42rem 0.6rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--step--1);
}

.switch { display: inline-flex; align-items: center; gap: 0.6rem; cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
  width: 48px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  position: relative;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.switch__track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  transition: transform var(--dur) var(--ease);
}
.switch input:checked + .switch__track { background: var(--brand); border-color: var(--brand); }
.switch input:checked + .switch__track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 4px var(--brand-ring); }

/* --------------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
th, td { text-align: left; padding: 0.7rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
  background: var(--surface-2);
  position: sticky;
  top: 0;
}
tbody tr { transition: background var(--dur) var(--ease); }
tbody tr:hover { background: var(--surface-2); }
tr:last-child td { border-bottom: none; }

/* --------------------------------------------------------------------- badges */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.16rem 0.5rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: capitalize;
  background: var(--surface-3);
  color: var(--ink-2);
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge--paid, .badge--active, .badge--delivered, .badge--available, .badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--processing, .badge--info { background: var(--info-soft); color: var(--info); }
/* Seller application states: submitted is in the queue (info), changes_requested
   is back with the seller (warn), and the two decisions are final. */
.badge--submitted { background: var(--info-soft); color: var(--info); }
.badge--changes-requested { background: var(--warn-soft); color: var(--warn); }
.badge--approved, .badge--accepted { background: var(--ok-soft); color: var(--ok); }
.badge--rejected { background: var(--danger-soft); color: var(--danger); }
.badge--shipped, .badge--pending, .badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--cancelled, .badge--suspended, .badge--archived, .badge--failed, .badge--danger { background: var(--danger-soft); color: var(--danger); }
/* Ops team and payments (see the Team and Payments tabs): the states that had no
   colour of their own. A revoked invitation and an expired one are both quiet
   endings, so they are muted rather than alarming, while a paid checkout that
   could not become an order is the one thing on the page that must shout. */
.badge--removed, .badge--revoked, .badge--expired, .badge--ignored { background: var(--surface-3); color: var(--muted); }
.badge--settled, .badge--received { background: var(--ok-soft); color: var(--ok); }
.badge--duplicate { background: var(--info-soft); color: var(--info); }
.badge--unplaced, .badge--mismatch { background: var(--danger-soft); color: var(--danger); }
.badge--draft { background: var(--surface-3); color: var(--muted); }

.escrow-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.55rem;
  border-radius: var(--radius-pill);
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 0.72rem;
  font-weight: 700;
}
.escrow-chip svg { width: 13px; height: 13px; }
.escrow-chip--off { background: var(--warn-soft); color: var(--warn); }

/* ------------------------------------------------------------- stats / KPIs */

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-1);
}
.stat__label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}
.stat__value { font-size: var(--step-2); font-weight: 750; margin-top: 0.25rem; letter-spacing: -0.02em; }
.stat__hint { font-size: 0.76rem; color: var(--muted); margin-top: 0.15rem; }
.stat--accent { border-color: var(--brand); background: linear-gradient(180deg, var(--brand-soft), var(--surface) 70%); }

/* ------------------------------------------------------------------ timeline */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 1.15rem 1.6rem; border-left: 2px solid var(--line); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--brand);
}
.timeline li:last-child::before { background: var(--brand); }
.timeline__status { font-weight: 700; text-transform: capitalize; font-size: var(--step-0); }
.timeline__meta { font-size: 0.78rem; color: var(--muted); }

/* ------------------------------------------------------------------ skeletons */

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--glass), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
.skeleton--card { height: 320px; border-radius: var(--radius-lg); }
.skeleton--line { height: 12px; margin-bottom: 0.5rem; }
.skeleton--stat { height: 96px; border-radius: var(--radius-lg); }

/* --------------------------------------------------------------------- toasts */

.toasts {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 80;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--ink);
  color: var(--bg);
  padding: 0.7rem 0.95rem;
  border-radius: var(--radius-md);
  font-size: var(--step--1);
  font-weight: 600;
  max-width: 360px;
  box-shadow: var(--shadow-3);
  animation: fade-up 220ms var(--ease);
  pointer-events: auto;
}
.toast svg { width: 17px; height: 17px; flex-shrink: 0; }
.toast--error { background: var(--danger); color: var(--on-danger); }
.toast--success { background: var(--ok); color: var(--on-ok); }
/* On a dark surface an inverted toast is a white slab; a raised dark panel with a
   brand-tinted edge reads as the same transient layer. */
[data-theme="dark"] .toast {
  background: var(--surface-3);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}

/* ------------------------------------------------------------------ misc bits */

.empty {
  text-align: center;
  padding: 3rem 1.25rem;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
/* Only the empty state's own icon is large — an action button inside it keeps
   its button-sized icon. */
.empty > svg { width: 34px; height: 34px; color: var(--muted); margin-bottom: 0.6rem; }
.empty h3 { color: var(--ink); }
.notice { padding: 0.75rem 0.95rem; border-radius: var(--radius-sm); font-size: var(--step--1); background: var(--warn-soft); color: var(--warn); font-weight: 550; }
.notice--error { background: var(--danger-soft); color: var(--danger); }
.notice--ok { background: var(--ok-soft); color: var(--ok); }
.notice--info { background: var(--info-soft); color: var(--info); }
.divider { height: 1px; background: var(--line); margin: 1rem 0; }
.list-reset { list-style: none; margin: 0; padding: 0; }
.mono { font-family: var(--mono); font-size: 0.85em; }
.tag-line { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.cat-chip {
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--step--1);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.cat-chip:hover { border-color: var(--brand); color: var(--brand-strong); transform: translateY(-1px); }
.cat-chip--on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.cat-chip--on:hover { color: var(--surface); }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  background: var(--brand-soft);
  color: var(--brand-strong);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: auto; }
.footer__inner { max-width: 1280px; margin: 0 auto; padding: 1.75rem 1.25rem; }
.footer__logo { height: 34px; width: auto; opacity: 0.92; }
.footer__note { margin-top: 0.6rem; color: var(--ink-2); font-size: var(--step--1); }
.footer__meta { color: var(--muted); font-size: 0.78rem; margin: 0; }
.footer__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.25rem; margin-top: 1.25rem; }
.footer h4 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.footer ul { list-style: none; margin: 0; padding: 0; font-size: var(--step--1); }
.footer li { padding: 0.15rem 0; color: var(--ink-2); }

.sticky-buy {
  position: sticky;
  bottom: 1rem;
  z-index: 10;
  display: flex;
  gap: 0.6rem;
  align-items: center;
  padding: 0.75rem;
  border-radius: var(--radius-lg);
  background: var(--glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
}

.price-block { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.price-block__amount { font-size: var(--step-3); font-weight: 750; letter-spacing: -0.02em; }

.trust-list { display: grid; gap: 0.5rem; font-size: var(--step--1); color: var(--ink-2); }
.trust-list li { display: flex; gap: 0.5rem; align-items: flex-start; }
.trust-list svg { width: 15px; height: 15px; color: var(--ok); margin-top: 0.25rem; flex-shrink: 0; }

.kv { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.3rem 0; font-size: var(--step--1); }
.kv span:first-child { color: var(--muted); }
.kv--total { font-weight: 750; font-size: var(--step-0); }

/* --------------------------------------------------------------- responsive */

/* ------------------------------------------------- trade terms & seller profile */

.chip-trade {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  background: var(--ink);
  color: var(--surface);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.01em;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-pill);
}
.chip-trade svg { width: 12px; height: 12px; }
.chip-trade--soft { background: var(--ink-2); }
.chip-trade--alt { background: var(--info-soft); color: var(--info); }

.product__trade { font-size: 0.72rem; color: var(--muted); }
.badge--quote { background: var(--info-soft); color: var(--info); }
.badge--customization { background: var(--brand-soft); color: var(--brand-strong); }

.verified-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  background: var(--info-soft);
  color: var(--info);
  font-size: 0.72rem;
  font-weight: 750;
  padding: 0.24rem 0.55rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.verified-chip svg { width: 14px; height: 14px; }

.store-hero { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.5rem; align-items: start; }
.store-hero__main { display: flex; gap: 1.1rem; align-items: flex-start; }
.store-hero__mark {
  width: 84px;
  height: 84px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.35rem;
  color: rgba(20, 22, 28, 0.42);
  border: 1px solid var(--line);
}
[data-theme="dark"] .store-hero__mark { color: rgba(255, 255, 255, 0.5); }
.store-hero__aside { border-left: 1px solid var(--line); padding-left: 1.4rem; }

.store-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.95rem;
  margin-top: 0.7rem;
  font-size: var(--step--1);
  color: var(--ink-2);
}
.store-facts span { display: inline-flex; align-items: center; gap: 0.35rem; }
.store-facts svg { width: 15px; height: 15px; color: var(--muted); }

.contact-list { display: grid; gap: 0.55rem; font-size: var(--step--1); }
.contact-list li { display: flex; gap: 0.55rem; align-items: flex-start; }
.contact-list li > svg { width: 16px; height: 16px; color: var(--brand); margin-top: 0.15rem; flex-shrink: 0; }
.contact-list a { color: var(--ink); font-weight: 600; word-break: break-word; }
.contact-list a:hover { color: var(--brand-strong); }

.trade-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-top: 1.1rem;
}
.trade-summary__item { display: flex; flex-direction: column; gap: 0.15rem; }
.trade-summary__item strong { font-size: var(--step-2); line-height: 1.1; }

.trade-list { display: grid; gap: 0.45rem; font-size: var(--step--1); color: var(--ink-2); margin: 0.2rem 0 0; }
.trade-list li { display: flex; gap: 0.5rem; align-items: flex-start; }
.trade-list svg { width: 15px; height: 15px; color: var(--brand); margin-top: 0.22rem; flex-shrink: 0; }

.inquiry { margin-top: 0.2rem; }
.inquiry .field { margin-bottom: 0.7rem; }

@media (max-width: 900px) {
  .store-hero { grid-template-columns: 1fr; }
  .store-hero__aside { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; padding-top: 1.1rem; }
}

@media (max-width: 1080px) {
  .search { max-width: 380px; }
}
@media (max-width: 900px) {
  .nav { display: none; }
  .menu-btn { display: grid; }
  .topbar__inner { gap: 0.6rem; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .hero { padding: 1.75rem; }
  .hero__brand img { height: 76px; }
  .hero h1 { font-size: var(--step-3); }
}
@media (max-width: 560px) {
  .app { padding: 1.25rem 0.9rem 3rem; }
  .grid--products { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 0.75rem; }
  .product__tile { font-size: 1.5rem; }
  .toasts { left: 0.75rem; right: 0.75rem; }
  .toast { max-width: none; }
  .currency-select { max-width: 88px; }
}

/* ============================================================================
   Landing page, in-app chat and the delivery partner programme.
   Appended in one block so the shell styles above stay untouched.
   ========================================================================== */

/* ------------------------------------------------------------------- pills */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.7rem;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: var(--step--1);
  font-weight: 650;
  border: 1px solid var(--line);
}
.pill svg { width: 14px; height: 14px; }
.pill--brand { background: var(--brand-soft); color: var(--brand-strong); border-color: transparent; }
.pill--ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }

.verified-mini { color: var(--brand); display: inline-flex; }
.verified-mini svg { width: 16px; height: 16px; }

.check-line {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: var(--step--1);
  color: var(--ink-2);
  margin: 0.35rem 0;
  cursor: pointer;
}

.form-grid--three { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.grid--four { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.grid--stores { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }

/* -------------------------------------------------------------- hero (landing) */

.hero--landing {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 1.75rem;
  align-items: center;
  padding: 2.4rem;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 120% at 0% 0%, var(--brand-soft) 0%, transparent 55%),
    linear-gradient(160deg, var(--surface) 0%, var(--surface-2) 100%);
  box-shadow: var(--shadow-2);
}
.hero--partners {
  background:
    radial-gradient(120% 120% at 100% 0%, var(--info-soft) 0%, transparent 55%),
    linear-gradient(160deg, var(--surface) 0%, var(--surface-2) 100%);
}
.hero--landing h1 { font-size: clamp(1.9rem, 3.4vw, 2.75rem); margin-bottom: 0.5rem; }
.hero--landing .hero__text p { font-size: var(--step-1); color: var(--ink-2); max-width: 46ch; }

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--brand-strong);
  margin-bottom: 0.75rem;
}
.hero__eyebrow svg { width: 16px; height: 16px; }

.hero__panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  box-shadow: var(--shadow-2);
}
.hero__panel-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.9rem; }
.hero__panel-head img { height: 34px; width: auto; }
.hero__panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.hero__panel-foot {
  margin-top: 0.9rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
  font-size: var(--step--1);
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.hero__panel-foot svg { width: 15px; height: 15px; }

.stat-tile {
  padding: 0.7rem 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.stat-tile__value { font-size: var(--step-2); font-weight: 750; letter-spacing: -0.02em; line-height: 1.1; }
.stat-tile__label { font-size: var(--step--1); color: var(--muted); }
.stat-tile__hint { font-size: 0.75rem; color: var(--muted); margin-top: 0.15rem; }

/* ------------------------------------------------------------- steps & bands */

.step-card {
  position: relative;
  padding: 1.15rem;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
}
.step-card h3 { display: flex; align-items: center; gap: 0.45rem; font-size: var(--step-1); }
.step-card h3 svg { width: 17px; height: 17px; color: var(--brand); }
.step-card p { margin: 0; font-size: var(--step--1); }
.step-card__index {
  position: absolute;
  top: -0.65rem;
  right: 0.9rem;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--on-brand);
  font-size: 0.78rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-1);
}

.band {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: center;
  padding: 2rem;
  border-radius: var(--radius-xl);
  background: linear-gradient(150deg, var(--surface) 0%, var(--surface-3) 100%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
}
.band--partners {
  background:
    radial-gradient(110% 130% at 100% 0%, var(--info-soft) 0%, transparent 60%),
    linear-gradient(150deg, var(--surface) 0%, var(--surface-2) 100%);
}
.band h2 { font-size: var(--step-2); }
.band__text p { color: var(--ink-2); max-width: 52ch; }
.band__aside { display: grid; gap: 0.75rem; }

/* ------------------------------------------------------------------ store cards */

.store-card {
  display: grid;
  gap: 0.35rem;
  padding: 1rem;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.store-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line-strong); }
.store-card__mark {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-weight: 750;
  color: var(--ink);
}
.store-card__top { display: flex; align-items: center; gap: 0.4rem; font-size: var(--step-1); }
.store-card__meta { font-size: var(--step--1); }
.store-card__chips, .partner-card__chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.2rem; }

.partner-card {
  display: grid;
  gap: 0.5rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--line);
}
.partner-card__mark {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-xs);
  background: var(--brand-soft);
  color: var(--brand-strong);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.partner-card__mark svg { width: 17px; height: 17px; }

/* -------------------------------------------------------------- category grid */

.cat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.85rem; }
.cat-tile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.95rem 1.05rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 650;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.cat-tile:hover { transform: translateY(-2px); border-color: var(--brand); }
.cat-tile__name { flex: 1; }
.cat-tile svg { width: 16px; height: 16px; color: var(--muted); }

/* -------------------------------------------------------------------- threads */

.threads { display: grid; }
.thread {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.9rem 1.15rem;
  border-bottom: 1px solid var(--line);
  transition: background var(--dur) var(--ease);
}
.thread:last-child { border-bottom: 0; }
.thread:hover { background: var(--surface-2); }
.thread--active { background: var(--brand-soft); }
/* The link owns the row's grid so the action buttons can sit beside it rather
   than inside it — interactive content inside an anchor would also navigate. */
.thread__link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.85rem;
  align-items: center;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.thread__tail { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.thread__actions { display: flex; gap: 0.35rem; }
.thread__avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: var(--step--1);
  flex-shrink: 0;
}
.thread__body { display: grid; gap: 0.1rem; min-width: 0; }
.thread__top { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; }
.thread__subject { font-size: var(--step--1); color: var(--brand-strong); font-weight: 600; }
.thread__preview {
  font-size: var(--step--1);
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The attachment mark in front of a thread preview: smaller than the words it
   labels, and only there when the last message was an attachment. */
.thread__preview-icon {
  width: 1.05em;
  height: 1.05em;
  vertical-align: -0.18em;
  margin-right: 0.28em;
  opacity: 0.85;
}
.thread--unread .thread__preview { color: var(--ink-2); font-weight: 600; }
.thread__unread {
  min-width: 24px;
  height: 24px;
  padding: 0 0.4rem;
  border-radius: var(--radius-pill);
  background: var(--brand);
  color: var(--on-brand);
  font-size: 0.75rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

/* ---------------------------------------------------------------------- chat */

.chat {
  max-width: 780px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.chat__head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.chat__head > div { flex: 1; min-width: 0; }
.chat__product {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 1.1rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  font-size: var(--step--1);
}
.chat__product img { width: 40px; height: 40px; object-fit: cover; border-radius: var(--radius-xs); }
.chat__product-tile {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-xs);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.8rem;
}
.chat__product div { display: grid; }

.chat__stream {
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  height: min(52vh, 520px);
  overflow-y: auto;
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
}
.bubble {
  max-width: 78%;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  display: grid;
  gap: 0.35rem;
}
.bubble--mine { align-self: flex-end; background: var(--brand-soft); border-color: transparent; }
.bubble--theirs { align-self: flex-start; }
.bubble__text { margin: 0; white-space: pre-wrap; word-break: break-word; }
.bubble__text a { color: var(--info); text-decoration: underline; }
.bubble__meta { font-size: 0.7rem; color: var(--muted); justify-self: end; }
.bubble__shot img { max-width: 260px; border-radius: var(--radius-sm); }
.bubble__voice { display: flex; align-items: center; gap: 0.5rem; }
.bubble__voice svg { width: 16px; height: 16px; color: var(--brand-strong); }
.bubble__voice audio { height: 34px; max-width: 220px; }
.bubble__duration { font-size: 0.72rem; color: var(--muted); }
.bubble__file { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600; }
.bubble__file svg { width: 15px; height: 15px; }

.composer { border-top: 1px solid var(--line); padding: 0.75rem 1.1rem 1rem; background: var(--surface); }
.composer__row { display: flex; align-items: flex-end; gap: 0.5rem; }
.composer__row textarea {
  flex: 1;
  resize: none;
  min-height: 42px;
  max-height: 140px;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
}
.composer__row textarea:focus { outline: 2px solid var(--brand-ring); border-color: var(--brand); }
.composer__attach { cursor: pointer; }
.composer__notice {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--step--1);
  color: var(--danger);
  margin-bottom: 0.5rem;
}
.recording-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse 1.1s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.82); }
}
.mic--live { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }

/* --------------------------------------------------------- responsive passes */

@media (max-width: 1000px) {
  .hero--landing, .band { grid-template-columns: 1fr; }
  .hero--landing { padding: 1.75rem; }
  .band { padding: 1.5rem; }
}
@media (max-width: 640px) {
  .hero__panel-grid { grid-template-columns: 1fr 1fr; }
  .chat__stream { height: 46vh; }
  .bubble { max-width: 88%; }
  .thread { padding: 0.8rem 0.9rem; }
}

/* ------------------------------------------------------- locked setting field */

/*
 * A setting the viewer cannot change here, but must be able to read: the store's
 * listing currency on the product form. It reads as a value, not a dead input.
 */
.locked-field {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.7rem;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 650;
}
.locked-field svg { width: 14px; height: 14px; color: var(--muted); }
.locked-field__meta { color: var(--muted); font-weight: 500; font-size: var(--step--1); }

/* ---------------------------------------------------------- request state */

/*
 * A request is either waiting on the store, answered by it, or closed. The chip
 * reads the same on both sides of the conversation; only the wording differs,
 * so the colour carries the meaning: needs attention, done replying, finished.
 */
.badge--open { background: var(--warn-soft); color: var(--warn); }
.badge--answered { background: var(--ok-soft); color: var(--ok); }
.badge--closed { background: var(--surface-3); color: var(--muted); }

.chat__state {
  flex: 0 0 auto;
  display: grid;
  gap: 0.3rem;
  justify-items: end;
  text-align: right;
  min-width: 0;
}
.chat__state-note { font-size: var(--step--1); max-width: 24ch; }
.chat__state-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; justify-content: flex-end; }

@media (max-width: 720px) {
  /* Actions drop below the row instead of squeezing the subject out of it. */
  .thread { flex-wrap: wrap; }
  .thread__link { flex-basis: 100%; }
  .chat__head { flex-wrap: wrap; }
  .chat__state { width: 100%; justify-items: start; text-align: left; }
  .chat__state-note { max-width: none; }
  .chat__state-actions { justify-content: flex-start; }
}

/* ============================================================================
   SmartBuy — one item, every store that sells it, ranked.

   The layout answers one question in one scan: what does it cost to get this
   item to my door, and is the cheapest one actually the best one? The axes are
   deliberately visible (badges, reliability score, lead time) rather than
   collapsed into a single unexplained star rating.
   ========================================================================== */

.smartbuy-intro { margin: 0.35rem 0 0; font-size: var(--step--1); }

.smartbuy-controls {
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)) auto;
  gap: 0.8rem;
  align-items: end;
  margin: 1.1rem 0 1.4rem;
}
.smartbuy-controls .field { margin: 0; }
@media (max-width: 780px) {
  .smartbuy-controls { grid-template-columns: 1fr 1fr; }
  .smartbuy-controls .btn { grid-column: 1 / -1; }
}

.smartbuy-groups { display: grid; gap: 1.1rem; }

/* Doubles as the landing-page teaser, which is an anchor: same card, no link décor. */
.smartbuy-card { display: block; color: inherit; text-decoration: none; }

.smartbuy-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
}
.smartbuy-card__head h3 { margin: 0; }
.smartbuy-card__price {
  display: grid;
  justify-items: end;
  text-align: right;
  font-size: var(--step--1);
  line-height: 1.4;
}
.smartbuy-card__price strong { font-size: var(--step-1); }
.smartbuy-card__offers { display: grid; gap: 0.5rem; }
.smartbuy-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

/* One offer: store, why it won, what it costs delivered, how reliable it is. */
.offer {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto auto;
  gap: 0.8rem;
  align-items: center;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.offer:hover { border-color: var(--line-strong); background: var(--surface-2); }
.offer--muted { background: var(--surface-2); }
.offer__store { display: flex; align-items: center; gap: 0.6rem; min-width: 0; font-size: var(--step--1); }
.offer__avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: var(--step--1);
}
.offer__badges { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.offer__facts {
  display: grid;
  gap: 0.1rem;
  font-size: var(--step--1);
  min-width: 0;
}
.offer__total { font-size: var(--step-1); font-weight: 700; }
.offer__total small { font-weight: 500; color: var(--muted); font-size: var(--step--1); }
.offer__reliability {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: var(--step--1);
}
.offer__reliability svg { width: 15px; height: 15px; color: var(--muted); }
.offer__actions { display: flex; flex-direction: column; gap: 0.3rem; }
.offer__actions .btn { white-space: nowrap; }

@media (max-width: 900px) {
  .offer { grid-template-columns: 1fr; }
  .offer__actions { flex-direction: row; }
}

.offer-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.12rem 0.45rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  background: var(--surface-3);
  color: var(--ink-2);
}
.offer-badge--pick { background: var(--brand-soft); color: var(--brand-strong); }
.offer-badge--cheap { background: var(--ok-soft); color: var(--ok); }
.offer-badge--speed { background: var(--info-soft); color: var(--info); }
.offer-badge--trust { background: var(--warn-soft); color: var(--warn); }
.offer-badge--verified { background: var(--surface-3); color: var(--ink-2); }
.offer-badge--muted { background: var(--surface-3); color: var(--muted); font-weight: 600; }

/* The reliability number, coloured by band so a low score is not quiet. */
.rel {
  display: inline-flex;
  align-items: baseline;
  gap: 0.08rem;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: var(--step--1);
  background: var(--surface-3);
  color: var(--ink-2);
}
.rel small { font-weight: 500; opacity: 0.7; font-size: 0.68rem; }
.rel--high { background: var(--ok-soft); color: var(--ok); }
.rel--solid { background: var(--info-soft); color: var(--info); }
.rel--mixed { background: var(--warn-soft); color: var(--warn); }
.rel--low { background: var(--danger-soft); color: var(--danger); }

.smartbuy-table .smartbuy-table__head,
.smartbuy-table .offer { border-radius: 0; border-left: 0; border-right: 0; }
.smartbuy-table__head {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto auto;
  gap: 0.8rem;
  padding: 0.6rem 0.9rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
@media (max-width: 900px) {
  .smartbuy-table__head { display: none; }
}

/* The same item, from other stores, right where the buying decision happens. */
.smartbuy-block {
  margin-top: 0.9rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--brand-ring);
  border-radius: var(--radius-md);
  background: var(--brand-soft);
}
.smartbuy-block__head {
  display: grid;
  gap: 0.1rem;
  font-size: var(--step--1);
  margin-bottom: 0.55rem;
}
.smartbuy-block__head strong { display: inline-flex; align-items: center; gap: 0.35rem; font-size: var(--step-0); }
.smartbuy-block__list { display: grid; gap: 0.25rem; margin-bottom: 0.6rem; }
.smartbuy-block__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  font-size: var(--step--1);
}
.smartbuy-block__row:hover { background: var(--surface-2); }
.smartbuy-block__store { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.smartbuy-block__lead { white-space: nowrap; }

/* ============================================================================
   UI upgrade — shell, surfaces and mobile.

   Appended as one block so the rules above stay as they were written and this
   layer reads as the deliberate pass it is: a header that wraps on a phone, a
   hub sub-navigation that is not a line of text, tables that become cards where
   there is no room for columns, and touch targets sized for thumbs.
   ========================================================================== */

/* --------------------------------------------------------------- type scale */

/*
 * The headings are fluid rather than stepped: a 390px phone and a 1440px laptop
 * were sharing one size, so the phone got a headline that filled the screen and
 * the laptop got one that looked timid. `clamp` moves between the two without a
 * media query per breakpoint.
 */
h1 { font-size: clamp(1.55rem, 1.15rem + 1.7vw, 2.3rem); }
h2 { font-size: clamp(1.2rem, 1rem + 0.85vw, 1.55rem); }
h3 { font-size: var(--step-1); }
.section__head { margin-bottom: 1.15rem; }

/* ------------------------------------------------------------- page header */

/*
 * One header for every surface: what this page is, one line of context, and the
 * actions that belong to it. On a phone the actions drop to their own row and
 * stretch, because a right-aligned cluster of two buttons on a 360px screen is
 * a row of thumb-sized accidents.
 */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.9rem 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
}
.page-head__text { min-width: 0; flex: 1 1 22rem; }
.page-head h1 { margin: 0 0 0.3rem; }
.page-head h1 + p, .page-head p { margin: 0; }
.page-head__actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
@media (max-width: 640px) {
  .page-head { margin-bottom: 1.1rem; }
  .page-head__actions { width: 100%; }
  .page-head__actions .btn { flex: 1 1 auto; }
}

/* ------------------------------------------------------- hub sub-navigation */

/*
 * The seller hub used a crumbs line — "Seller hub · Products · Orders · …" — as
 * its navigation. It read as breadcrumb text, hid the unread count among
 * punctuation, and left no clue about which page you were on. This is the same
 * set of destinations as an actual tab strip: icon, active state, count.
 *
 * It scrolls sideways instead of wrapping (a wrapped tab strip reflows under
 * your thumb mid-tap) and sticks below the header window while you work down a
 * long page.
 */
.subnav {
  position: sticky;
  top: calc(var(--topbar-h, 4.2rem) + 0.5rem);
  z-index: 25;
  display: flex;
  gap: 0.3rem;
  padding: 0.32rem;
  margin-bottom: 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  box-shadow: var(--shadow-1);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.subnav::-webkit-scrollbar { display: none; }
.subnav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.48rem 0.85rem;
  border-radius: var(--radius-pill);
  font-size: var(--step--1);
  font-weight: 650;
  color: var(--ink-2);
  white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.subnav__link svg { width: 16px; height: 16px; }
.subnav__link:hover { background: var(--surface-3); color: var(--ink); }
.subnav__link--on, .subnav__link--on:hover { background: var(--ink); color: var(--surface); }
.subnav__count {
  min-width: 1.2rem;
  padding: 0 0.32rem;
  border-radius: var(--radius-pill);
  background: var(--brand);
  color: var(--on-brand);
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.2rem;
  text-align: center;
}
.subnav__link--on .subnav__count { background: var(--brand); color: var(--on-brand); }

/* ------------------------------------------------------------ metric strip */

/*
 * The hubs lead with money, then a row of small counters. Nine identical stat
 * cards gave "requests waiting" the same weight as "ready to withdraw"; these
 * carry the second tier at a size that says second tier.
 */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 0.6rem; }
.metric {
  display: grid;
  gap: 0.05rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.metric__label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; }
.metric__value { font-size: var(--step-1); font-weight: 750; letter-spacing: -0.01em; }
.metric__hint { font-size: 0.74rem; color: var(--muted); }
.metric--accent { border-color: var(--brand); background: linear-gradient(180deg, var(--brand-soft), var(--surface) 78%); }

/* ------------------------------------------------------------ admin console */

/*
 * The ops console was nine sections in one column, so the escrow switch and the
 * recovery codes were a screen and a half apart while both lived in "settings".
 * Grouped into tabs by the question they answer, with the strip answering
 * "where am I" and staying reachable on a phone.
 */
.console-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.3rem;
  margin-bottom: 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.console-tabs::-webkit-scrollbar { display: none; }
@media (min-width: 721px) {
  .console-tabs { position: sticky; top: calc(var(--topbar-h, 4.2rem) + 0.5rem); z-index: 25; }
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.85rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: var(--step--1);
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.tab svg { width: 16px; height: 16px; }
.tab:hover { background: var(--surface-3); color: var(--ink); }
.tab[aria-selected="true"] { background: var(--ink); color: var(--surface); }
.tab[aria-selected="true"]:hover { background: var(--ink); color: var(--surface); }
.tab__count {
  min-width: 1.2rem;
  padding: 0 0.32rem;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.2rem;
  text-align: center;
}
.tab[aria-selected="true"] .tab__count { background: var(--brand); color: var(--on-brand); }
/* A count is work waiting; this is a warning that something is off. Same slot,
   different colour, because a deployment that cannot send mail needs to be
   visible from every tab rather than only from the one that explains it. */
.tab__count--warn { background: var(--danger-soft); color: var(--danger); }
.tab[aria-selected="true"] .tab__count--warn { background: var(--danger); color: #fff; }
.tabpanel[hidden] { display: none; }
.tabpanel { animation: fade-in 180ms var(--ease); }
.tabpanel > .section:last-child, .tabpanel > section:last-child { margin-bottom: 0; }

/* --------------------------------------------------------- mobile tab strip */

/*
 * Inside a pane the tabs scroll with the page, which is right on a desktop and
 * wrong on a phone: an operator halfway down the currencies table should not
 * have to scroll back up to switch. At the phone breakpoint the strip pins to
 * the top of the viewport instead of the header offset.
 */
@media (max-width: 720px) {
  .console-tabs {
    position: sticky;
    top: 0;
    z-index: 36;
    margin: 0 -0.9rem 1.1rem;
    padding: 0.32rem 0.9rem;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: var(--glass);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
  }
  .subnav { top: 0; margin-left: -0.9rem; margin-right: -0.9rem; padding-left: 0.9rem; padding-right: 0.9rem; border-radius: 0; border-left: 0; border-right: 0; }
}

/* ------------------------------------------------------------ data tables */

/*
 * A five-column table cannot survive a 360px screen, and sideways scrolling
 * hides the very column a row is about. `.table-cards` re-lays the same markup
 * as a stack of labelled rows; each cell carries its own column name in
 * `data-label`, so nothing depends on the header row that is no longer drawn.
 */
.table-wrap { overscroll-behavior-x: contain; }
@media (max-width: 720px) {
  .table-cards { overflow: visible; }
  .table-cards table, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards thead { display: none; }
  .table-cards tr {
    margin-bottom: 0.7rem;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
  }
  .table-cards tr:last-child { margin-bottom: 0; }
  .table-cards tbody tr:hover { background: var(--surface); }
  .table-cards td {
    display: grid;
    grid-template-columns: minmax(5.5rem, 34%) minmax(0, 1fr);
    gap: 0.2rem 0.7rem;
    align-items: baseline;
    padding: 0.32rem 0;
    border-bottom: 0;
  }
  .table-cards td::before {
    content: attr(data-label);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .table-cards td[data-label=""]::before, .table-cards td:not([data-label])::before { content: none; }
  .table-cards td:not([data-label]) { grid-template-columns: 1fr; }
  /* A badge is a label, not a column: left to stretch it becomes a full-width
     pill that reads as a bar. */
  .table-cards td > * { justify-self: start; max-width: 100%; }
  .table-cards tr:first-child { margin-top: 0; }
}

/*
 * The seller's catalogue is an inline editor: six columns of inputs, and the
 * title column is the only thing telling you which row you are editing. Card
 * stacking would break the grid the inputs are laid out in, so this one keeps
 * its columns and scrolls — with the title column pinned, so the row identity
 * never leaves the screen.
 */
@media (max-width: 720px) {
  .table--pinned tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--surface);
    box-shadow: 1px 0 0 var(--line);
    max-width: 12rem;
  }
  .table--pinned thead th:first-child {
    position: sticky;
    left: 0;
    z-index: 3;
    background: var(--surface-2);
    box-shadow: 1px 0 0 var(--line);
  }
  .table--pinned tbody tr:hover td:first-child { background: var(--surface-2); }
}

/* Inline editors inside a table are taps too. */
@media (pointer: coarse) {
  .table-wrap input:not([type="checkbox"]), .table-wrap select { min-height: 40px; font-size: max(1rem, var(--step--1)); }
}

/* --------------------------------------------------------------- lists / rows */

/*
 * A "row on the left, actions on the right" list stops working when the row is
 * long: the actions end up beside the middle of a paragraph. Below 720px these
 * become blocks with the actions on their own line.
 */
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: 0; }
.list-row__main { min-width: 0; }
.list-row__title { font-weight: 650; }
.list-row__meta { font-size: var(--step--1); color: var(--muted); }
.list-row__aside { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
@media (max-width: 640px) {
  .list-row { flex-wrap: wrap; }
  .list-row__aside { flex-basis: 100%; justify-content: flex-start; }
}

.row--actions { gap: 0.4rem; }

/*
 * Category chips as a rail on a phone. Wrapped, a page of twelve categories
 * becomes three rows of buttons that push the products below the fold; the rail
 * keeps one row that scrolls, which is also how it stays reachable one-handed.
 */
@media (max-width: 720px) {
  .tag-line {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 -0.9rem 1.1rem;
    padding: 0.15rem 0.9rem 0.1rem;
  }
  .tag-line::-webkit-scrollbar { display: none; }
  .tag-line > * { flex: 0 0 auto; }
}

/* The browsing toolbar: search-sort-paging sits on its own row on a phone. */
.catalogue-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.9rem 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1.15rem;
}
.catalogue-head__text { min-width: 0; flex: 1 1 18rem; }
.catalogue-head h2 { margin: 0 0 0.25rem; }
.catalogue-head p { margin: 0; }
.catalogue-sort { display: flex; align-items: center; gap: 0.45rem; font-size: var(--step--1); }
.catalogue-sort .currency-select { font-size: var(--step--1); }
@media (max-width: 560px) {
  .catalogue-sort { width: 100%; justify-content: space-between; }
  .catalogue-sort .currency-select { flex: 1; max-width: none; }
}

/* Pagination: equal-weight buttons that do not jump as the labels change. */
.pager { display: flex; align-items: center; justify-content: center; gap: 0.6rem; margin-top: 1.75rem; flex-wrap: wrap; }
.pager .btn { min-width: 6.5rem; }

/*
 * The quantity stepper in the cart. It was sized with an inline style that made
 * a 30px-wide box — fine with a mouse and a coin toss with a thumb — so it is
 * sized here instead, next to the touch rules it has to agree with.
 */
.qty-input {
  width: 5rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--step-0);
  text-align: center;
}
.qty-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
@media (pointer: coarse) {
  .qty-input { min-height: 44px; font-size: max(1rem, var(--step-0)); }
}

/*
 * Checkout: what you are paying for comes before the form that pays for it.
 * On a laptop the summary is a sidebar and the order does not matter; on a phone
 * the two stack, and asking for an address before showing the total is the wrong
 * way round.
 */
@media (max-width: 880px) {
  .grid--checkout > aside { order: -1; }
  .grid--checkout > aside .notice { margin-top: 0; margin-bottom: 1rem; }
}

/* ------------------------------------------------- seller application & KYC */

/*
 * The roll call on the sign-up form: two real choices, presented as choices.
 * A `<select>` asking "I want to" hides the second option until it is opened,
 * and picking "Sell" changes the whole form underneath it — which the two cards
 * make visible before anything is typed.
 */
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-bottom: 1rem; }
@media (max-width: 560px) { .choice-grid { grid-template-columns: 1fr; } }
.choice {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.choice:hover { border-color: var(--brand); }
.choice input { margin-top: 0.2rem; accent-color: var(--brand); flex-shrink: 0; }
.choice__title { font-weight: 700; display: flex; align-items: center; gap: 0.4rem; }
.choice__title svg { width: 16px; height: 16px; color: var(--brand); }
.choice__hint { font-size: var(--step--1); color: var(--muted); }
.choice--on { border-color: var(--brand); background: var(--brand-soft); }

/* One document in the checklist: what is held, and how to replace it. */
.doc-item { display: grid; gap: 0.7rem; padding: 0.9rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.doc-item--missing { border-style: dashed; border-color: var(--line-strong); }
.doc-item__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.doc-item__title { font-weight: 700; display: flex; align-items: center; gap: 0.45rem; }
.doc-item__title svg { width: 17px; height: 17px; color: var(--brand); }
.doc-item__hint { font-size: var(--step--1); color: var(--muted); margin: 0.15rem 0 0; }
.doc-item__held { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; padding: 0.6rem 0.7rem; border-radius: var(--radius-sm); background: var(--surface-2); }
/* A scan ops refused: not a document this application holds, a reason to send
   another one — so it reads as a warning and keeps the operator's note. */
.doc-item__held--refused { background: var(--danger-soft); }
.doc-item__held--refused .doc-item__thumb { background: transparent; color: var(--danger); }
.doc-item__thumb { width: 52px; height: 52px; border-radius: var(--radius-xs); object-fit: cover; background: var(--surface-3); display: grid; place-items: center; flex-shrink: 0; }
.doc-item__thumb svg { width: 22px; height: 22px; color: var(--muted); }
.doc-item__meta { min-width: 0; font-size: var(--step--1); }
.doc-item__meta strong { display: block; font-size: var(--step-0); }
.doc-item__upload { display: grid; gap: 0.5rem; }
input[type="file"] { font: inherit; font-size: var(--step--1); color: var(--ink-2); }
input[type="file"]::file-selector-button {
  font: inherit;
  font-size: var(--step--1);
  font-weight: 650;
  margin-right: 0.6rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
input[type="file"]::file-selector-button:hover { background: var(--surface-3); }

/* The ops side of the same paperwork: applicants, and what they sent. */
.applicant { display: grid; gap: 0.9rem; }
.applicant__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.9rem; flex-wrap: wrap; }
.applicant__docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0.6rem; }
.applicant__doc { display: grid; gap: 0.5rem; padding: 0.6rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.applicant__doc-top { display: flex; align-items: center; gap: 0.55rem; min-width: 0; }
.applicant__doc-shot {
  width: 46px; height: 46px; flex-shrink: 0; border-radius: var(--radius-xs); object-fit: cover;
  background: var(--surface-3); display: grid; place-items: center; border: 1px solid var(--line);
}
.applicant__doc-shot svg { width: 20px; height: 20px; color: var(--muted); }
.applicant__doc-name { font-size: var(--step--1); font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.applicant__doc-meta { font-size: 0.72rem; color: var(--muted); }
.applicant__decision { display: grid; gap: 0.6rem; padding-top: 0.6rem; border-top: 1px solid var(--line); }
.applicant__trail { font-size: var(--step--1); }
.applicant__trail li { padding: 0.25rem 0; color: var(--ink-2); }

/* ---------------------------------------------------------------- utilities */

.stack { display: grid; gap: 1.15rem; }
.toolbar { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ------------------------------------------------------- header on a phone */

/*
 * The header was a single flex row with `flex-wrap: nowrap`, so the search
 * field it was told to give a full row of its own could not wrap — it was
 * squeezed and pushed off the right edge instead, taking the search button with
 * it. Wrapping restores the intended two rows and puts the tools on the right of
 * the first one.
 */
.topbar__inner { gap: 0.7rem; }
.topbar__tools { margin-left: auto; }
/* The page you are on, marked in the header instead of only in the URL. */
.nav__link--on { background: var(--surface-3); color: var(--ink); }
.nav__link--on.nav__link--accent { background: var(--brand-soft); }
.topbar__tools .icon-btn { width: 40px; height: 40px; }
/*
 * Between 901px and 1180px there is not room for the brand, the search field and
 * the links in one row without squeezing the field down to a strip — at 1041px
 * it was 215px wide, narrower than the placeholder it has to show. Rather than
 * let the row spill past the viewport, which is what it did: the document
 * scrolled 82px sideways at 1440px and the currency picker sat off the right
 * edge, the links move to a second row of their own, where they scroll sideways
 * if they still do not fit and the search keeps the whole first row to itself.
 */
.nav { min-width: 0; }
@media (min-width: 901px) and (max-width: 1180px) {
  .topbar__inner { flex-wrap: wrap; row-gap: 0.35rem; }
  .brand img { height: 34px; }
  .search { flex: 1 1 240px; max-width: none; }
  .nav {
    order: 4;
    flex-basis: 100%;
    margin-left: 0;
    padding-bottom: 0.1rem;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .topbar__tools { margin-left: auto; }
}
@media (max-width: 900px) {
  .topbar__inner { flex-wrap: wrap; row-gap: 0.5rem; padding: 0.55rem 0.9rem; }
  .brand img { height: 34px; }
  .search { order: 3; flex: 1 1 100%; max-width: none; }
  .topbar__tools { margin-left: auto; }
}
@media (max-width: 400px) {
  .topbar__tools .currency-select { max-width: 72px; }
}

/* --------------------------------------------------------------- mobile body */

@media (max-width: 640px) {
  .app { padding: 1.1rem 0.9rem 3.25rem; }
  .card { padding: 1rem; border-radius: var(--radius-md); }
  .grid { gap: 0.9rem; }
  .section { margin-bottom: 1.75rem; }
  .stat { padding: 0.9rem 0.95rem; border-radius: var(--radius-md); }
  .stat__value { font-size: var(--step-1); }
  .hero { padding: 1.4rem 1.15rem; gap: 1.5rem; border-radius: var(--radius-lg); }
  .band { padding: 1.4rem 1.15rem; border-radius: var(--radius-lg); }
  .btn--lg { padding: 0.7rem 1.1rem; font-size: var(--step-0); }
  .hero__cta { gap: 0.5rem; }
  .hero__cta .btn { flex: 1 1 100%; }
  /* Four one-line claims stacked is four lines of scroll; two columns is not. */
  .hero__points { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem 0.8rem; }
  .hero__points span { align-items: flex-start; }
  .section__head .btn { flex: 1 1 auto; }
}

/* --------------------------------------------------- touch-sized controls */

/*
 * Anything meant to be tapped gets a thumb's worth of height on a touch screen,
 * and text inputs get a 16px face — below that iOS zooms the whole page when a
 * field takes focus, which reads as the layout breaking.
 */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn--sm { min-height: 38px; }
  .icon-btn { width: 44px; height: 44px; }
  .nav__link, .drawer__link, .subnav__link, .tab { min-height: 42px; }
  .cat-chip, .pill { min-height: 36px; }
  .field input, .field select, .field textarea, .search input, .inline-form input { font-size: max(1rem, var(--step-0)); }
}

/* -------------------------------------------------------------- drawer (menu) */

.drawer__panel { gap: 0; padding: 0; }
.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
}
.drawer__head img { height: 30px; width: auto; }
/*
 * The drawer's links used to be plain anchors with a rule under each one, which
 * is what a column of text wants and what a grouped menu does not: every row is
 * its own destination, so the separator is padding and a hover fill. A button in
 * the footer keeps button padding rather than taking the link's.
 */
.drawer__nav { flex: 1; overflow-y: auto; padding: 0.75rem 0.7rem 1rem; display: grid; gap: 0.15rem; }
.drawer__nav a { border-bottom: 0; padding: 0.6rem 0.65rem; }
.drawer__panel a.btn { padding: 0.6rem 1rem; border-bottom: 0; }
.drawer__group { margin: 0.55rem 0 0.15rem; padding: 0 0.55rem; }
.drawer__group:first-child { margin-top: 0; }
.drawer__group-title {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.drawer__link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.65rem;
  border-radius: var(--radius-sm);
  font-weight: 650;
  color: var(--ink);
}
.drawer__link svg { width: 18px; height: 18px; color: var(--ink-2); }
.drawer__link:hover { background: var(--surface-2); }
.drawer__link--on { background: var(--brand-soft); color: var(--brand-strong); }
.drawer__link--on svg { color: var(--brand-strong); }
[data-theme="dark"] .drawer__link--on { color: var(--brand); }
[data-theme="dark"] .drawer__link--on svg { color: var(--brand); }
.drawer__link .spacer { flex: 1; }
.drawer__foot { padding: 0.85rem 1rem 1.1rem; border-top: 1px solid var(--line); display: grid; gap: 0.7rem; }
.drawer__account { display: flex; align-items: center; gap: 0.65rem; min-width: 0; }
.drawer__account-name { font-weight: 700; }
.drawer__account-meta { font-size: var(--step--1); }
.drawer__account .avatar { width: 40px; height: 40px; }
.drawer__tools { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

/* The contact bar on a product page: full width, and above the home indicator. */
.sticky-buy { padding-bottom: calc(0.75rem + env(safe-area-inset-bottom)); }
@media (max-width: 640px) {
  .sticky-buy { bottom: 0.6rem; flex-wrap: wrap; }
  .sticky-buy .btn { flex: 1 1 auto; }
}

/* ============================================================================
   Dark theme audit (appended block)

   Everything here is a correction for the dark side of the token set, kept in
   one place rather than scattered through the rules above so the light theme
   stays exactly as it was tuned: the light values are the originals, and each
   rule below either flips a label on a solid fill (the --on-* tokens), or names
   the dark treatment of a surface that has no light-theme equivalent.
   ========================================================================== */

/*
 * Generated placeholder marks.
 *
 * `tileStyle()` now hands out a hue and nothing else, so a hovered product, a
 * store initial, a chat avatar and a search suggestion all share one gradient
 * recipe whose lightness the theme decides. Without this the pastel gradient was
 * painted on a dark page and the initials — which the dark theme lightens — came
 * out white-on-cream.
 */
.suggestions__tile,
.thread__avatar,
.chat__product-tile,
.store-card__mark,
.offer__avatar,
.store-hero__mark,
.product__media {
  background-image: linear-gradient(
    135deg,
    hsl(var(--tile-h, 210) var(--tile-sat) var(--tile-l-1)),
    hsl(var(--tile-h-2, 248) var(--tile-sat) var(--tile-l-2))
  );
}

/* The decorative initials have to be *lighter* on a dark mark, not fainter: the
   dark mark is now dark, so the old white-on-white problem inverts. */
[data-theme="dark"] .product__tile { color: rgba(255, 255, 255, 0.5); }
[data-theme="dark"] .store-hero__mark { color: rgba(255, 255, 255, 0.62); }
[data-theme="dark"] .store-card__mark { color: var(--ink); }

/*
 * The active pill in a strip.
 *
 * Both the hub sub-navigation and the ops console tabs marked the current page by
 * inverting: surface-coloured text on an ink pill. On white that is a dark chip;
 * on black the same rule paints the brightest white slab on the screen — it looks
 * like a light-theme widget and it flattens every other item in the strip. The
 * dark treatment keeps the brand as the signal instead: a brand tint, brand text
 * and a brand edge, which is the same idiom the top bar and the drawer already use
 * for their active link.
 */
[data-theme="dark"] .subnav__link--on,
[data-theme="dark"] .subnav__link--on:hover,
[data-theme="dark"] .tab[aria-selected="true"],
[data-theme="dark"] .tab[aria-selected="true"]:hover {
  background: var(--brand-soft);
  color: var(--brand);
  box-shadow: inset 0 0 0 1px rgba(245, 130, 31, 0.45);
}
[data-theme="dark"] .subnav__link--on svg,
[data-theme="dark"] .tab[aria-selected="true"] svg { color: var(--brand); }

/* The count inside an active pill: the brand fill would disappear into the brand
   tint around it, so on dark it becomes the plain chip. */
[data-theme="dark"] .subnav__link--on .subnav__count,
[data-theme="dark"] .tab[aria-selected="true"] .tab__count {
  background: var(--brand);
  color: var(--on-brand);
}

/* Inline editors and pickers inside a dark card: the browser's own dark controls
   are close to the surface colour, so give them an edge to sit against. */
[data-theme="dark"] .field input,
[data-theme="dark"] .field select,
[data-theme="dark"] .field textarea,
[data-theme="dark"] .table-wrap input,
[data-theme="dark"] .table-wrap select {
  background: var(--surface-2);
}

/* A refusal on a dark surface: the soft red alone is nearly invisible next to a
   normal card, so the rules that show state carry an edge as well as a tint. */
[data-theme="dark"] .notice,
[data-theme="dark"] .badge,
[data-theme="dark"] .pill {
  border-color: var(--line-strong);
}
[data-theme="dark"] .notice--error { border: 1px solid var(--danger); }
[data-theme="dark"] .notice--ok { border: 1px solid var(--ok); }
[data-theme="dark"] .notice--info { border: 1px solid var(--info); }

/* The doc-item held/refused rows are surface-on-surface: on dark the difference
   between --surface and --surface-2 is 6 levels, which is not a card edge. */
[data-theme="dark"] .doc-item__held { background: var(--surface-3); }
[data-theme="dark"] .doc-item__held--refused { background: var(--danger-soft); }

/*
 * The chosen category chip is the same inversion as the active pill — an ink pill
 * with surface text — and it carries a count in `--muted` inside it, which on a
 * near-white chip in dark mode came out at 2.7:1: the chip was legible, the
 * number on it was not.
 */
[data-theme="dark"] .cat-chip--on,
[data-theme="dark"] .cat-chip--on:hover {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
  box-shadow: inset 0 0 0 1px rgba(245, 130, 31, 0.35);
}
[data-theme="dark"] .cat-chip--on .muted { color: var(--ink-2); }

/* A trade badge (MOQ, unit, lead time) sitting on a product card. The ink chip is
   right over a white photo; over a dark one it is the brightest thing in the grid
   and it competes with the product itself. */
[data-theme="dark"] .chip-trade {
  background: rgba(13, 15, 19, 0.82);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}

/* ==================================================================== site strip
   The operator's strip: the announcement marquee and the countdown, filled by
   js/app.js from /api/site. It sits above the header, outside #app, and ships
   hidden — an install with neither set never shows an empty bar.

   The marquee's seam is the whole trick here: the track is two identical copies
   of the notice and each copy carries its spacing as a margin, so shifting the
   track by exactly half its width lands copy two where copy one started. A `gap`
   on the flex track would leave the gap itself in the arithmetic and the text
   would jump by half of it on every loop. */
.site-strip {
  position: relative;
  z-index: 3;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.strip__row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.5rem 1rem;
  line-height: 1.35;
  text-decoration: none;
}
a.strip__row:hover { text-decoration: none; filter: brightness(1.04); }

.marquee {
  overflow: hidden;
  padding: 0;
  white-space: nowrap;
}
.marquee__track {
  display: flex;
  width: max-content;
  animation-name: marquee;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
.marquee__item {
  margin-right: 3rem;
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.01em;
}
a.marquee__item:hover { text-decoration: underline; }
.marquee:hover .marquee__track { animation-play-state: paused; }
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
/* Motion is the point of a marquee, but not at the cost of reading it: without
   it the notice is simply centred, and the hidden duplicate is not in the way. */
@media (prefers-reduced-motion: reduce) {
  .marquee__track { animation: none; }
  .marquee__track .marquee__item[aria-hidden="true"] { display: none; }
  .marquee { display: flex; justify-content: center; white-space: normal; }
  .marquee__item { margin-right: 0; }
}

.tone--brand { background: var(--brand-soft); color: var(--brand-strong); }
.tone--info { background: var(--surface-2); color: var(--ink-2); }
.tone--warn { background: var(--warn-soft); color: var(--warn); }

.strip__countdown {
  background: var(--surface-2);
  color: var(--ink);
  flex-wrap: wrap;
}
.countdown__label { font-weight: 600; }
.countdown__clock {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  padding: 0.15rem 0.65rem;
  letter-spacing: 0.02em;
}

/* The brand marks in the ops console: what is live, and the two things an
   operator can do about it. Laid out as a row of cards so the light wordmark,
   the dark one and the tab icon read as one set rather than three forms. */
.brand-assets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.85rem;
}
.brand-asset {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 0.75rem;
}
.brand-asset__preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 74px;
  padding: 0.5rem;
  margin-bottom: 0.55rem;
  border-radius: var(--radius-sm);
  /* Both background tones in one tile: a white wordmark and a dark one both have
     to be visible here, or "which file did I just upload" is unanswerable. */
  background-image: linear-gradient(135deg, var(--surface) 0 50%, var(--surface-3) 50% 100%);
  border: 1px solid var(--line);
}
.brand-asset__preview img {
  max-width: 100%;
  max-height: 64px;
  object-fit: contain;
}
.brand-asset__name {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* The mail preview in the ops console. Dressed as the message rather than as a
   form field — a subject line on its own row, then the body on white — because
   the question an operator is asking here is "what will this look like in an
   inbox", and a textarea cannot answer it. The pane keeps its own surface in
   dark mode so the preview never becomes an unreadable white-on-dark block. */
.email-preview {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #ffffff;
  color: #16181d;
}
.email-preview__subject {
  padding: 0.7rem 0.95rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 650;
  font-size: 0.95rem;
}
.email-preview__body {
  padding: 0.95rem;
  font-size: 0.92rem;
  line-height: 1.55;
  max-height: 320px;
  overflow: auto;
}
.email-preview__body p { margin: 0 0 0.7rem; }
.email-preview__body p:last-child { margin-bottom: 0; }
.email-preview__body a { color: var(--brand-strong); }

/* A skip is not a failure and a failure is not a skip: the console says which,
   on the same scale as the badges the rest of the console uses. */
.pill--warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill--error { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

/* Two columns of equal width — the plain-text and html versions of one email. */
.grid--halves { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

/* ============================================================================
   The header, rebuilt so it cannot overflow.
   ========================================================================== */

/*
 * Why the bar is one row, and two rows below 1181px.
 *
 * The links are the only part of the bar that cannot shrink: a `white-space:
 * nowrap` label has a min-width of its own text. Signed in, the header used to
 * carry eight destinations in that row, flex had nothing left to give, so the
 * search field collapsed to its padding, the document scrolled sideways and the
 * currency picker and the account fell off the right edge of the viewport.
 *
 * The count is what changed. The account's own pages — Orders, Wallet, Deliver
 * with us, Ops — moved into the menu behind the avatar (js/app.js), which left
 * four shopping links in the row, and four fit at every width the one-row
 * layout is used for. So the link row of its own is now the arrangement for the
 * widths that still need it — 1180px and under, where the drawer has not taken
 * over yet — and above it the links sit in the one row where they belong.
 */
.topbar__inner { flex-wrap: wrap; }
.brand { order: 1; }
.search { order: 2; flex: 1 1 260px; max-width: none; }
.topbar__tools { order: 3; margin-left: auto; }

/*
 * Below the one-row band the links get a row of their own and scroll within it
 * if even that is not enough (a 900px window with every link present). The
 * brand, the search field and the tools are then free to size themselves
 * sensibly instead of fighting for the space the links used to take.
 */
@media (max-width: 1180px) {
  .topbar__inner { row-gap: 0.2rem; padding-bottom: 0.5rem; }
  .nav {
    order: 4;
    flex-basis: 100%;
    margin-left: 0;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    /* Room for the active link's own fill, which would otherwise be clipped by
       the scrolling box it now lives in. */
    padding: 0.15rem 0.1rem 0.1rem;
  }
  .nav::-webkit-scrollbar { display: none; }
}

/*
 * Below 900px the row of links is worse than the drawer: eight links scrolled
 * sideways in a 360px strip are eight links nobody finds. The drawer carries the
 * same list, grouped, and the menu button is right there.
 */
@media (max-width: 900px) {
  .nav { display: none; }
  .menu-btn { display: grid; }
  .search { order: 3; flex-basis: 100%; }
  .topbar__tools { order: 2; }
  .topbar__inner { padding: 0.55rem 0.9rem 0.7rem; }
}

/*
 * The account chip in the bar.
 *
 * Sign-out used to be the last link, rendered as an 8th item that read like
 * navigation. It is not navigation: it is what happens to the account the avatar
 * stands for, so it wears the avatar and stays at the end of the row.
 */
.nav__link[data-logout] { gap: 0.45rem; color: var(--ink-2); }
.nav__link[data-logout]:hover { background: var(--danger-soft); color: var(--danger); }
.nav__link[data-logout]:hover .nav__avatar { background: var(--danger); color: var(--on-danger); }

/* The bar lifts off the page once the page has scrolled under it. Set from the
   shell (js/app.js) rather than with a scroll-driven animation, which no browser
   here implements. */
.topbar { transition: box-shadow var(--dur) var(--ease); }
.topbar--scrolled { box-shadow: var(--shadow-2); }

/*
 * Keyboard focus, on the controls that had none.
 *
 * An anchor with a fill on hover has no visible focus ring of its own, so tabbing
 * through the header was a walk through unmarked controls: the browser default
 * outline is suppressed wherever a border-radius and a background are set on the
 * same element in this stylesheet. One ring, drawn inside the element's own
 * radius, is the fix.
 */
.nav__link:focus-visible,
.drawer__link:focus-visible,
.icon-btn:focus-visible,
.tab:focus-visible,
.cat-chip:focus-visible,
.thread__link:focus-visible,
.composer__row textarea:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ============================================================================
   Chat: the caution, the composer's own limits, and the thread it belongs to.
   ========================================================================== */

/*
 * A message that carried a phone number, an email or a link.
 *
 * Marked rather than hidden: the message is the buyer's own words and it sent
 * exactly as typed. The caution sits inside the bubble, at the bottom, on a
 * tinted strip — close enough that it is read with the message, quiet enough that
 * it does not read as an error. Both sides see it, because both sides need to
 * know what the thread now contains.
 */
.bubble--flagged { border-color: var(--warn); }
.bubble__caution {
  display: flex;
  gap: 0.45rem;
  align-items: flex-start;
  margin-top: 0.5rem;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: var(--step--1);
  line-height: 1.4;
}
.bubble__caution svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 0.1rem; }

/*
 * The warning shown before a draft leaves the platform.
 *
 * It sits above the input, where the words it is about are, and it names what was
 * found instead of stating a rule — "this looks like a phone number" is a fact the
 * writer can check, and "do not share contact details" is a rule they can decide
 * does not apply to them. Both buttons are offered, neither is styled as the wrong
 * answer: sending anyway is allowed, and pretending otherwise would only teach
 * people to route around the warning.
 */
.composer__caution {
  margin-bottom: 0.7rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--warn);
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: var(--step--1);
}
.composer__caution[hidden] { display: none; }
.composer__caution-head { display: flex; align-items: center; gap: 0.45rem; margin-bottom: 0.3rem; }
.composer__caution-head svg { width: 16px; height: 16px; flex-shrink: 0; }
.composer__caution-head strong { font-size: var(--step-0); }
.composer__caution p { margin: 0 0 0.6rem; line-height: 1.45; }
.thread__link:focus-visible { outline-offset: 1px; }

/*
 * The line under the composer. Quiet on purpose: it is the same promise the
 * escrow chip makes, in the one place a buyer is about to write instead of buy.
 */
.composer__privacy {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: var(--step--1);
  line-height: 1.4;
}
.composer__privacy svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 0.18rem; color: var(--brand); }

/* A send button that cannot be pressed until there is something to send. */
#chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* The inbox filter row sits above the card it filters, not inside it. */
#thread-filters { margin-bottom: 0.9rem; }

/* ============================================================================
   The header: one row, an account menu, and a password field you can read.
   Appended in one block, as the two before it, so the shell styles it refines
   stay where they were reviewed.
   ========================================================================== */

/*
 * Above the wrap breakpoint the bar is brand, search, links and tools in a
 * single row, and only the links are rigid: a nowrap label has a min-width of
 * its own text. When the row ran out of room the search field collapsed to its
 * padding and the tools were pushed past the right edge of the viewport — the
 * currency picker and the theme button sat half outside it at 1440px, which is
 * the clipping this fixes.
 *
 * The space has to come from somewhere, so it comes from the one control that is
 * designed to absorb it: the search field may shrink (min-width: 0) and the
 * tools may not (flex-shrink: 0). The rest of the fix is the account menu below
 * — seven links left this row, and the arithmetic fits without them.
 */
.search { min-width: 0; }
.topbar__tools { flex-shrink: 0; }

/*
 * In the one-row band the links and the search field share what is left after
 * the tools, so both are tuned tighter than the base spacing. Scoped to this
 * band rather than set globally: the wrapped layouts below 1181px have a row to
 * themselves and keep the roomier padding.
 */
@media (min-width: 1181px) {
  /* Order, not position: brand, search field, links, then the tools — so the
     account chip keeps the last seat in the row, which is where a header's
     account belongs. */
  .nav { order: 3; gap: 0.2rem; }
  .topbar__tools { order: 4; }
  .search { flex: 1 1 200px; max-width: 620px; }
  .nav__link { padding: 0.48rem 0.58rem; }
}

/* ------------------------------------------------------------- account menu */

.account { position: relative; display: flex; }
.account[hidden] { display: none; }

/*
 * The chip. An avatar, the first name and a chevron — the three things that say
 * "this opens your account" without another label in the row.
 */
.account__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 11rem;
  padding: 0.2rem 0.5rem 0.2rem 0.24rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--step--1);
  font-weight: 650;
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.account__btn:hover { background: var(--surface-3); }
.account__btn[aria-expanded="true"] { background: var(--surface-3); border-color: var(--line-strong); }
.account__btn svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--muted); }
.account__name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* The name is the first thing to go when the row is tight; the avatar is not. */
@media (max-width: 1160px) { .account__name { display: none; } }

.account__panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 55;
  width: 16rem;
  padding: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-3);
  animation: fade-up 140ms var(--ease);
}
.account__panel[hidden] { display: none; }

.account__head {
  padding: 0.5rem 0.6rem 0.55rem;
  margin-bottom: 0.3rem;
  border-bottom: 1px solid var(--line);
}
.account__who { font-weight: 700; font-size: var(--step-0); overflow: hidden; text-overflow: ellipsis; }
.account__meta { font-size: 0.74rem; }
.account__email { font-size: 0.72rem; overflow: hidden; text-overflow: ellipsis; }

.account__link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: var(--step--1);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.account__link:hover { background: var(--surface-3); color: var(--ink); }
.account__link svg { width: 16px; height: 16px; flex-shrink: 0; }
.account__link--on { background: var(--surface-3); color: var(--ink); }
.account__link--danger { color: var(--danger); }
.account__link--danger:hover { background: var(--danger-soft); color: var(--danger); }
.account__sep { height: 1px; background: var(--line); margin: 0.3rem 0; }

/*
 * On a phone the drawer is the whole navigation and it already carries the
 * account footer, so the chip would be a second way to the same six links.
 */
@media (max-width: 900px) { .account { display: none; } }

/* ------------------------------------------------------------ password field */

/*
 * A password field with its own Show button.
 *
 * The button sits inside the field's box, so the input keeps its full width and
 * the control reads as part of the field rather than as a second button next to
 * it. It reveals nothing the person typing does not already know — it is there
 * because typing a password blind on a phone keyboard is where most failed
 * sign-ins come from.
 */
.field__pw { position: relative; display: flex; }
.field__pw input { flex: 1; min-width: 0; padding-right: 3.5rem; }
.pw-toggle {
  position: absolute;
  top: 50%;
  right: 0.35rem;
  transform: translateY(-50%);
  padding: 0.3rem 0.5rem;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--brand-strong);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}
.pw-toggle:hover { background: var(--surface-3); }
[data-theme="dark"] .pw-toggle { color: var(--brand); }

/* --------------------------------------------------------- starting a thread */

/*
 * Ways to open a conversation, under the storefront's composer.
 *
 * Dashed rather than filled, and in the surface colour rather than the brand: a
 * suggestion is an offer, not the primary action, and it must not compete with
 * the send button underneath it.
 */
.composer__starters { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.55rem; }
.starter-chip {
  padding: 0.34rem 0.6rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--ink-2);
  font: inherit;
  font-size: 0.78rem;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.starter-chip:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-strong); }
[data-theme="dark"] .starter-chip:hover { color: var(--brand); }

/*
 * The day a stretch of a conversation belongs to.
 *
 * Drawn as a rule with the word in the middle, so a thread that ran over a week
 * does not read as one undifferentiated column of "2h ago".
 */
.stream__day {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.6rem 0 0.2rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.stream__day::before,
.stream__day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
