:root {
  --bg: var(--tg-theme-bg-color, #0f1117);
  --bg-secondary: var(--tg-theme-secondary-bg-color, #161b22);
  --text: var(--tg-theme-text-color, #e1e4e8);
  --text-secondary: var(--tg-theme-hint-color, #8b949e);
  --accent: var(--tg-theme-button-color, #3b82f6);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --link: var(--tg-theme-link-color, #58a6ff);
  --border: #21262d;
  --card-bg: #161b22;
  --success: #3fb950;
  --danger: #f85149;
  --radius: 12px;
  --radius-sm: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Loading screen */
.loading-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
}
.loading-logo { font-size: 56px; animation: pulse 1.2s ease-in-out infinite; }
.loading-title { font-size: 22px; font-weight: 700; color: var(--text); }
.loading-bar { width: 120px; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.loading-bar-fill { width: 40%; height: 100%; background: var(--accent); border-radius: 2px; animation: loadSlide 1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.1); } }
@keyframes loadSlide { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 100%;
  overflow: hidden;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  min-height: 52px;
  z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 8px; }
.header-title { font-size: 18px; font-weight: 700; color: var(--text); }
.header-btn {
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.back-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.hidden { display: none !important; }

/* City bar */
.city-bar {
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}
.city-select {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 14px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  width: 100%;
}
.city-icon { font-size: 16px; }
.city-select .arrow { margin-left: auto; color: var(--text-secondary); }

/* Content */
.content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.page { display: none; padding: 0; opacity: 0; }
.page.active { display: block; animation: pageFadeIn .25s ease forwards; }
@keyframes pageFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Categories scroll */
.categories-scroll {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.categories-scroll::-webkit-scrollbar { display: none; }

.cat-chip {
  flex-shrink: 0;
  padding: 8px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.cat-chip.active {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

/* Search */
.search-bar { padding: 8px 16px; }
.search-bar input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.search-bar input:focus { border-color: var(--accent); }
.search-bar input::placeholder { color: var(--text-secondary); }

/* Listings grid */
.listings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 8px 16px 16px;
}

.listing-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
  position: relative;
}
.listing-card:active { transform: scale(0.96); }
.listing-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.listing-badge {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  padding: 3px 8px; border-radius: 6px; font-size: 10px; font-weight: 700;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.badge-hit { background: rgba(251,146,60,.85); color: #fff; }
.badge-new { background: rgba(59,130,246,.85); color: #fff; }
.listing-rating {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  padding: 2px 6px; border-radius: 6px; font-size: 10px; font-weight: 700;
  background: rgba(0,0,0,.6); color: #f6d365; backdrop-filter: blur(8px);
}

.listing-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--bg);
  display: block;
  transition: transform .3s ease;
}
.listing-card:hover .listing-img { transform: scale(1.03); }
.listing-img-placeholder {
  width: 100%;
  aspect-ratio: 1;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: var(--border);
}

.listing-info { padding: 10px; }
.listing-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.listing-title {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.listing-meta {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Detail page */
.detail-photos {
  width: 100%;
  overflow-x: auto;
  display: flex;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.detail-photos::-webkit-scrollbar { display: none; }
.detail-photo {
  flex-shrink: 0;
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  scroll-snap-align: start;
}
.detail-photo-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 60px;
}

.detail-body { padding: 16px; }
.detail-price { font-size: 26px; font-weight: 800; margin-bottom: 4px; }
.detail-title { font-size: 18px; font-weight: 600; margin-bottom: 12px; }
.detail-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
  white-space: pre-wrap;
}
.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.detail-tag {
  padding: 4px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 12px;
  color: var(--text-secondary);
}
.detail-contact {
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  padding: 14px;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  width: 100%;
  cursor: pointer;
  text-align: center;
  display: block;
  text-decoration: none;
  margin-bottom: 12px;
}
.detail-views { font-size: 12px; color: var(--text-secondary); text-align: center; }

/* City list */
.city-list, .district-list { padding: 8px 16px; }
.city-item, .district-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.city-item:active, .district-item:active { background: var(--bg); }
.city-item-name { font-size: 15px; font-weight: 500; }
.city-item-region { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.city-item-check { color: var(--success); font-size: 18px; }
.district-all {
  color: var(--accent);
  font-weight: 600;
}

/* Forms */
.form-section { padding: 0 16px; margin-bottom: 16px; }
.form-section label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 600;
}
.form-section input,
.form-section textarea,
.form-section select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  font-family: inherit;
}
.form-section input:focus,
.form-section textarea:focus,
.form-section select:focus { border-color: var(--accent); }
.form-section select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b949e' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

.form-row { display: flex; gap: 12px; padding: 0 16px; margin-bottom: 16px; }
.form-row .form-section { padding: 0; margin-bottom: 0; }
.flex-1 { flex: 1; }

/* Photo upload */
.photo-upload { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-add {
  width: 80px;
  height: 80px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 24px;
  transition: border-color 0.2s;
}
.photo-add:hover { border-color: var(--accent); }
.photo-add-text { font-size: 10px; margin-top: 2px; }
.photo-previews { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-preview {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border);
}
.photo-preview-wrap {
  position: relative;
}
.photo-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* My listings */
.my-listing-card {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.my-listing-card:active { background: var(--bg-secondary); }
.my-listing-img {
  width: 70px;
  height: 70px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-secondary);
}
.my-listing-info { flex: 1; min-width: 0; }
.my-listing-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.my-listing-price { font-size: 15px; font-weight: 700; color: var(--success); }
.my-listing-meta { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.my-listing-actions { display: flex; gap: 8px; margin-top: 8px; }
.my-listing-del {
  background: none;
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-align: center;
  transition: all 0.15s ease;
}
.btn:active { opacity: 0.85; transform: scale(0.97); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-full { width: 100%; display: block; margin: 0 16px; width: calc(100% - 32px); }
.btn-danger { background: var(--danger); color: #fff; }

/* Bottom nav */
.bottom-nav {
  display: flex;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 6px 0 env(safe-area-inset-bottom, 8px);
  z-index: 100;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 10px;
  cursor: pointer;
  transition: color 0.15s;
}
.nav-item.active { color: var(--accent); }
.nav-icon { font-size: 20px; }
.nav-label { font-weight: 500; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { margin-bottom: 16px; }

/* Load more */
.load-more { text-align: center; padding: 16px; }

/* Spinner */
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-center { display: flex; justify-content: center; padding: 40px; }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg-secondary) 25%, #1e2530 50%, var(--bg-secondary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-card { height: 200px; border-radius: var(--radius); }
.skeleton-text { height: 14px; margin-bottom: 8px; width: 80%; }
.skeleton-text-sm { height: 10px; margin-bottom: 6px; width: 60%; }
.skeleton-circle { border-radius: 50%; }
.skeleton-grid {
  display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; padding: 8px 16px;
}

/* Tab bar */
.tab-bar { display: flex; padding: 8px 16px; gap: 8px; }
.tab {
  flex: 1; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-secondary); color: var(--text-secondary); font-size: 14px; font-weight: 600;
  cursor: pointer; text-align: center; transition: all 0.15s;
}
.tab.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

/* Shop cards */
.shops-grid { display: grid; grid-template-columns: 1fr; gap: 10px; padding: 8px 16px 16px; }
.shop-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; cursor: pointer; transition: transform 0.15s;
}
.shop-card:active { transform: scale(0.98); }
.shop-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.shop-avatar {
  width: 48px; height: 48px; border-radius: 50%; background: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 22px; color: var(--accent-text);
  flex-shrink: 0; overflow: hidden;
}
.shop-avatar img { width: 100%; height: 100%; object-fit: cover; }
.shop-card-name { font-size: 16px; font-weight: 700; color: var(--text); }
.shop-card-city { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.shop-card-stats { display: flex; gap: 16px; font-size: 12px; color: var(--text-secondary); }

/* Shop detail */
.shop-header { padding: 20px 16px; text-align: center; border-bottom: 1px solid var(--border); }
.shop-header .shop-avatar { width: 72px; height: 72px; margin: 0 auto 12px; font-size: 32px; }
.shop-header-name { font-size: 20px; font-weight: 700; }
.shop-header-desc { font-size: 14px; color: var(--text-secondary); margin-top: 6px; }
.shop-header-meta { font-size: 12px; color: var(--text-secondary); margin-top: 8px; }
.shop-actions { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }

/* Header icon btn */
.header-right { display: flex; gap: 8px; }
.header-icon-btn {
  background: none; border: none; font-size: 20px; cursor: pointer; position: relative; padding: 4px;
}
.badge-dot {
  position: absolute; top: 0; right: 0; width: 8px; height: 8px;
  background: var(--danger); border-radius: 50%;
}

/* Chat */
.chat-messages {
  flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 6px;
}
.chat-msg {
  max-width: 80%; padding: 10px 14px; border-radius: 18px; font-size: 14px; line-height: 1.45;
  word-wrap: break-word; animation: msgAppear .2s ease;
}
@keyframes msgAppear { from { opacity: 0; transform: translateY(6px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.chat-msg-mine {
  align-self: flex-end; background: linear-gradient(135deg, var(--accent), #2563eb); color: var(--accent-text);
  border-bottom-right-radius: 4px; box-shadow: 0 2px 8px rgba(59,130,246,.25);
}
.chat-msg-other {
  align-self: flex-start; background: var(--bg-secondary); border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.chat-msg-time { font-size: 10px; opacity: 0.5; margin-top: 4px; text-align: right; }
.chat-msg-name { font-size: 11px; font-weight: 600; margin-bottom: 2px; color: var(--accent); }
.chat-msg-stash {
  background: #1a3a2a; border: 1px solid var(--success); border-radius: 12px;
  padding: 8px 10px; margin-top: 6px; font-size: 12px; color: var(--success); word-break: break-all;
}

.chat-input-bar {
  display: flex; gap: 8px; padding: 10px 16px; background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}
.chat-input-bar input {
  flex: 1; padding: 10px 14px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px; color: var(--text); font-size: 14px; outline: none;
}
.chat-input-bar input:focus { border-color: var(--accent); }
.chat-send-btn {
  width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: var(--accent-text);
  border: none; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* Chat list */
.chat-list-item {
  display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); cursor: pointer;
}
.chat-list-item:active { background: var(--bg-secondary); }
.chat-list-avatar {
  width: 48px; height: 48px; border-radius: 50%; background: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0;
}
.chat-list-info { flex: 1; min-width: 0; }
.chat-list-name { font-size: 15px; font-weight: 600; display: flex; justify-content: space-between; }
.chat-list-msg { font-size: 13px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.chat-list-time { font-size: 11px; color: var(--text-secondary); flex-shrink: 0; }
.chat-list-unread {
  background: var(--accent); color: var(--accent-text); font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 10px; min-width: 20px; text-align: center;
}

/* My shops */
.my-shop-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin: 8px 16px;
}
.my-shop-status { display: inline-block; padding: 3px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.status-pending { background: #3d1f00; color: #d29922; }
.status-approved { background: #0d2818; color: #3fb950; }
.status-rejected { background: #3d0000; color: #f85149; }
.status-closed { background: #1f2937; color: #9ca3af; }

/* Form note & hint */
.form-note { padding: 0 16px; margin-bottom: 16px; font-size: 13px; color: var(--text-secondary); }
.form-hint { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }
.reg-closed-banner { padding: 16px; margin: 16px; background: #3d0000; border: 1px solid var(--danger); border-radius: var(--radius); text-align: center; color: var(--danger); font-size: 14px; }

/* VIP badge */
.vip-badge {
  display: inline-block; background: linear-gradient(135deg, #f6d365, #fda085);
  color: #000; font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 4px;
  margin-right: 4px; vertical-align: middle; letter-spacing: 0.5px;
}

/* Tags */
.shop-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; justify-content: center; }
.tag { background: var(--bg-secondary); border: 1px solid var(--border); padding: 3px 10px; border-radius: 12px; font-size: 12px; color: var(--text-secondary); }

/* Shop rating */
.shop-rating { display: block; margin-top: 6px; font-size: 14px; color: var(--text-secondary); }

/* Reviews */
.review-form { padding: 16px; border-bottom: 1px solid var(--border); }
.review-form h4 { font-size: 14px; margin-bottom: 10px; }
.review-form input { width: 100%; padding: 8px 12px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 13px; margin: 8px 0; }
.star-select { display: flex; gap: 8px; }
.star-btn { font-size: 28px; cursor: pointer; color: #f6d365; user-select: none; }
.reviews-list { padding: 8px 0; }
.reviews-list h4 { font-size: 14px; margin-bottom: 8px; }
.review-item { padding: 10px 16px; border-bottom: 1px solid var(--border); }
.review-header { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.review-text { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* Favorite button */
.fav-btn { background: none; border: none; font-size: 24px; cursor: pointer; padding: 4px; }

/* Wallet */
.wallet-balances { padding: 16px; }
.wallet-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 8px;
}
.wallet-cur { font-weight: 600; font-size: 14px; }
.wallet-bal { font-size: 16px; font-weight: 700; flex: 1; text-align: right; margin-right: 12px; }
.wallet-txs { border-top: 1px solid var(--border); }
.tx-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.tx-info { flex: 1; min-width: 0; }
.tx-desc { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-time { font-size: 11px; color: var(--text-secondary); }
.tx-amount { font-size: 14px; font-weight: 700; flex-shrink: 0; margin-left: 12px; }
.tx-plus { color: var(--success); }
.tx-minus { color: var(--danger); }

/* Buy button */
.buy-btn {
  display: block; width: 100%; padding: 14px; margin: 12px 0 8px;
  background: linear-gradient(135deg, #3fb950, #238636); color: #fff;
  border: none; border-radius: var(--radius); font-size: 16px; font-weight: 700;
  cursor: pointer; text-align: center;
}
.buy-btn:active { transform: scale(0.98); }

/* Auto-delivery badge */
.auto-badge {
  display: inline-block; padding: 4px 10px; background: #1a3a2a; border: 1px solid var(--success);
  border-radius: 12px; font-size: 12px; color: var(--success); margin: 6px 0;
}

/* Profile */
.profile-card {
  text-align: center; padding: 24px 16px 16px;
  background: linear-gradient(135deg, #161b22, #1c2128);
  border-bottom: 1px solid var(--border);
}
.profile-avatar { font-size: 48px; margin-bottom: 8px; }
.profile-name { font-size: 20px; font-weight: 700; }
.profile-username { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }
.profile-section { border-bottom: 1px solid var(--border); }
.profile-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; cursor: pointer; font-size: 15px;
  border-bottom: 1px solid rgba(48,54,61,.4);
}
.profile-row:hover { background: var(--card-bg); }
.profile-row:last-child { border-bottom: none; }
.profile-val { color: var(--text-secondary); font-size: 14px; }

/* Orders */
.order-card {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.order-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.order-header strong { font-size: 15px; }
.order-status { font-size: 13px; }
.order-details { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-secondary); }
.order-date { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.order-delivery { margin-top: 8px; padding: 10px; background: #1a3a2a; border: 1px solid var(--success); border-radius: var(--radius-sm); font-size: 13px; }
.order-delivery-content { margin-top: 4px; word-break: break-all; color: var(--success); }

/* My products list */
.my-product-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--border); cursor: pointer;
}
.my-product-item:hover { background: var(--card-bg); }
.my-product-photo {
  width: 48px; height: 48px; border-radius: 8px; background: var(--bg);
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  overflow: hidden; flex-shrink: 0;
}
.my-product-photo img { width: 100%; height: 100%; object-fit: cover; }
.my-product-info { flex: 1; min-width: 0; }
.my-product-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.my-product-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* Support chat item */
.support-chat { border-bottom: 2px solid var(--primary) !important; background: rgba(88,166,255,.05); }

/* Custom Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 9999;
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn .15s ease;
}
.modal-box {
  background: var(--card-bg); border-radius: 16px 16px 0 0; width: 100%;
  max-width: 480px; max-height: 85vh; overflow-y: auto;
  padding: 20px 16px 24px; animation: slideUp .2s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-title { font-size: 18px; font-weight: 700; text-align: center; margin-bottom: 16px; }
.modal-text { font-size: 14px; color: var(--text-secondary); text-align: center; margin-bottom: 16px; line-height: 1.5; }
.modal-input {
  width: 100%; padding: 14px 16px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 16px; margin-bottom: 12px;
  text-align: center;
}
.modal-input:focus { outline: none; border-color: var(--primary); }
.modal-input-lg { font-size: 28px; font-weight: 700; padding: 16px; }
.modal-currency { font-size: 14px; color: var(--text-secondary); text-align: center; margin-top: -8px; margin-bottom: 12px; }
.modal-presets { display: flex; gap: 8px; justify-content: center; margin-bottom: 16px; flex-wrap: wrap; }
.modal-preset {
  padding: 8px 16px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px; color: var(--text); font-size: 13px; cursor: pointer;
}
.modal-preset:hover { border-color: var(--primary); color: var(--primary); }
.modal-btns { display: flex; gap: 8px; }
.modal-btns .btn { flex: 1; padding: 14px; font-size: 15px; }
.modal-btn-cancel { background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius-sm); cursor: pointer; }
.modal-btn-cancel:hover { background: var(--card-bg); }
.modal-success { color: var(--success); font-size: 48px; text-align: center; margin-bottom: 12px; }
.modal-delivery-box {
  background: #1a3a2a; border: 1px solid var(--success); border-radius: var(--radius-sm);
  padding: 12px; margin: 12px 0; font-size: 13px; word-break: break-all; color: var(--success);
}

/* Purchase wizard */
.wizard-steps {
  display: flex; gap: 0; margin-bottom: 20px; position: relative;
}
.wizard-step {
  flex: 1; text-align: center; padding: 10px 4px; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); position: relative; transition: color .2s;
}
.wizard-step.active { color: var(--accent); }
.wizard-step.done { color: var(--success); }
.wizard-bar {
  position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  background: var(--border); border-radius: 2px;
}
.wizard-bar-fill {
  height: 100%; background: var(--accent); border-radius: 2px;
  transition: width .3s ease;
}
.wizard-option {
  padding: 12px 16px; background: var(--card-bg); border: 2px solid var(--border);
  border-radius: var(--radius); margin-bottom: 8px; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  transition: all .15s ease;
}
.wizard-option:hover { border-color: var(--accent); }
.wizard-option.selected { border-color: var(--accent); background: rgba(59,130,246,.08); }
.wizard-option-label { font-size: 15px; font-weight: 600; }
.wizard-option-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.wizard-option-price { font-size: 15px; font-weight: 700; color: var(--success); }

/* Purchase success animation */
.purchase-success {
  text-align: center; padding: 24px 16px; animation: successPop .4s ease;
}
@keyframes successPop {
  0% { transform: scale(.8); opacity: 0; }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}
.purchase-success-icon { font-size: 64px; margin-bottom: 12px; }
.purchase-success-title { font-size: 20px; font-weight: 700; margin-bottom: 8px; }

/* Region list */
.region-list { padding: 0; }
.region-item {
  padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
}
.region-item:hover { background: var(--card-bg); }
.region-item-name { font-size: 15px; font-weight: 600; }
.region-item-count { font-size: 12px; color: var(--text-secondary); }

/* Loading overlay */
.loading-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 9998;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.loading-overlay .spinner { width: 40px; height: 40px; margin-bottom: 16px; }
.loading-text { color: #fff; font-size: 16px; font-weight: 600; }
.loading-sub { color: #8b949e; font-size: 13px; margin-top: 8px; }

/* Page chat layout */
#page-chat { display: none; flex-direction: column; }
#page-chat.active { display: flex; }
