/* Продавашка.рф — design system */
/* Inter with Cyrillic (Google Fonts serves cyrillic unicode-range) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #1A1A2E;
  --cta: #FF4C29;
  --cta-hover: #E63E1F;
  --bg: #F5F5F7;
  --card: #FFFFFF;
  --text: #1A1A2E;
  --muted: #8E8E93;
  --success: #34C759;
  --price: #34C759;
  --border: #E5E5EA;
  --amber: #F5A623;
  --amber-bg: #FFF8E7;
  --free-bg: #E8F8EE;
  --danger: #FF3B30;
  --radius-card: 12px;
  --radius-btn: 8px;
  --space: 8px;
  --shadow: 0 1px 3px rgba(26, 26, 46, 0.06), 0 4px 12px rgba(26, 26, 46, 0.04);
  --shadow-lg: 0 4px 24px rgba(26, 26, 46, 0.1);
  --nav-h: 56px;
  --bottom-h: 64px;
  --max-w: 720px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  padding-bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom, 0px));
}

body.no-bottom-nav { padding-bottom: env(safe-area-inset-bottom, 0px); }

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; }
:focus-visible { outline: 2px solid var(--cta); outline-offset: 2px; }

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 calc(var(--space) * 2);
}

/* ——— Typography ——— */
.h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; }
.h3 { font-size: 1.0625rem; font-weight: 600; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-price { color: var(--price); font-weight: 700; }
.text-cta { color: var(--cta); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* ——— Buttons ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space);
  min-height: 44px;
  padding: calc(var(--space) * 1.5) calc(var(--space) * 2.5);
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 0.9375rem;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
  white-space: nowrap;
  border: 1px solid transparent;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn-primary { background: var(--cta); color: #fff; }
.btn-primary:hover { background: var(--cta-hover); }
.btn-dark { background: var(--primary); color: #fff; }
.btn-dark:hover { background: #2a2a45; }
.btn-outline {
  background: var(--card);
  border-color: var(--border);
  color: var(--text);
}
.btn-outline:hover { background: var(--bg); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: rgba(26, 26, 46, 0.05); }
.btn-success { background: var(--success); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: var(--space) calc(var(--space) * 1.5); font-size: 0.8125rem; }
.btn-icon {
  width: 40px; height: 40px; min-height: 40px; padding: 0;
  border-radius: var(--radius-btn);
  display: inline-flex; align-items: center; justify-content: center;
}

/* ——— Forms ——— */
.form-group { margin-bottom: calc(var(--space) * 2); }
.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: var(--space);
  color: var(--text);
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  min-height: 44px;
  padding: calc(var(--space) * 1.5) calc(var(--space) * 2);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 26, 46, 0.08);
}
.form-textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.form-hint { font-size: 0.75rem; color: var(--muted); margin-top: calc(var(--space) * 0.5); }
.form-error { font-size: 0.75rem; color: var(--danger); margin-top: calc(var(--space) * 0.5); }

/* ——— Cards ——— */
.card {
  background: var(--card);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-pad { padding: calc(var(--space) * 2); }

/* ——— Top bar ——— */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h);
  display: flex;
  align-items: center;
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: var(--space);
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 calc(var(--space) * 2);
  height: 100%;
}
.topbar-title {
  flex: 1;
  font-weight: 700;
  font-size: 1.0625rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-logo {
  font-weight: 800;
  font-size: 1.125rem;
  letter-spacing: -0.03em;
  color: var(--primary);
}
.brand-logo span { color: var(--cta); }

/* ——— Bottom nav ——— */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  height: calc(var(--bottom-h) + env(safe-area-inset-bottom, 0px));
}
.bottom-nav-inner {
  display: flex;
  max-width: var(--max-w);
  margin: 0 auto;
  height: var(--bottom-h);
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.15s;
}
.bottom-nav a.active { color: var(--cta); }
.bottom-nav a svg { width: 24px; height: 24px; }
.bottom-nav .nav-post {
  color: var(--cta);
}
.bottom-nav .nav-post .post-fab {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--cta);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -12px;
  box-shadow: 0 4px 12px rgba(255, 76, 41, 0.35);
}
.bottom-nav .nav-post .post-fab svg { width: 22px; height: 22px; }
.bottom-nav .nav-post span { margin-top: 2px; }

/* ——— Hero ——— */
.hero {
  position: relative;
  background: linear-gradient(165deg, #0f0f1a 0%, #1A1A2E 45%, #252545 100%);
  color: #fff;
  padding: calc(var(--space) * 3) 0 calc(var(--space) * 4);
  overflow: hidden;
}
.hero-silhouette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
}
.hero-silhouette svg {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120%;
  max-width: 900px;
  height: auto;
}
.hero-content { position: relative; z-index: 1; }
.hero-brand {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: var(--space);
}
.hero-brand span { color: var(--cta); }
.hero-tagline {
  font-size: 0.9375rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: calc(var(--space) * 3);
  max-width: 28ch;
}
.hero-search {
  display: flex;
  gap: var(--space);
  background: var(--card);
  border-radius: var(--radius-btn);
  padding: var(--space);
  box-shadow: var(--shadow-lg);
}
.hero-search input {
  flex: 1;
  border: none;
  background: transparent;
  padding: calc(var(--space) * 1.25) var(--space);
  min-width: 0;
  color: var(--text);
}
.hero-search input::placeholder { color: var(--muted); }
.hero-search input:focus { outline: none; }
.hero-search .btn { flex-shrink: 0; }

/* ——— Categories ——— */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: calc(var(--space) * 1.5);
  margin-top: calc(var(--space) * 3);
}
.cat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--space) * 0.75);
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.2;
}
.cat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.15s;
}
.cat-item:hover .cat-icon,
.cat-item:active .cat-icon {
  background: rgba(255, 76, 41, 0.25);
  transform: translateY(-2px);
}
.cat-icon svg { width: 26px; height: 26px; stroke: #fff; fill: none; stroke-width: 1.75; }

.cat-grid-light {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: calc(var(--space) * 1.5);
}
.cat-grid-light .cat-item { color: var(--text); }
.cat-grid-light .cat-icon {
  background: var(--bg);
  border: 1px solid var(--border);
}
.cat-grid-light .cat-icon svg { stroke: var(--primary); }
.cat-grid-light .cat-item:hover .cat-icon {
  background: rgba(255, 76, 41, 0.08);
  border-color: var(--cta);
}
.cat-grid-light .cat-item:hover .cat-icon svg { stroke: var(--cta); }

/* ——— Sections ——— */
.section {
  padding: calc(var(--space) * 3) 0;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: calc(var(--space) * 2);
  gap: var(--space);
}
.section-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--cta);
}

/* Highlight banners */
.banner {
  display: flex;
  align-items: center;
  gap: calc(var(--space) * 2);
  padding: calc(var(--space) * 2);
  border-radius: var(--radius-card);
  margin-bottom: calc(var(--space) * 2);
}
.banner-amber { background: var(--amber-bg); border: 1px solid #F5D78E; }
.banner-green { background: var(--free-bg); border: 1px solid #A8E6BC; }
.banner-icon {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: var(--radius-btn);
  display: flex; align-items: center; justify-content: center;
}
.banner-amber .banner-icon { background: var(--amber); color: #fff; }
.banner-green .banner-icon { background: var(--success); color: #fff; }
.banner-body { flex: 1; min-width: 0; }
.banner-title { font-weight: 700; font-size: 0.9375rem; }
.banner-desc { font-size: 0.8125rem; color: var(--muted); margin-top: 2px; }

/* ——— Listing cards ——— */
.listings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: calc(var(--space) * 1.5);
}
.listing-card {
  background: var(--card);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s, transform 0.15s;
}
.listing-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.listing-card:active { transform: scale(0.99); }
.listing-photo {
  aspect-ratio: 1;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}
.listing-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.listing-photo .placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  background: linear-gradient(135deg, #EEEEEF, #E5E5EA);
}
.listing-badge {
  position: absolute;
  top: var(--space);
  left: var(--space);
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 4px;
  color: #fff;
}
.listing-badge.free { background: var(--success); }
.listing-badge.lost { background: var(--amber); }
.listing-badge.urgent { background: var(--cta); }
.listing-fav {
  position: absolute;
  top: var(--space);
  right: var(--space);
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  box-shadow: var(--shadow);
}
.listing-fav.active { color: var(--cta); }
.listing-fav svg { width: 16px; height: 16px; }
.listing-body {
  padding: calc(var(--space) * 1.5);
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.listing-price {
  font-size: 1rem;
  font-weight: 700;
  color: var(--price);
  line-height: 1.2;
}
.listing-price.free-label { color: var(--success); }
.listing-title {
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.listing-meta {
  font-size: 0.6875rem;
  color: var(--muted);
  margin-top: auto;
  padding-top: 4px;
}

/* ——— Filters ——— */
.filters-bar {
  display: flex;
  gap: var(--space);
  overflow-x: auto;
  padding: calc(var(--space) * 2) 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filters-bar::-webkit-scrollbar { display: none; }
.filter-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: calc(var(--space) * 1) calc(var(--space) * 1.75);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.filter-chip svg { width: 14px; height: 14px; }

.filters-panel {
  background: var(--card);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  padding: calc(var(--space) * 2);
  margin-bottom: calc(var(--space) * 2);
}
.filters-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: calc(var(--space) * 1.5);
}
.results-count {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: calc(var(--space) * 2);
}

/* ——— Item page ——— */
.gallery {
  position: relative;
  background: #000;
  aspect-ratio: 1;
  max-height: 70vh;
}
.gallery-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  height: 100%;
  scrollbar-width: none;
}
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gallery-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #111;
}
.gallery-dots {
  position: absolute;
  bottom: calc(var(--space) * 2);
  left: 0; right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
}
.gallery-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
}
.gallery-dot.active { background: #fff; width: 18px; border-radius: 3px; }
.gallery-counter {
  position: absolute;
  top: calc(var(--space) * 2);
  right: calc(var(--space) * 2);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
}

.item-main { padding: calc(var(--space) * 2) 0; }
.item-price {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--price);
  letter-spacing: -0.02em;
}
.item-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: var(--space) 0;
  line-height: 1.3;
}
.item-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--space) * 2);
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: calc(var(--space) * 2);
}
.item-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space);
  margin: calc(var(--space) * 2) 0;
  position: sticky;
  bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom, 0px) + 8px);
  z-index: 50;
}
.item-actions .btn { box-shadow: var(--shadow-lg); }
.item-desc {
  font-size: 0.9375rem;
  line-height: 1.6;
  white-space: pre-wrap;
}
.item-details {
  margin-top: calc(var(--space) * 2);
}
.detail-row {
  display: flex;
  justify-content: space-between;
  padding: calc(var(--space) * 1.5) 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  gap: var(--space);
}
.detail-row dt { color: var(--muted); }
.detail-row dd { font-weight: 500; text-align: right; }

.seller-card {
  display: flex;
  align-items: center;
  gap: calc(var(--space) * 2);
  padding: calc(var(--space) * 2);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  margin: calc(var(--space) * 2) 0;
}
.seller-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--muted);
  flex-shrink: 0;
}
.seller-info { flex: 1; min-width: 0; }
.seller-name { font-weight: 600; }
.seller-stats { font-size: 0.75rem; color: var(--muted); }

/* ——— Wizard ——— */
.wizard-steps {
  display: flex;
  gap: var(--space);
  margin-bottom: calc(var(--space) * 3);
}
.wizard-step {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
}
.wizard-step.done,
.wizard-step.active { background: var(--cta); }
.wizard-label {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: calc(var(--space) * 2);
}
.wizard-label strong { color: var(--text); }

.cat-select-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space);
}
.cat-select {
  display: flex;
  align-items: center;
  gap: calc(var(--space) * 1.5);
  padding: calc(var(--space) * 2);
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius-card);
  font-weight: 600;
  font-size: 0.875rem;
  transition: border-color 0.15s, background 0.15s;
  text-align: left;
}
.cat-select.selected {
  border-color: var(--cta);
  background: rgba(255, 76, 41, 0.04);
}
.cat-select .cat-icon {
  width: 40px; height: 40px;
  background: var(--bg);
  flex-shrink: 0;
}
.cat-select .cat-icon svg { width: 20px; height: 20px; stroke: var(--primary); }

.photo-upload {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space);
}
.photo-slot {
  aspect-ratio: 1;
  border-radius: var(--radius-btn);
  border: 2px dashed var(--border);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.6875rem;
  color: var(--muted);
  overflow: hidden;
  position: relative;
  cursor: pointer;
}
.photo-slot img {
  width: 100%; height: 100%; object-fit: cover;
}
.photo-slot.has-photo { border-style: solid; border-color: var(--border); }
.photo-slot .remove-photo {
  position: absolute;
  top: 4px; right: 4px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}

.wizard-footer {
  position: sticky;
  bottom: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: calc(var(--space) * 2);
  padding-bottom: calc(var(--space) * 2 + env(safe-area-inset-bottom, 0px));
  display: flex;
  gap: var(--space);
  margin: calc(var(--space) * 3) calc(var(--space) * -2) 0;
  max-width: none;
}

/* ——— Profile ——— */
.profile-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: calc(var(--space) * 3) 0;
  text-align: center;
}
.profile-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 700;
  margin: 0 auto calc(var(--space) * 1.5);
}
.profile-name { font-size: 1.25rem; font-weight: 700; }
.profile-phone { color: var(--muted); font-size: 0.875rem; margin-top: 4px; }

.tabs {
  display: flex;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: var(--nav-h);
  z-index: 90;
}
.tab {
  flex: 1;
  padding: calc(var(--space) * 1.75) var(--space);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.tab.active {
  color: var(--cta);
  border-bottom-color: var(--cta);
}
.tab-panel { display: none; padding: calc(var(--space) * 2) 0; }
.tab-panel.active { display: block; }

/* ——— Chat ——— */
.chat-list-item {
  display: flex;
  align-items: center;
  gap: calc(var(--space) * 1.5);
  padding: calc(var(--space) * 1.75) 0;
  border-bottom: 1px solid var(--border);
}
.chat-list-item:active { background: rgba(26, 26, 46, 0.03); }
.chat-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--bg);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; color: var(--muted);
  overflow: hidden;
}
.chat-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-preview { flex: 1; min-width: 0; }
.chat-preview-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space);
}
.chat-name { font-weight: 600; font-size: 0.9375rem; }
.chat-time { font-size: 0.6875rem; color: var(--muted); flex-shrink: 0; }
.chat-last {
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.chat-unread {
  background: var(--cta);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 6px;
  flex-shrink: 0;
}

.chat-thread {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - var(--nav-h) - 72px - env(safe-area-inset-bottom, 0px));
}
.chat-messages {
  flex: 1;
  padding: calc(var(--space) * 2);
  display: flex;
  flex-direction: column;
  gap: calc(var(--space) * 1.5);
  overflow-y: auto;
}
.msg {
  max-width: 80%;
  padding: calc(var(--space) * 1.5) calc(var(--space) * 2);
  border-radius: 16px;
  font-size: 0.9375rem;
  line-height: 1.4;
}
.msg-in {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg-out {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg-time {
  font-size: 0.625rem;
  opacity: 0.6;
  margin-top: 4px;
  text-align: right;
}
.chat-compose {
  display: flex;
  gap: var(--space);
  padding: calc(var(--space) * 1.5) calc(var(--space) * 2);
  padding-bottom: calc(var(--space) * 1.5 + env(safe-area-inset-bottom, 0px));
  background: var(--card);
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
}
.chat-compose input {
  flex: 1;
  min-height: 44px;
  padding: 0 calc(var(--space) * 2);
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--bg);
}
.chat-compose input:focus { outline: none; border-color: var(--primary); }
.chat-item-ref {
  display: flex;
  gap: var(--space);
  padding: calc(var(--space) * 1.5) calc(var(--space) * 2);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.chat-item-ref img {
  width: 48px; height: 48px;
  border-radius: var(--radius-btn);
  object-fit: cover;
  background: var(--bg);
}
.chat-item-ref-info { flex: 1; min-width: 0; }
.chat-item-ref-title {
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item-ref-price { font-size: 0.8125rem; color: var(--price); font-weight: 700; }

/* ——— Login ——— */
.auth-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--space) * 3) 0;
  padding-bottom: calc(var(--space) * 3 + env(safe-area-inset-bottom, 0px));
}
.auth-card {
  background: var(--card);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  padding: calc(var(--space) * 3);
  box-shadow: var(--shadow);
}
.auth-logo {
  text-align: center;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: calc(var(--space) * 0.5);
}
.auth-logo span { color: var(--cta); }
.auth-subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: calc(var(--space) * 3);
}
.code-inputs {
  display: flex;
  gap: var(--space);
  justify-content: center;
  margin: calc(var(--space) * 2) 0;
}
.code-inputs input {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--bg);
}
.code-inputs input:focus {
  outline: none;
  border-color: var(--cta);
  box-shadow: 0 0 0 3px rgba(255, 76, 41, 0.15);
}

/* ——— Footer ——— */
.site-footer {
  background: var(--primary);
  color: rgba(255, 255, 255, 0.7);
  padding: calc(var(--space) * 4) 0 calc(var(--space) * 3);
  margin-top: calc(var(--space) * 2);
  font-size: 0.8125rem;
}
.site-footer .brand-logo { color: #fff; margin-bottom: calc(var(--space) * 2); display: inline-block; }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--space) * 2);
  margin: calc(var(--space) * 2) 0;
}
.footer-links a:hover { color: #fff; }
.footer-copy {
  margin-top: calc(var(--space) * 3);
  padding-top: calc(var(--space) * 2);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.45);
}

/* ——— About ——— */
.prose { font-size: 0.9375rem; line-height: 1.7; }
.prose p { margin-bottom: calc(var(--space) * 2); }
.prose h2 { font-size: 1.125rem; font-weight: 700; margin: calc(var(--space) * 3) 0 calc(var(--space) * 1.5); }
.prose ul { list-style: disc; padding-left: 1.25rem; margin-bottom: calc(var(--space) * 2); }
.prose li { margin-bottom: var(--space); }

/* ——— Empty / loading ——— */
.empty-state {
  text-align: center;
  padding: calc(var(--space) * 6) calc(var(--space) * 2);
  color: var(--muted);
}
.empty-state svg {
  width: 64px; height: 64px;
  margin: 0 auto calc(var(--space) * 2);
  opacity: 0.4;
}
.empty-state h3 {
  color: var(--text);
  font-size: 1.0625rem;
  margin-bottom: var(--space);
}
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--cta);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: calc(var(--space) * 4) auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed;
  bottom: calc(var(--bottom-h) + 16px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--primary);
  color: #fff;
  padding: calc(var(--space) * 1.5) calc(var(--space) * 2.5);
  border-radius: var(--radius-btn);
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  max-width: calc(100% - 32px);
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ——— Modal ——— */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 46, 0.5);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  background: var(--card);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  width: 100%;
  max-width: var(--max-w);
  padding: calc(var(--space) * 3);
  padding-bottom: calc(var(--space) * 3 + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%);
  transition: transform 0.25s ease;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-handle {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto calc(var(--space) * 2);
}
.modal-title { font-size: 1.125rem; font-weight: 700; margin-bottom: calc(var(--space) * 2); }

/* ——— Admin ——— */
.admin-layout { display: flex; min-height: 100dvh; }
.admin-sidebar {
  width: 240px;
  background: var(--primary);
  color: #fff;
  padding: calc(var(--space) * 3) 0;
  flex-shrink: 0;
  display: none;
}
.admin-sidebar .brand-logo {
  color: #fff;
  padding: 0 calc(var(--space) * 3);
  margin-bottom: calc(var(--space) * 3);
  display: block;
}
.admin-nav a {
  display: flex;
  align-items: center;
  gap: calc(var(--space) * 1.5);
  padding: calc(var(--space) * 1.5) calc(var(--space) * 3);
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.65);
  transition: background 0.15s, color 0.15s;
}
.admin-nav a:hover,
.admin-nav a.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.admin-main { flex: 1; min-width: 0; background: var(--bg); }
.admin-topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: calc(var(--space) * 2) calc(var(--space) * 3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.admin-content { padding: calc(var(--space) * 3); }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: calc(var(--space) * 2);
  margin-bottom: calc(var(--space) * 3);
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: calc(var(--space) * 2.5);
}
.stat-value { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; }
.stat-label { font-size: 0.8125rem; color: var(--muted); margin-top: 4px; }
.admin-table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  overflow-x: auto;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.admin-table th,
.admin-table td {
  padding: calc(var(--space) * 1.5) calc(var(--space) * 2);
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.admin-table th {
  background: var(--bg);
  font-weight: 600;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.admin-table tr:last-child td { border-bottom: none; }
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.6875rem;
  font-weight: 600;
}
.badge-pending { background: var(--amber-bg); color: #B8860B; }
.badge-ok { background: var(--free-bg); color: #1B7A3D; }
.badge-banned { background: #FFE5E3; color: var(--danger); }
.badge-rejected { background: #FFE5E3; color: var(--danger); }
.admin-mobile-nav {
  display: flex;
  background: var(--primary);
  overflow-x: auto;
  padding: 0 calc(var(--space) * 1);
}
.admin-mobile-nav a {
  flex-shrink: 0;
  padding: calc(var(--space) * 1.75) calc(var(--space) * 2);
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.8125rem;
  font-weight: 600;
  border-bottom: 2px solid transparent;
}
.admin-mobile-nav a.active {
  color: #fff;
  border-bottom-color: var(--cta);
}

/* ——— Utilities ——— */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}
.mt-1 { margin-top: var(--space); }
.mt-2 { margin-top: calc(var(--space) * 2); }
.mt-3 { margin-top: calc(var(--space) * 3); }
.mb-2 { margin-bottom: calc(var(--space) * 2); }
.mb-3 { margin-bottom: calc(var(--space) * 3); }
.gap-1 { gap: var(--space); }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }
.divider {
  height: 1px;
  background: var(--border);
  margin: calc(var(--space) * 2) 0;
}
.max-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space);
  color: var(--cta);
  font-weight: 600;
  font-size: 0.875rem;
}

/* ——— Desktop ——— */
@media (min-width: 640px) {
  .listings-grid { grid-template-columns: repeat(3, 1fr); }
  .cat-grid { gap: calc(var(--space) * 2); }
  .cat-item { font-size: 0.75rem; }
  .hero-brand { font-size: 2.5rem; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .filters-row { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 768px) {
  body { padding-bottom: 0; }
  .bottom-nav { display: none; }
  .item-actions { position: static; }
  .admin-sidebar { display: block; }
  .admin-mobile-nav { display: none; }
  .listings-grid { grid-template-columns: repeat(3, 1fr); gap: calc(var(--space) * 2); }
  .modal-overlay { align-items: center; }
  .modal {
    border-radius: var(--radius-card);
    max-width: 420px;
    margin: calc(var(--space) * 2);
  }
}

@media (min-width: 960px) {
  :root { --max-w: 960px; }
  .listings-grid { grid-template-columns: repeat(4, 1fr); }
}
