:root {
  --bg: #0b0f19;
  --bg-elevated: #13192a;
  --surface: #182035;
  --surface-hover: #1e2842;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f3f6fc;
  --text-muted: #94a3b8;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --accent: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

[data-theme="light"] {
  --bg: #f1f5f9;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-hover: #f8fafc;
  --border: rgba(15, 23, 42, 0.09);
  --text: #0f172a;
  --text-muted: #64748b;
  --shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100vh;
  overflow-x: hidden;
}

.app-shell {
  max-width: 960px;
  margin: 0 auto;
  padding-bottom: 88px;
  min-height: 100vh;
}

/* Header */
.top-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(11, 15, 25, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
}

[data-theme="light"] .top-header {
  background: rgba(255, 255, 255, 0.9);
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.brand-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.brand-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.age-badge {
  padding: 4px 8px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 800;
  background: rgba(245, 158, 11, 0.16);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.pill-btn {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 11px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.15s ease;
}

.pill-btn:hover {
  border-color: var(--primary);
}

/* Search & Controls */
.search-bar {
  display: flex;
  gap: 8px;
}

.search-input-wrap {
  position: relative;
  flex: 1;
}

.search-input {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 36px 10px 36px;
  font-size: 14px;
  outline: none;
}

.search-input:focus {
  border-color: var(--primary);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}

.clear-search-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  display: none;
}

.sort-select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

/* Categories Strip */
.categories-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 16px 6px;
  scrollbar-width: none;
}

.categories-strip::-webkit-scrollbar {
  display: none;
}

.cat-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s ease;
}

.cat-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

/* Promo Banner */
.promo-banner {
  margin: 10px 16px 14px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.22), rgba(16, 185, 129, 0.15));
  border: 1px solid rgba(99, 102, 241, 0.3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.promo-text h2 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 3px;
}

.promo-text p {
  font-size: 12px;
  color: var(--text-muted);
}

.promo-badge {
  flex-shrink: 0;
  background: rgba(16, 185, 129, 0.18);
  color: var(--accent);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}

/* Catalog Grid */
.section-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 16px 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  gap: 12px;
  padding: 0 16px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 13px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease;
  position: relative;
}

.product-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.5);
}

.card-top {
  display: flex;
  gap: 12px;
}

.product-thumb {
  width: 68px;
  height: 68px;
  border-radius: 13px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  position: relative;
  overflow: hidden;
  color: #fff;
  font-weight: 800;
}

.discount-tag {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 5px;
}

.card-info {
  flex: 1;
  min-width: 0;
}

.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 5px;
}

.mini-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}

.mini-badge.instant {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent);
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 5px;
}

.seller-line {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.seller-rating {
  color: var(--warning);
  font-weight: 700;
}

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 9px;
  border-top: 1px solid var(--border);
}

.price-block {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.price-current {
  font-size: 17px;
  font-weight: 800;
}

.price-old {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: line-through;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.fav-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.fav-btn.active {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.1);
}

.buy-btn-sm {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.buy-btn-sm:hover {
  background: var(--primary-hover);
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  background: rgba(19, 25, 42, 0.94);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  max-width: 960px;
  margin: 0 auto;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
}

[data-theme="light"] .bottom-nav {
  background: rgba(255, 255, 255, 0.94);
}

.nav-item {
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 12px;
  cursor: pointer;
  position: relative;
}

.nav-item.active {
  color: var(--primary);
}

.nav-icon {
  font-size: 18px;
}

.nav-badge {
  position: absolute;
  top: 2px;
  right: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 99px;
}

/* Modal / Bottom Sheet */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(5, 8, 15, 0.72);
  backdrop-filter: blur(6px);
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.bottom-sheet {
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  background: var(--bg-elevated);
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(35px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.sheet-title {
  font-size: 15px;
  font-weight: 800;
}

.close-sheet-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
}

.sheet-body {
  padding: 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sheet-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.tab-btn {
  flex: 1;
  padding: 8px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.specs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.spec-box {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 10px;
  border-radius: 11px;
}

.spec-label {
  font-size: 11px;
  color: var(--text-muted);
}

.spec-val {
  font-size: 13px;
  font-weight: 700;
  margin-top: 2px;
}

.sheet-footer {
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.buy-cta-btn {
  flex: 1;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  border: none;
  padding: 13px 18px;
  border-radius: 13px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.4);
}

/* Info / RuStore Settings View */
.view-section {
  display: none;
  padding: 12px 16px;
}

.view-section.active {
  display: block;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
}

.info-card h3 {
  font-size: 15px;
  margin-bottom: 8px;
}

.info-card p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.form-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.code-snippet {
  background: #090d16;
  color: #a5b4fc;
  padding: 12px;
  border-radius: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  overflow-x: auto;
  white-space: pre;
  border: 1px solid var(--border);
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.checklist-item:last-child {
  border-bottom: none;
}

/* Privacy Standalone Page */
.privacy-page-body {
  padding: 24px 16px 60px;
}

.privacy-container {
  max-width: 720px;
  margin: 0 auto;
}

.privacy-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.back-pill {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
}

.privacy-updated {
  color: var(--text-muted);
  font-size: 13px;
  margin: 6px 0 18px;
}

.privacy-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}

.privacy-card h2 {
  font-size: 16px;
  margin-bottom: 8px;
}

.privacy-card p,
.privacy-card li {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.privacy-card ul {
  padding-left: 18px;
}

/* Product Options & Dynamic id_po */
.options-panel {
  background: var(--surface);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-md);
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.option-field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}

.variant-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.variant-chip {
  flex: 1 1 calc(50% - 7px);
  min-width: 130px;
  text-align: left;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.variant-chip.active {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.16);
  color: #fff;
}

[data-theme="light"] .variant-chip.active {
  color: var(--primary);
}

.id-po-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  background: rgba(16, 185, 129, 0.14);
  color: var(--accent);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 4px 8px;
  border-radius: 7px;
}

/* Embedded WebView Frame inside Checkout Sheet */
.webview-frame-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
  position: relative;
  height: 360px;
  display: none;
}

.webview-frame-wrap.visible {
  display: block;
}

.webview-toolbar {
  background: #0f172a;
  color: #e2e8f0;
  padding: 7px 12px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.webview-iframe {
  width: 100%;
  height: calc(100% - 32px);
  border: none;
  background: #fff;
}

/* Seller Verification & Multi-Vendor Registry */
.sellers-strip {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 16px 8px;
  scrollbar-width: none;
}

.sellers-strip::-webkit-scrollbar {
  display: none;
}

.seller-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s ease;
}

.seller-chip.active {
  background: rgba(16, 185, 129, 0.16);
  border-color: var(--accent);
  color: var(--accent);
}

.verify-tabs {
  display: flex;
  gap: 8px;
  margin: 10px 0 12px;
}

.verify-tab-btn {
  flex: 1;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.verify-tab-btn.active {
  background: rgba(99, 102, 241, 0.18);
  border-color: var(--primary);
  color: var(--text);
}

.challenge-box {
  background: rgba(99, 102, 241, 0.1);
  border: 1px dashed rgba(99, 102, 241, 0.45);
  border-radius: 12px;
  padding: 12px;
  margin: 10px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.challenge-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 16px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.seller-registry-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 10px;
}

.seller-row-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.seller-badge-verified {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 2px 7px;
  border-radius: 6px;
}


