/* ============================================================
   MM · Marketplace — design system + app shell
   ============================================================ */

/* ---------------- Tokens ---------------- */
:root {
  color-scheme: light dark;

  --accent:      #4f46e5;
  --accent-ink:  #ffffff;
  --accent-soft: #eef0ff;

  --bg:        #fafafb;
  --surface:   #ffffff;
  --surface-2: #f4f4f7;

  --text:  #0f1115;
  --muted: #6b7280;
  --line:  #e9e9ef;

  --ok:      #0f9d58;
  --ok-soft: #e7f6ee;
  --warn:      #b45309;
  --warn-soft: #fdf3e3;
  --danger:      #dc2626;
  --danger-soft: #fdecec;

  --radius:    16px;
  --radius-sm: 10px;
  --radius-xs: 8px;

  --shadow-sm: 0 1px 2px rgba(15, 17, 21, .05);
  --shadow:    0 1px 2px rgba(15, 17, 21, .04),
               0 10px 30px -12px rgba(15, 17, 21, .16);

  --sidebar-w: 248px;
  --topbar-h:  60px;
  --tabbar-h:  62px;
  --content-max: 1080px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent:      #8b87ff;
    --accent-ink:  #0b0b12;
    --accent-soft: #1a1a2b;

    --bg:        #08080b;
    --surface:   #101014;
    --surface-2: #17171d;

    --text:  #f3f3f7;
    --muted: #9898a6;
    --line:  #22222b;

    --ok:      #34d399;
    --ok-soft: #0e2a20;
    --warn:      #fbbf24;
    --warn-soft: #2a2110;
    --danger:      #f87171;
    --danger-soft: #2a1414;

    --shadow: 0 1px 2px rgba(0, 0, 0, .5),
              0 10px 30px -12px rgba(0, 0, 0, .65);
  }
}

/* ---------------- Reset ---------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: var(--accent); color: var(--accent-ink); }

/* ---------------- App shell ---------------- */
body.app {
  display: flex;
  min-height: 100dvh;
  background: var(--bg);
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 18px 16px 32px;
}

/* ---- Sidebar (desktop) ---- */
.sidebar { display: none; }

/* ---- Topbar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 16px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.page-title {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -.02em;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* ---- Tabbar (mobile) ---- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: flex;
  align-items: stretch;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--line);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 550;
  letter-spacing: .01em;
  color: var(--muted);
  transition: color .16s var(--ease);
  position: relative;
}

.tab svg { width: 21px; height: 21px; }
.tab.is-active { color: var(--accent); }
.tab.is-active::before {
  content: "";
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 26px; height: 2.5px;
  border-radius: 0 0 3px 3px;
  background: var(--accent);
}

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -.01em;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .1s var(--ease), background .16s var(--ease),
              border-color .16s var(--ease), opacity .16s var(--ease);
}
.btn:active { transform: scale(.975); }
.btn:disabled { opacity: .55; pointer-events: none; }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }

.btn-ghost {
  background: transparent;
  border-color: var(--line);
}
.btn-ghost:hover { background: var(--surface-2); }

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.btn-danger:hover { background: color-mix(in srgb, var(--danger-soft) 80%, var(--danger)); }

.btn-block { width: 100%; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------------- Avatars ---------------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 36px; height: 36px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #7c6cf5);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
  user-select: none;
}
.avatar-lg { width: 72px; height: 72px; font-size: 25px; }

/* ---------------- Cards & surfaces ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stack { display: flex; flex-direction: column; gap: 12px; }

/* ---------------- Forms ---------------- */
.field { display: block; margin-bottom: 14px; }

.field > span {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.input::placeholder { color: var(--muted); opacity: .7; }
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3.5px var(--accent-soft);
}
.input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3.5px var(--danger-soft);
}

.field-error {
  display: none;
  margin-top: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--danger);
}
.field-error.is-shown { display: block; }

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.check input {
  width: 17px; height: 17px;
  accent-color: var(--accent);
  cursor: pointer;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 18px;
}
.row-between a { font-size: 13.5px; font-weight: 600; color: var(--accent); }

/* ---------------- Auth pages ---------------- */
body.auth {
  display: grid;
  min-height: 100dvh;
  background: var(--bg);
}

.auth-wrap {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100dvh;
}

.auth-aside { display: none; }

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
}

.auth-card { width: 100%; max-width: 400px; }

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  font-weight: 700;
  letter-spacing: -.02em;
}

.auth-card h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.03em;
  margin-bottom: 6px;
}

.auth-card .sub {
  font-size: 14.5px;
  color: var(--muted);
  margin-bottom: 26px;
}

.auth-alt {
  margin-top: 22px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}
.auth-alt a { font-weight: 650; color: var(--accent); }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  font-size: 12.5px;
  color: var(--muted);
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ---------------- Brand mark ---------------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -.02em;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.brand-name { font-size: 15.5px; }

/* ---------------- Search & chips ---------------- */
.searchbar {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 14px;
}
.searchbar svg {
  position: absolute;
  left: 14px;
  width: 17px; height: 17px;
  color: var(--muted);
  pointer-events: none;
}
.searchbar .input {
  height: 48px;
  padding-left: 42px;
  border-radius: 999px;
  background: var(--surface);
}

.chips {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  transition: all .16s var(--ease);
}
.chip:hover { color: var(--text); }
.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* ---------------- Listing grid ---------------- */
.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.listing {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease),
              border-color .18s var(--ease);
}
.listing:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--line) 50%, var(--accent));
}

.thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.03em;
  color: rgba(255, 255, 255, .92);
  background: linear-gradient(135deg, var(--g1, #6366f1), var(--g2, #a855f7));
  user-select: none;
}

.badge {
  position: absolute;
  top: 8px; left: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(8, 8, 12, .58);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .02em;
}

.listing-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px 12px;
  flex: 1;
}

.listing-title {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.listing-meta {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.price {
  margin-top: auto;
  padding-top: 7px;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -.02em;
}

/* ---------------- Orders ---------------- */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  border-radius: 999px;
  background: var(--surface-2);
}
.tab-pill {
  flex: 1;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .16s var(--ease);
}
.tab-pill.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.order {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .16s var(--ease);
}
.order:hover { border-color: color-mix(in srgb, var(--line) 50%, var(--accent)); }

.order-thumb {
  flex: none;
  width: 54px; height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 800;
  color: rgba(255, 255, 255, .92);
  background: linear-gradient(135deg, var(--g1, #6366f1), var(--g2, #a855f7));
}

.order-main { flex: 1; min-width: 0; }
.order-id {
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.order-title {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -.01em;
  margin: 2px 0 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.order-sub { font-size: 12.5px; color: var(--muted); }
.order-price { font-size: 15px; font-weight: 700; letter-spacing: -.02em; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: .01em;
  white-space: nowrap;
}
.pill::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 999px;
  background: currentColor;
}
.pill-ok   { background: var(--ok-soft);   color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-mute { background: var(--surface-2); color: var(--muted); }

/* ---------------- Messages ---------------- */
.inbox {
  display: grid;
  grid-template-columns: 1fr;
  min-height: calc(100dvh - var(--topbar-h) - var(--tabbar-h) - 52px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.threads { display: flex; flex-direction: column; }

.thread {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background .14s var(--ease);
}
.thread:hover { background: var(--surface-2); }
.thread.is-active { background: var(--accent-soft); }

.thread-main { flex: 1; min-width: 0; }
.thread-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.thread-name {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thread-time { flex: none; font-size: 11.5px; color: var(--muted); }
.thread-preview {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.thread.unread .thread-preview { color: var(--text); font-weight: 550; }

.unread-dot {
  flex: none;
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--accent);
}

/* Chat pane */
.chat {
  display: none;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.chat-head .thread-name { font-size: 14.5px; }

.chat-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 14px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.bubble {
  max-width: 76%;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
}
.bubble-in {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom-left-radius: 5px;
}
.bubble-out {
  align-self: flex-end;
  background: var(--accent);
  color: var(--accent-ink);
  border-bottom-right-radius: 5px;
}

.composer {
  display: flex;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.composer .input { height: 42px; border-radius: 999px; }
.composer .btn { border-radius: 999px; padding: 0 15px; }

.back-btn { display: inline-flex; }
body:not(.chat-open) .chat { display: none; }
body.chat-open .threads { display: none; }
body.chat-open .chat { display: flex; }

/* ---------------- Profile ---------------- */
.profile-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 14px;
}
.profile-name {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.025em;
}
.profile-handle { font-size: 13.5px; color: var(--muted); margin-top: 1px; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.stat {
  padding: 14px 10px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.stat b {
  display: block;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.03em;
}
.stat span { font-size: 11.5px; color: var(--muted); font-weight: 550; }

.list-group {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 18px;
}

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  font-size: 14.5px;
  font-weight: 550;
  cursor: pointer;
  transition: background .14s var(--ease);
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-2); }
.list-row svg { width: 19px; height: 19px; color: var(--muted); flex: none; }
.list-row .chev { margin-left: auto; color: var(--muted); }
.list-row .value { margin-left: auto; font-size: 13.5px; color: var(--muted); font-weight: 500; }

.section-label {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px 4px;
}

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom));
  transform: translate(-50%, 14px);
  z-index: 90;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 13.5px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s var(--ease), transform .22s var(--ease);
}
.toast.is-shown { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- Utilities ---------------- */
.empty {
  padding: 48px 20px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------- Desktop breakpoint ---------------- */
@media (min-width: 900px) {

  .sidebar {
    display: flex;
    flex-direction: column;
    flex: none;
    width: var(--sidebar-w);
    position: sticky;
    top: 0;
    height: 100dvh;
    padding: 18px 14px;
    background: var(--surface);
    border-right: 1px solid var(--line);
  }

  .sidebar .brand { padding: 0 8px; margin-bottom: 24px; }

  .nav { display: flex; flex-direction: column; gap: 2px; }

  .nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    height: 42px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    font-size: 14.5px;
    font-weight: 550;
    color: var(--muted);
    transition: background .14s var(--ease), color .14s var(--ease);
  }
  .nav-item svg { width: 19px; height: 19px; flex: none; }
  .nav-item:hover { background: var(--surface-2); color: var(--text); }
  .nav-item.is-active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 650;
  }

  .nav-count {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 11px;
    font-weight: 700;
  }

  .side-foot {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--line);
  }

  .side-user {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    text-align: left;
    transition: background .14s var(--ease);
  }
  .side-user:hover { background: var(--surface-2); }
  .side-user-main { flex: 1; min-width: 0; }
  .side-user-name {
    font-size: 13.5px;
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .side-user-sub { font-size: 12px; color: var(--muted); }

  .tabbar { display: none; }
  .content { padding: 22px 28px 40px; }

  .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }

  /* Messages two-pane */
  .inbox {
    grid-template-columns: 320px 1fr;
    min-height: calc(100dvh - var(--topbar-h) - 84px);
  }
  .threads {
    border-right: 1px solid var(--line);
    overflow-y: auto;
  }
  .chat { display: flex; }
  .back-btn { display: none; }
  body.chat-open .threads { display: flex; }

  /* Auth split screen */
  .auth-wrap { grid-template-columns: 1fr 1fr; }

  .auth-aside {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 44px;
    background: linear-gradient(150deg, #4f46e5 0%, #7c3aed 55%, #a855f7 100%);
    color: #fff;
  }
  .auth-aside .brand-mark { background: rgba(255, 255, 255, .18); color: #fff; }
  .auth-aside h2 {
    font-size: 34px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -.035em;
    max-width: 15ch;
    margin-bottom: 14px;
  }
  .auth-aside p {
    font-size: 15.5px;
    line-height: 1.6;
    color: rgba(255, 255, 255, .8);
    max-width: 34ch;
  }
  .auth-feats { display: flex; flex-direction: column; gap: 14px; margin-top: 30px; }
  .auth-feat {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14.5px;
    font-weight: 500;
    color: rgba(255, 255, 255, .92);
  }
  .auth-feat svg { width: 20px; height: 20px; flex: none; }

  .auth-panel { padding: 44px; }

  .toast { bottom: 28px; }
}

/* ---------------- Reduced motion ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
  .listing:hover { transform: none; }
}


/* ---------------- Product page ---------------- */
.product { display: flex; flex-direction: column; gap: 14px; }

.hero {
  position: relative;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(135deg, var(--g1, #6366f1), var(--g2, #a855f7));
}
.hero-mono {
  font-size: 68px;
  font-weight: 800;
  letter-spacing: -.05em;
  color: rgba(255, 255, 255, .92);
  user-select: none;
}

.product-head { display: flex; flex-direction: column; gap: 6px; }
.product-title {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.25;
}
.product-price {
  font-size: 26px;
  font-weight: 750;
  letter-spacing: -.035em;
}
.product-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}

.seller-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.seller-main { flex: 1; min-width: 0; }
.seller-name { font-size: 14.5px; font-weight: 650; letter-spacing: -.01em; }
.seller-sub  { font-size: 12.5px; color: var(--muted); }

.panel {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.panel-title {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}
.desc {
  margin-top: 8px;
  font-size: 14.5px;
  line-height: 1.6;
}

.variant-group + .variant-group {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.variant-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.chosen { font-size: 13px; font-weight: 600; color: var(--accent); }

.opts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.opt {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  transition: background .16s var(--ease), border-color .16s var(--ease),
              color .16s var(--ease);
}
.opt:hover { border-color: var(--accent); }
.opt.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
}

.qty {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-top: 10px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.qty-btn {
  width: 36px; height: 36px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background .14s var(--ease), opacity .14s var(--ease);
}
.qty-btn:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }
.qty-btn:disabled { opacity: .35; cursor: not-allowed; }
.qty-input {
  width: 46px; height: 36px;
  border: 0;
  background: transparent;
  text-align: center;
  font-size: 15px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* Sticky purchase bar */
.buy-bar {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 16px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.buy-total { display: flex; flex-direction: column; }
.buy-label {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}
.buy-total strong { font-size: 19px; font-weight: 750; letter-spacing: -.03em; }
.buy-bar .btn { flex: 1; height: 46px; }

.has-buybar .content {
  padding-bottom: calc(var(--tabbar-h) + 92px + env(safe-area-inset-bottom));
}

@media (min-width: 900px) {
  .hero { aspect-ratio: 16 / 9; }
  .hero-mono { font-size: 96px; }

  .buy-bar {
    position: static;
    left: auto;
    bottom: auto;
    max-width: var(--content-max);
    width: 100%;
    margin: 0 auto;
    padding: 0 28px 36px;
    background: transparent;
    border-top: 0;
    justify-content: flex-end;
  }
  .buy-bar .btn { flex: none; min-width: 200px; }
  .buy-total { margin-right: auto; }

  .has-buybar .content { padding-bottom: 22px; }
}

/* ---------------- Topbar search ---------------- */
.topbar-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.topbar-search svg {
  position: absolute;
  left: 13px;
  width: 17px; height: 17px;
  color: var(--muted);
  pointer-events: none;
}
.topbar-search .input {
  height: 40px;
  padding-left: 39px;
  border-radius: 999px;
  background: var(--surface);
  font-size: 14.5px;
}