/* TradeSafe components.
 *
 * Ordering: chrome, surfaces, buttons, forms, trust, feedback, content.
 *
 * Two rules run through the whole file:
 *
 *  · Glass is structural, not decorative. It marks a layer that floats above
 *    the page — top bar, tab bar, modal, dropdown, sticky status card — so a
 *    reader can tell at a glance what is content and what is chrome. Nothing
 *    that sits *in* the page flow is translucent.
 *
 *  · Motion never moves more than a few pixels and never bounces. This is a
 *    payments interface: the feedback should read as "acknowledged", which is
 *    a small precise movement, not "look at me", which is a large one.
 */

/* =========================================================== glass recipe */

/* backdrop-filter is the whole effect; without it the surface must be opaque
 * or the text underneath shows through and contrast collapses. */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-line);
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .glass {
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
    backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--surface); }
}

/* The single highlight line along the top edge is what makes a glass panel
 * read as a physical pane catching light rather than as a flat transparency. */
.glass-hi { position: relative; }
.glass-hi::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--glass-hi) 22%, var(--glass-hi) 78%, transparent);
  pointer-events: none;
}

/* ================================================================= topbar */

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--glass-bg);
  border-bottom: 1px solid var(--line);
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .topbar {
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
    backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  }
}
.topbar-inner {
  display: flex; align-items: center; gap: .55rem;
  padding: .6rem clamp(1rem, 3vw, 1.6rem);
  max-width: var(--maxw); margin: 0 auto;
}

.brand { display: flex; align-items: center; gap: .55rem; flex: 0 0 auto; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(160deg, var(--primary-hi), var(--primary));
  color: #fff; flex: 0 0 30px;
  box-shadow: 0 2px 10px -2px color-mix(in srgb, var(--primary) 60%, transparent);
}
.brand-mark .ico { width: 17px; height: 17px; }
.brand-name { font-weight: 700; font-size: 1.05rem; letter-spacing: -.028em; white-space: nowrap; }
.brand-name b { font-weight: 700; }
.brand-name span { font-weight: 450; color: var(--ink-dim); }
/* Only the top bar drops the wordmark on a narrow phone, where it competes
 * with the search field. The footer keeps it — there is room, and a bare mark
 * with no text leaves that link with no accessible name. */
@media (max-width: 480px) { .topbar .brand-name { display: none; } }

/* The inline search field needs real room to be usable. Below 760px it would
 * be squeezed to a stub between the brand and the account controls, so it is
 * replaced by an icon that opens the browse page, where search belongs on a
 * phone anyway.
 *
 * Both selectors are scoped to .topbar-inner deliberately. A bare
 * `.only-narrow { display: none }` ties on specificity with `.iconbtn` and
 * `.btn`, which are defined further down this file — so source order would
 * silently win and the icon would show at every width. */
.searchbox { flex: 1 1 auto; position: relative; min-width: 0; max-width: 460px; }
.topbar-inner .only-narrow { display: none; }
@media (max-width: 760px) {
  .topbar-inner .searchbox { display: none; }
  .topbar-inner a.only-narrow { display: grid; }
  .topbar-inner span.only-narrow { display: block; }
}

.searchbox .ico {
  position: absolute; left: .7rem; top: 50%; transform: translateY(-50%);
  color: var(--ink-faint); pointer-events: none;
}
.searchbox input {
  width: 100%; height: var(--h); padding: 0 .85rem 0 2.3rem;
  border-radius: var(--r-full);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink);
  transition: border-color var(--dur-2) var(--ease), background var(--dur-2) var(--ease);
}
.searchbox input::placeholder { color: var(--ink-faint); }
.searchbox input:hover { border-color: var(--line-strong); }
.searchbox input:focus { background: var(--surface); border-color: var(--primary-line); outline-offset: 1px; }

.navlinks { display: none; gap: .1rem; }
@media (min-width: 1000px) { .navlinks { display: flex; } }
.navlinks a {
  display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap;
  height: var(--h); padding: 0 .7rem; border-radius: var(--r-sm);
  color: var(--ink-dim); font-size: .89rem; font-weight: 550;
  transition: color var(--dur-2) var(--ease), background var(--dur-2) var(--ease);
}
.navlinks a .ico { opacity: .75; }
.navlinks a:hover { background: var(--surface-2); color: var(--ink); }
.navlinks a.on { color: var(--ink); background: var(--surface-2); }
.navlinks a.on .ico { opacity: 1; color: var(--primary); }

/* Icon-only control. Fixed square so a row of them lines up regardless of
 * which icon is inside. */
.iconbtn {
  position: relative; display: grid; place-items: center;
  width: var(--h); height: var(--h); flex: 0 0 var(--h);
  border-radius: var(--r-sm);
  background: transparent; border: 1px solid transparent;
  color: var(--ink-dim); cursor: pointer;
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease),
              border-color var(--dur-2) var(--ease);
}
.iconbtn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.iconbtn:active { transform: scale(.96); }
.iconbtn-bordered { background: var(--surface-2); border-color: var(--line); }
.iconbtn .dot {
  position: absolute; top: 2px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: var(--r-full); background: var(--danger); color: #fff;
  font-size: .64rem; font-weight: 700; display: grid; place-items: center;
  border: 2px solid var(--bg);
}

/* The signed-in avatar chip: initials, never a stock silhouette. */
.avatar {
  display: grid; place-items: center;
  width: var(--h); height: var(--h); flex: 0 0 var(--h);
  border-radius: var(--r-full);
  background: var(--surface-3); border: 1px solid var(--line);
  font-size: .78rem; font-weight: 700; letter-spacing: .02em; color: var(--ink);
  transition: border-color var(--dur-2) var(--ease);
}
.avatar:hover { border-color: var(--primary-line); }

/* ================================================================= tabbar */

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 45;
  display: flex; justify-content: space-around;
  padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom));
  background: var(--glass-bg);
  border-top: 1px solid var(--line);
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .tabbar {
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
    backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  }
}
.tabbar a {
  flex: 1 1 0; display: grid; place-items: center; gap: 3px;
  /* 48px minimum: a payment control on a phone must be a comfortable target. */
  min-height: 48px; padding: .3rem .2rem;
  font-size: .66rem; font-weight: 550; color: var(--ink-faint);
  position: relative;
  transition: color var(--dur-2) var(--ease);
}
.tabbar a .ico { width: 21px; height: 21px; }
.tabbar a.on { color: var(--primary); }
.tabbar a.on::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 22px; height: 2px; border-radius: 0 0 2px 2px; background: var(--primary);
}
.tabbar .dot {
  position: absolute; top: 2px; right: 50%; margin-right: -18px;
  min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: var(--r-full); background: var(--danger); color: #fff;
  font-size: .6rem; font-weight: 700; display: grid; place-items: center;
}
@media (min-width: 1000px) { .tabbar { display: none; } .main { padding-bottom: 3.5rem; } }

/* =============================================================== surfaces */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 1.1rem;
}
.card-tight { padding: .75rem .85rem; }
.card-flat { background: var(--surface-2); border-color: var(--line-soft); }

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
}
.panel-head {
  padding: .85rem 1.1rem; border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: .55rem; font-weight: 620;
}
.panel-head .ico { color: var(--ink-faint); }
.panel-body { padding: 1.1rem; }
.panel-body.tight { padding: .7rem .85rem; }

/* A panel that is itself a link gets the same restrained lift as a card. */
a.panel, a.card {
  transition: border-color var(--dur-2) var(--ease), transform var(--dur-2) var(--ease),
              box-shadow var(--dur-2) var(--ease);
}
a.panel:hover, a.card:hover {
  border-color: var(--line-strong); transform: translateY(-1px); box-shadow: var(--shadow-sm);
}

.tile {
  background: var(--surface-2); border: 1px solid var(--line-soft);
  border-radius: var(--r); padding: .8rem .9rem;
}
.tile .k {
  font-size: .7rem; color: var(--ink-faint); font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
  display: flex; align-items: center; gap: .3rem;
}
.tile .v { font-size: 1.3rem; font-weight: 700; margin-top: .2rem; letter-spacing: -.02em; }

.sechead { display: flex; align-items: baseline; gap: .6rem; margin: 0 0 .85rem; flex-wrap: wrap; }
.sechead h2 { margin: 0; }
.sechead .spacer { flex: 1 1 auto; }
.sechead a { font-size: .84rem; color: var(--primary); font-weight: 600; display: inline-flex; align-items: center; gap: .25rem; }
.sechead a .ico { transition: transform var(--dur-2) var(--ease); }
.sechead a:hover .ico { transform: translateX(2px); }

.pagehead { margin: 0 0 1.4rem; }
.pagehead h1 { margin: 0 0 .2rem; }
.pagehead .sub { color: var(--ink-dim); font-size: .93rem; }

/* ============================================================ listing card */

.lcard {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg);
  transition: border-color var(--dur-2) var(--ease), transform var(--dur-2) var(--ease),
              box-shadow var(--dur-2) var(--ease);
}
.lcard:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: var(--shadow); }
.lcard:active { transform: translateY(0); }
.lcard-media {
  aspect-ratio: 16 / 10; background: var(--surface-3);
  display: grid; place-items: center; position: relative; overflow: hidden;
}
.lcard-media img { width: 100%; height: 100%; object-fit: cover; }
.lcard-media .ph { color: var(--ink-faint); opacity: .5; }
.lcard-media .ph .ico { width: 30px; height: 30px; }
.lcard-body { padding: .8rem .9rem .9rem; display: grid; gap: .45rem; }
/* Two lines, then ellipsis — one truncated line hides too much of a title
 * like "CS2 Knife — Karambit | Doppler" to shop from. */
.lcard-title {
  font-weight: 600; font-size: .95rem; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 2.7em;
}
.lcard-price { display: flex; align-items: baseline; gap: .45rem; flex-wrap: wrap; }
.price { font-weight: 700; font-size: 1.08rem; letter-spacing: -.02em; }
.price-flash { color: var(--warn); }
.lcard-seller {
  display: flex; align-items: center; gap: .35rem;
  font-size: .77rem; color: var(--ink-dim); min-width: 0;
}
.corner { position: absolute; top: .5rem; left: .5rem; display: flex; gap: .3rem; flex-wrap: wrap; max-width: calc(100% - 1rem); }

/* ================================================================ badges */

.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .5rem; border-radius: var(--r-full);
  font-size: .715rem; font-weight: 620; letter-spacing: .005em; white-space: nowrap;
  background: var(--surface-3); color: var(--ink-dim); border: 1px solid var(--line);
}
.badge .ico { width: 13px; height: 13px; flex: 0 0 13px; }
.badge-primary { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-line); }
.badge-good { background: var(--success-soft); color: var(--success); border-color: var(--success-line); }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.badge-solid { background: var(--primary); color: var(--primary-ink); border-color: transparent; }

.dot-online, .dot-off { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.dot-online { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.dot-off { background: var(--ink-faint); opacity: .55; }

/* =============================================================== buttons */

/* One geometry for every button in the product. Variants change colour and
 * weight only — never height, radius, padding or type size, because a row of
 * buttons that disagree on those is the single loudest "template" tell. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  height: var(--h); padding: 0 1rem;
  border-radius: var(--r); cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line);
  font-weight: 600; font-size: .9rem; color: var(--ink);
  white-space: nowrap; text-align: center;
  transition: background var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease),
              transform var(--dur-1) var(--ease), box-shadow var(--dur-2) var(--ease),
              filter var(--dur-2) var(--ease);
}
.btn .ico { flex: 0 0 auto; }
.btn:hover { background: var(--surface-3); border-color: var(--line-strong); }
/* Press: 1px of travel. Enough to feel mechanical, too little to look bouncy. */
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }

/* Primary carries a single soft highlight along its top edge — the same
 * light-catch idea as the glass panels, at button scale. */
.btn-primary {
  background: linear-gradient(180deg, var(--primary-hi), var(--primary));
  color: var(--primary-ink); border-color: transparent;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset,
              0 4px 14px -6px color-mix(in srgb, var(--primary) 70%, transparent);
}
.btn-primary:hover { filter: brightness(1.07); border-color: transparent; }
.btn-primary:active { filter: brightness(.97); }

.btn-secondary { background: var(--surface-2); border-color: var(--line-strong); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-dim); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.btn-success {
  background: var(--success); color: #04231a; border-color: transparent;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .16) inset;
}
.btn-success:hover { filter: brightness(1.06); }
/* Danger is a bordered tint, not a filled red block: destructive actions here
 * are legitimate and common (cancel, remove, decline) and a wall of solid red
 * would make an ordinary marketplace look alarming. */
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 20%, transparent); border-color: var(--danger); }

.btn-sm { height: var(--h-sm); padding: 0 .7rem; font-size: .82rem; border-radius: var(--r-sm); gap: .3rem; }
.btn-lg { height: var(--h-lg); padding: 0 1.4rem; font-size: .97rem; border-radius: var(--r); }
.btn-block { width: 100%; }

/* Button loading state: the label stays put and the spinner replaces the
 * icon slot, so the button does not resize and the row does not reflow. */
.btn[data-loading] { pointer-events: none; opacity: .8; }
.btn[data-loading] .ico { display: none; }
.btn[data-loading]::before {
  content: ""; width: 15px; height: 15px; flex: 0 0 15px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: spin .7s linear infinite;
}

/* Signed out on a small phone, the primary "create account" button is the one
 * that has to survive; log in is one tap away from that screen. Scoped to the
 * bar and placed after .btn so it actually beats `.btn { display:inline-flex }`
 * — same specificity otherwise, and source order would silently win. */
@media (max-width: 520px) { .topbar-inner .nav-login { display: none; } }

.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  height: var(--h-sm); padding: 0 .75rem; border-radius: var(--r-full);
  cursor: pointer; font-size: .82rem; font-weight: 570;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-dim);
  white-space: nowrap;
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease),
              border-color var(--dur-2) var(--ease);
}
.chip:hover { color: var(--ink); border-color: var(--line-strong); }
.chip .ico { width: 14px; height: 14px; }
.chip.on { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-line); }
.chiprow {
  display: flex; gap: .45rem; overflow-x: auto; padding-bottom: .35rem;
  scrollbar-width: thin; scroll-snap-type: x proximity;
}
.chiprow > * { scroll-snap-align: start; }

/* ================================================================= forms */

.field { display: grid; gap: .35rem; }
.field label, .flabel { font-size: .82rem; color: var(--ink-dim); font-weight: 600; }
.input, .field input, .field select, .field textarea {
  width: 100%; height: var(--h); padding: 0 .8rem;
  border-radius: var(--r); background: var(--surface-2);
  border: 1px solid var(--line); color: var(--ink);
  transition: border-color var(--dur-2) var(--ease), background var(--dur-2) var(--ease),
              box-shadow var(--dur-2) var(--ease);
}
.field input[type="file"] { height: auto; padding: .5rem .7rem; }
.field input[type="checkbox"], .field input[type="radio"] { width: auto; height: auto; accent-color: var(--primary); }
.field textarea { height: auto; min-height: 96px; padding: .6rem .8rem; resize: vertical; line-height: 1.55; }
.field select { appearance: none; padding-right: 2rem; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-faint) 50%),
                    linear-gradient(135deg, var(--ink-faint) 50%, transparent 50%);
  background-position: right 1.05rem center, right .8rem center;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.input:hover, .field input:hover, .field select:hover, .field textarea:hover { border-color: var(--line-strong); }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  background: var(--surface); border-color: var(--primary-line);
}
.field input::placeholder, .field textarea::placeholder { color: var(--ink-faint); }
.field .hint { font-size: .765rem; color: var(--ink-faint); }
.field[data-invalid] input, .field[data-invalid] select { border-color: var(--danger-line); }

.form-grid { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.form-grid > * { min-width: 0; }

/* Input with a trailing control (password reveal). The button is inside the
 * field box, so the hit area never overlaps the text caret. */
.field-affix { position: relative; }
.field-affix input { padding-right: 2.9rem; }
.field-affix .affix {
  position: absolute; right: .3rem; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 0; background: transparent; color: var(--ink-faint);
  border-radius: var(--r-sm); cursor: pointer;
  transition: color var(--dur-2) var(--ease), background var(--dur-2) var(--ease);
}
.field-affix .affix:hover { color: var(--ink); background: var(--surface-3); }

.err {
  color: var(--danger); font-size: .85rem;
  display: flex; align-items: flex-start; gap: .4rem;
}
.err:empty { display: none; }
.err .ico { flex: 0 0 auto; margin-top: .15rem; }

/* --- password strength ---------------------------------------------------
 * Four segments rather than one bar: a discrete ladder communicates "you are
 * two steps from strong" better than a continuous fill, and it cannot be
 * misread as a percentage of anything. */
.pw-meter { display: grid; gap: .3rem; }
.pw-track { display: flex; gap: 4px; }
.pw-track i {
  flex: 1 1 0; height: 4px; border-radius: 2px; background: var(--surface-3);
  transition: background var(--dur-2) var(--ease);
}
.pw-track[data-score="1"] i:nth-child(-n+1) { background: var(--danger); }
.pw-track[data-score="2"] i:nth-child(-n+2) { background: var(--warn); }
.pw-track[data-score="3"] i:nth-child(-n+3) { background: var(--primary); }
.pw-track[data-score="4"] i { background: var(--success); }
.pw-label { font-size: .765rem; color: var(--ink-faint); display: flex; justify-content: space-between; gap: .5rem; }

/* --- toggle --------------------------------------------------------------
 * A real checkbox underneath, so keyboard, label clicks and form semantics
 * come for free; the visual is drawn from the input's checked/focus state. */
.toggle { display: inline-flex; align-items: center; gap: .65rem; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle .track {
  position: relative; width: 46px; height: 27px; flex: 0 0 46px;
  border-radius: var(--r-full);
  background: var(--surface-3); border: 1px solid var(--line);
  transition: background var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease);
}
.toggle .track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 21px; height: 21px; border-radius: 50%;
  background: linear-gradient(180deg, #fff, #dfe5ee);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
  /* The thumb eases with a slight overshoot-free curve — OS-toggle feel. */
  transition: transform var(--dur-2) var(--ease), width var(--dur-2) var(--ease);
}
.toggle input:checked + .track { background: var(--primary); border-color: transparent; }
.toggle input:checked + .track::after { transform: translateX(19px); }
/* Press squeezes the thumb rather than scaling the whole control. */
.toggle:active .track::after { width: 25px; }
.toggle input:checked:active + .track::after { transform: translateX(15px); }
.toggle input:focus-visible + .track { outline: 2px solid var(--primary); outline-offset: 2px; }
.toggle .tlabel { font-size: .9rem; font-weight: 550; }

/* ================================================================= trust */

/* Trust XP. The bar is a progression, so it fills from left and animates its
 * width on first paint; the number beside it is always the real XP. */
.xp-card { display: grid; gap: .75rem; }
.xp-top { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.xp-level {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .7rem; border-radius: var(--r-full);
  background: var(--primary-soft); color: var(--primary); border: 1px solid var(--primary-line);
  font-weight: 650; font-size: .85rem;
}
.xp-level.lv-elite { background: var(--success-soft); color: var(--success); border-color: var(--success-line); }
.xp-value { font-size: 1.45rem; font-weight: 700; letter-spacing: -.025em; }
.xp-value span { font-size: .8rem; font-weight: 600; color: var(--ink-faint); letter-spacing: 0; }

.xp-track {
  height: 8px; border-radius: var(--r-full); background: var(--surface-3);
  overflow: hidden; border: 1px solid var(--line-soft);
}
.xp-track > i {
  display: block; height: 100%; border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--primary), var(--success));
  transition: width 700ms var(--ease);
}
.xp-next { font-size: .8rem; color: var(--ink-faint); }

/* Factor rows: what actually moved the number. Shown because an unexplainable
 * trust figure is worth less than none. */
.xp-factor { display: grid; grid-template-columns: 1fr auto; gap: .5rem .8rem; align-items: center; font-size: .85rem; }
.xp-factor .bar { grid-column: 1 / -1; height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.xp-factor .bar > i { display: block; height: 100%; background: var(--primary); border-radius: 3px; transition: width 600ms var(--ease); }

/* A trust indicator is a statement of fact about this trade or this account.
 * It gets an icon, a border and a tint — never a glow. */
.trustline {
  display: flex; align-items: center; gap: .55rem;
  padding: .65rem .85rem; border-radius: var(--r);
  font-size: .87rem; font-weight: 550;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-dim);
}
.trustline .ico { flex: 0 0 auto; }
.trustline strong { font-weight: 650; color: var(--ink); }
.trust-safe { background: var(--success-soft); border-color: var(--success-line); color: var(--success); }
.trust-safe strong { color: var(--success); }
.trust-info { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary); }
.trust-info strong { color: var(--primary); }
.trust-warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.trust-warn strong { color: var(--warn); }
.trust-risk { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.trust-risk strong { color: var(--danger); }

/* Escrow / transaction progression: pending -> processing -> completed. */
.steps { display: grid; gap: 0; }
.steps li { display: grid; grid-template-columns: 22px 1fr; gap: .7rem; list-style: none; padding-bottom: 1rem; position: relative; }
.steps li:last-child { padding-bottom: 0; }
.steps li::before {
  content: ""; position: absolute; left: 10px; top: 22px; bottom: 0; width: 2px;
  background: var(--line); border-radius: 1px;
}
.steps li:last-child::before { display: none; }
.steps .pip {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-3); border: 1px solid var(--line); color: var(--ink-faint);
  position: relative; z-index: 1;
}
.steps .pip .ico { width: 12px; height: 12px; }
.steps li.done .pip { background: var(--success-soft); border-color: var(--success-line); color: var(--success); }
.steps li.done::before { background: var(--success-line); }
.steps li.now .pip { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
/* The active step breathes, very slightly — the one place a loop is allowed,
 * because "still in progress" is a state the user may sit and watch. */
.steps li.now .pip::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 1px solid var(--primary); opacity: .5;
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse { 50% { transform: scale(1.12); opacity: .12; } }
.steps .label { font-size: .89rem; font-weight: 600; }
.steps .when { font-size: .765rem; color: var(--ink-faint); }

.spark { display: flex; align-items: flex-end; gap: 2px; height: 34px; }
.spark i { flex: 1 1 auto; min-width: 3px; background: var(--primary-soft); border-radius: 2px 2px 0 0; }
.spark i:last-child { background: var(--primary); }

/* =============================================================== feedback */

/* Skeletons, not spinners: a shimmer that matches the shape of the content
 * about to arrive tells the reader what is loading and stops the layout
 * jumping when it does. */
.sk {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: var(--r-sm);
}
.sk-line { height: 12px; }
.sk-line.w-40 { width: 40%; } .sk-line.w-60 { width: 60%; } .sk-line.w-80 { width: 80%; }
.sk-title { height: 20px; width: 45%; border-radius: var(--r-sm); }
.sk-card { border-radius: var(--r-lg); border: 1px solid var(--line); overflow: hidden; background: var(--surface); }
.sk-media { aspect-ratio: 16 / 10; }
.sk-body { padding: .8rem .9rem .9rem; display: grid; gap: .5rem; }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; background: var(--surface-2); } }

.empty {
  display: grid; place-items: center; gap: .55rem; text-align: center;
  padding: 3rem 1.2rem; color: var(--ink-dim);
  border: 1px dashed var(--line); border-radius: var(--r-lg); background: var(--surface);
}
.empty .emblem {
  width: 46px; height: 46px; border-radius: var(--r); display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-faint);
  margin-bottom: .2rem;
}
.empty .emblem .ico { width: 22px; height: 22px; }
.empty .etitle { font-weight: 620; color: var(--ink); font-size: 1rem; }
.empty .ebody { font-size: .87rem; max-width: 38ch; }
.empty .btn { margin-top: .5rem; }

.toasts {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 84px; z-index: 70;
  display: grid; gap: .45rem; width: min(420px, 92vw); pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: .55rem;
  padding: .7rem .9rem; border-radius: var(--r); font-size: .88rem; font-weight: 550;
  background: var(--glass-bg); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg); color: var(--ink);
  animation: view-in var(--dur-3) var(--ease-out);
  pointer-events: auto;
}
@supports (backdrop-filter: blur(1px)) {
  .toast { backdrop-filter: blur(var(--glass-blur)) saturate(160%); -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%); }
}
.toast .ico { flex: 0 0 auto; }
.toast.good { border-color: var(--success-line); }
.toast.good .ico { color: var(--success); }
.toast.err { border-color: var(--danger-line); }
.toast.err .ico { color: var(--danger); }
@media (min-width: 1000px) { .toasts { bottom: 24px; } }

/* ================================================================ modals */

.modal-root:empty { display: none; }
.modal-back {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(3, 6, 12, .62);
  display: grid; place-items: center; padding: 1rem; overflow-y: auto;
  animation: fade-in var(--dur-2) var(--ease-out);
}
@supports (backdrop-filter: blur(1px)) {
  .modal-back { backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
}
.modal {
  width: min(520px, 100%);
  background: var(--glass-bg); border: 1px solid var(--glass-line);
  border-radius: var(--r-xl); box-shadow: var(--shadow-lg); padding: 1.25rem;
  max-height: 92dvh; overflow-y: auto;
  animation: view-in var(--dur-3) var(--ease-out);
}
@supports (backdrop-filter: blur(1px)) {
  .modal { backdrop-filter: blur(26px) saturate(170%); -webkit-backdrop-filter: blur(26px) saturate(170%); }
}
@supports not (backdrop-filter: blur(1px)) { .modal { background: var(--surface); } }
.modal-head { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.modal-head h3 { margin: 0; flex: 1 1 auto; }

/* ================================================================ content */

.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th, .table td { padding: .6rem .65rem; text-align: left; border-bottom: 1px solid var(--line-soft); }
.table th { color: var(--ink-faint); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 650; }
.table tr:last-child td { border-bottom: 0; }

.timeline { display: grid; gap: .6rem; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 10px 1fr; gap: .65rem; list-style: none; align-items: start; }
.timeline .pip { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: .45rem; }

.hero {
  border-radius: var(--r-xl); padding: clamp(1.4rem, 3.5vw, 2.6rem);
  background:
    radial-gradient(90% 120% at 0% 0%, color-mix(in srgb, var(--primary) 13%, transparent), transparent 62%),
    var(--surface);
  border: 1px solid var(--line);
  position: relative; overflow: hidden;
}
.hero h1 { max-width: 20ch; }
.hero .lede { color: var(--ink-dim); font-size: clamp(.95rem, .9rem + .3vw, 1.06rem); max-width: 54ch; }
.hero-proof { display: flex; gap: .5rem 1.1rem; flex-wrap: wrap; margin-top: 1.3rem; }
.hero-proof span { display: inline-flex; align-items: center; gap: .4rem; font-size: .84rem; color: var(--ink-dim); font-weight: 550; }
.hero-proof .ico { color: var(--success); }

.rankno { width: 26px; text-align: center; font-weight: 700; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.rank-1 { color: #e3b341; } .rank-2 { color: #b6c0cd; } .rank-3 { color: #c98a54; }

.countdown { font-variant-numeric: tabular-nums; font-weight: 650; }

.stars { display: inline-flex; gap: 1px; color: var(--warn); }
.stars .ico { width: 14px; height: 14px; }
.stars .off { color: var(--ink-faint); opacity: .4; }

/* Star picker in the review dialog. */
.starpick { display: flex; gap: .2rem; }
.starpick button {
  background: transparent; border: 0; cursor: pointer; padding: .2rem;
  color: var(--ink-faint); border-radius: var(--r-xs);
  transition: color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}
.starpick button .ico { width: 26px; height: 26px; }
.starpick button.on { color: var(--warn); }
.starpick button:hover { transform: scale(1.08); }

/* --- storefront ---------------------------------------------------------- */

.store-banner {
  height: clamp(120px, 22vw, 210px); border-radius: var(--r-lg);
  background: linear-gradient(120deg, var(--surface-3), var(--surface-2));
  background-size: cover; background-position: center; position: relative; overflow: hidden;
}
.store-head { display: flex; gap: 1rem; align-items: flex-end; margin-top: -36px; padding: 0 .9rem; position: relative; }
.store-logo {
  width: 72px; height: 72px; flex: 0 0 72px; border-radius: var(--r-lg);
  background: var(--surface-3); border: 3px solid var(--bg);
  display: grid; place-items: center; font-size: 1.6rem; font-weight: 700; overflow: hidden;
}
.store-logo img { width: 100%; height: 100%; object-fit: cover; }

/* Seller storefront accents. Kept deliberately desaturated: a store may put
 * its stamp on its own page, but not to the point where the surrounding
 * TradeSafe chrome stops looking like TradeSafe. */
.theme-indigo { --primary: #7c8cff; --primary-line: rgba(124, 140, 255, .34); --primary-soft: rgba(124, 140, 255, .14); }
.theme-teal   { --primary: #3fb8ac; --primary-line: rgba(63, 184, 172, .34); --primary-soft: rgba(63, 184, 172, .14); }
.theme-amber  { --primary: #d99b4a; --primary-line: rgba(217, 155, 74, .34); --primary-soft: rgba(217, 155, 74, .14); }
.theme-rose   { --primary: #d9738b; --primary-line: rgba(217, 115, 139, .34); --primary-soft: rgba(217, 115, 139, .14); }
.theme-slate  { --primary: #93a3b8; --primary-line: rgba(147, 163, 184, .34); --primary-soft: rgba(147, 163, 184, .14); }

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

.chat { display: grid; grid-template-rows: auto 1fr auto; height: calc(100dvh - 210px); min-height: 400px; }
.chat-log { overflow-y: auto; padding: .9rem; display: grid; gap: .5rem; align-content: start; }
.bubble {
  max-width: min(78%, 460px); padding: .55rem .75rem; border-radius: var(--r-lg);
  background: var(--surface-2); border: 1px solid var(--line-soft);
  animation: view-in var(--dur-2) var(--ease-out);
}
.bubble.me { justify-self: end; background: var(--primary-soft); border-color: var(--primary-line); }
.bubble img { border-radius: var(--r-sm); margin-top: .4rem; }
.chat-compose { display: flex; gap: .5rem; padding: .65rem; border-top: 1px solid var(--line-soft); align-items: center; }
.chat-compose input[type="text"], .chat-compose .input { flex: 1 1 auto; min-width: 0; }
.typing { font-size: .77rem; color: var(--primary); padding: 0 .9rem .3rem; height: 1.2rem; }

/* --- legal pages --------------------------------------------------------- */

/* Terms and Privacy are long. They are broken into numbered cards with a
 * sticky index beside them, because a 22-section wall of text is functionally
 * unread — and an unread agreement is a trust problem, not a legal win. */
.legal { display: grid; gap: 1.6rem; grid-template-columns: 240px minmax(0, 1fr); align-items: start; }
@media (max-width: 900px) { .legal { grid-template-columns: minmax(0, 1fr); } }
.legal-index { position: sticky; top: 76px; display: grid; gap: .1rem; max-height: calc(100dvh - 100px); overflow-y: auto; }
@media (max-width: 900px) { .legal-index { position: static; max-height: none; } }
.legal-index a {
  display: block; padding: .35rem .6rem; border-radius: var(--r-sm);
  font-size: .82rem; color: var(--ink-faint); line-height: 1.35;
  transition: color var(--dur-2) var(--ease), background var(--dur-2) var(--ease);
}
.legal-index a:hover { color: var(--ink); background: var(--surface-2); }
.legal-sec { scroll-margin-top: 80px; }
.legal-sec h2 {
  display: flex; align-items: baseline; gap: .6rem; font-size: 1.08rem; margin-bottom: .5rem;
}
.legal-sec h2 .n {
  font-size: .78rem; font-weight: 700; color: var(--primary);
  font-variant-numeric: tabular-nums; flex: 0 0 auto;
}
.legal-sec p, .legal-sec li { color: var(--ink-dim); font-size: .92rem; }
.legal-sec ul { margin: 0 0 .8em; padding-left: 1.1rem; display: grid; gap: .3rem; }
/* Placeholders the operator must fill in before this is a real agreement.
 * Marked loudly on purpose so they cannot ship unnoticed. */
.legal-todo {
  display: block; padding: .6rem .8rem; border-radius: var(--r);
  background: var(--warn-soft); border: 1px dashed var(--warn-line); color: var(--warn);
  font-size: .84rem; font-weight: 550;
}

/* --- footer -------------------------------------------------------------- */

.footer { border-top: 1px solid var(--line); margin-top: 3rem; padding: 2rem 0 5.5rem; color: var(--ink-faint); }
@media (min-width: 1000px) { .footer { padding-bottom: 2.5rem; } }
.footer-cols { display: grid; gap: 1.6rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.footer h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); margin-bottom: .6rem; }
.footer a { display: block; font-size: .87rem; color: var(--ink-dim); padding: .2rem 0; }
.footer a:hover { color: var(--ink); }
.footer .legalnote { font-size: .78rem; margin-top: 1.6rem; max-width: 62ch; line-height: 1.6; }
