/* ==============================================
   团长经营助手 — Design System & Styles
   移动优先 H5，375px 基准，适配 320-768px
   ============================================== */

/* ----- Design Tokens ----- */
:root {
  /* Brand — warm coral */
  --color-primary: #F97316;
  --color-primary-hover: #EA580C;
  --color-primary-soft: #FFF7ED;
  --color-primary-pale: #FFEDD5;

  /* Neutral surfaces */
  --color-bg: #F9F8F6;
  --color-surface: #FFFFFF;
  --color-surface-hover: #F4F3F0;
  --color-border: #EBE9E5;
  --color-border-light: #F0EFED;

  /* Text */
  --color-text: #1C1917;
  --color-text-secondary: #78716C;
  --color-text-muted: #A8A29E;

  /* Semantic */
  --color-success: #059669;
  --color-success-bg: #ECFDF5;
  --color-warning: #D97706;
  --color-warning-bg: #FFFBEB;
  --color-danger: #DC2626;
  --color-danger-bg: #FEF2F2;

  /* Spacing — 4px grid */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --text-xs: 0.6875rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-lg: 1.0625rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.03);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
  --shadow-nav: 0 -1px 0 rgba(0,0,0,.04), 0 -4px 12px rgba(0,0,0,.03);

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-instant: 80ms;
  --duration-fast: 180ms;
  --duration-normal: 280ms;

  /* Layout */
  --nav-height: 60px;
  --header-height: 48px;
  --content-max: 480px;
}

/* ----- Reset ----- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-surface);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
  height: 100dvh;
  height: 100vh;
  overflow: hidden;
}

/* ----- App Shell ----- */
.app {
  max-width: var(--content-max);
  margin: 0 auto;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  position: relative;
}

/* ----- Header ----- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(249,248,246,.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0 var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  border-bottom: 1px solid var(--color-border-light);
}

.app-header h1 {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.ai-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  background: linear-gradient(135deg, #8B5CF6 0%, #6366F1 50%, #8B5CF6 100%);
  background-size: 200% 100%;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  line-height: 1.5;
  animation: aiShimmer 2.5s ease-in-out infinite, aiGlow 2s ease-in-out infinite;
  box-shadow: 0 0 6px rgba(99,102,241,.4), 0 0 20px rgba(139,92,246,.15);
}

.ai-badge::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(139,92,246,.6), rgba(99,102,241,.3), rgba(139,92,246,.6));
  background-size: 200% 100%;
  z-index: -1;
  animation: aiShimmer 2.5s ease-in-out infinite;
  filter: blur(3px);
  opacity: .6;
}

@keyframes aiShimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes aiGlow {
  0%, 100% { box-shadow: 0 0 6px rgba(99,102,241,.4), 0 0 20px rgba(139,92,246,.15); }
  50% { box-shadow: 0 0 10px rgba(99,102,241,.6), 0 0 30px rgba(139,92,246,.3); }
}

.header-action {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}
.header-action:active { background: var(--color-surface-hover); transform: scale(.94); }

/* ----- Main Content ----- */
.app-main {
  flex: 1;
  overflow-y: auto;
  position: relative;
  padding: var(--space-4) var(--space-5) calc(var(--nav-height) + var(--space-6) + env(safe-area-inset-bottom, 0px));
}

.page { display: none; }
.page.active { display: block; }

/* ----- Bottom Nav ----- */
.nav-bar {
  position: fixed;
  bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - var(--space-6));
  max-width: calc(var(--content-max) - var(--space-6));
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 22px;
  display: flex;
  align-items: center;
  z-index: 100;
  padding: var(--space-1) var(--space-1);
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.08), 0 8px 32px rgba(249,115,22,.06);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: var(--space-2) var(--space-1);
  border: none;
  border-radius: 18px;
  background: transparent;
  cursor: pointer;
  color: var(--color-text-muted);
  position: relative;
  transition: all .25s cubic-bezier(.4,0,.2,1);
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, #F97316 0%, #EA580C 100%);
  box-shadow: 0 2px 8px rgba(249,115,22,.35);
  transform: translateY(-2px);
}

.nav-icon  { font-size: 1.125rem; line-height: 1; transition: transform .25s cubic-bezier(.4,0,.2,1); }
.nav-item.active .nav-icon { transform: scale(1.05); }
.nav-label { font-size: 0.625rem; font-weight: 600; letter-spacing: .03em; }

/* ----- Section Headers ----- */
.section-header {
  margin-bottom: var(--space-4);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.section-title {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--color-text);
}

.section-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-top: var(--space-1);
}

/* ----- Hero Banner (Home) ----- */
/* ===== Hero Banner ===== */

.hero-banner {
  background: linear-gradient(160deg, #EA580C 0%, #F97316 35%, #FB923C 60%, #FBA869 100%);
  border-radius: 22px;
  padding: var(--space-8) var(--space-6);
  color: #fff;
  margin-bottom: var(--space-5);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(249,115,22,.2), 0 1px 4px rgba(234,88,12,.15);
}

/* Decorative background blobs */
.hero-bg-layer {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.hero-bg-layer--1 {
  width: 220px; height: 220px;
  top: -60px; right: -50px;
  background: rgba(255,255,255,.07);
  animation: heroBlob1 8s ease-in-out infinite;
}
.hero-bg-layer--2 {
  width: 140px; height: 140px;
  bottom: -30px; left: -20px;
  background: rgba(255,255,255,.05);
  animation: heroBlob2 6s ease-in-out infinite;
}
.hero-bg-layer--3 {
  width: 80px; height: 80px;
  top: 50%; right: 30%;
  background: rgba(255,255,255,.04);
  animation: heroBlob1 10s ease-in-out infinite reverse;
}
@keyframes heroBlob1 {
  0%, 100% { transform: translate(0,0) scale(1); }
  33%      { transform: translate(8px,-6px) scale(1.06); }
  66%      { transform: translate(-4px,4px) scale(.96); }
}
@keyframes heroBlob2 {
  0%, 100% { transform: translate(0,0) scale(1); }
  50%      { transform: translate(-8px,-4px) scale(1.08); }
}

.hero-grain {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: .1;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 128px 128px;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-top {
  margin-bottom: var(--space-5);
}

.hero-greeting {
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.hero-date {
  font-size: var(--text-xs);
  opacity: .65;
  margin-top: 2px;
  font-weight: 400;
}

/* Stats row — glass cards */
.hero-stats {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: rgba(255,255,255,.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 16px;
  padding: var(--space-4);
  border: 1px solid rgba(255,255,255,.15);
}

.hero-stat {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.hero-stat-icon {
  font-size: 1.125rem;
  line-height: 1;
  flex-shrink: 0;
  opacity: .9;
}

.hero-stat-body {
  min-width: 0;
}

.hero-stat-value {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.hero-stat-label {
  font-size: 0.625rem;
  opacity: .65;
  font-weight: 400;
  line-height: 1.2;
}

.hero-stat-divider {
  width: 1px;
  height: 28px;
  background: rgba(255,255,255,.18);
  flex-shrink: 0;
}

/* ===== Quick Actions ===== */

.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: var(--space-3) var(--space-1);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  color: var(--color-text);
  transition: all .2s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}
.quick-action:active {
  transform: scale(.94);
}

.qa-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
  transition: transform .2s var(--ease-out);
}
.quick-action:active .qa-icon-wrap {
  transform: scale(.9);
}

.qa-icon-svg { display: block; }

/* Recommend — warm orange */
.qa-recommend { background: #FFFBF7; }
.qa-recommend .qa-icon-wrap { background: #FFF0E0; color: #F97316; }

/* Copy — indigo */
.qa-copy { background: #FAFBFF; }
.qa-copy .qa-icon-wrap { background: #EEF2FF; color: #4F6EF7; }

/* Analyze — emerald */
.qa-analyze { background: #FAFDFB; }
.qa-analyze .qa-icon-wrap { background: #ECFDF5; color: #059669; }

/* Churn — amber */
.qa-churn { background: #FFFBEB; }
.qa-churn .qa-icon-wrap { background: #FFF7D6; color: #D97706; }

.qa-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--color-text);
}

.qa-desc {
  font-size: 0.5625rem;
  color: var(--color-text-muted);
  font-weight: 400;
}

/* ----- Product Card ----- */
.product-list { display: flex; flex-direction: column; gap: var(--space-3); }

.product-card {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-light);
  transition: all var(--duration-fast) var(--ease-out);
  position: relative;
  cursor: pointer;
}
.product-card:active {
  background: var(--color-surface-hover);
  transform: scale(.985);
}

.product-thumb {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  background: var(--color-primary-soft);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.625rem;
}

.product-body { flex: 1; min-width: 0; }

.product-name {
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-category {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.product-pricing {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}

.price-now {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-primary);
}

.price-cost {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-decoration: line-through;
}

.price-margin {
  font-size: var(--text-xs);
  color: var(--color-success);
  font-weight: 600;
  margin-left: auto;
  background: var(--color-success-bg);
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
}

.product-reason {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-top: var(--space-2);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-tags {
  display: flex;
  gap: var(--space-1);
  margin-top: var(--space-2);
  flex-wrap: wrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: .01em;
}

.tag-warm  { background: var(--color-primary-soft); color: var(--color-primary); }
.tag-cool  { background: #EEF2FF; color: #4F6EF7; }
.tag-green { background: var(--color-success-bg); color: var(--color-success); }

/* ----- Customer Management ----- */
#page-customers.active {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  padding: var(--space-2) var(--space-5) 0;
}

#page-customers .product-list {
  flex: 1;
  overflow-y: auto;
  gap: 4px;
  padding-bottom: calc(var(--nav-height) + var(--space-4) + env(safe-area-inset-bottom, 0px));
}

.customer-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.customer-topbar-left {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}

.customer-topbar-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
}

.customer-topbar-count {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.customer-topbar-actions {
  display: flex;
  gap: var(--space-1);
  flex-shrink: 0;
}

#page-customers .search-bar {
  margin-top: var(--space-1);
  margin-bottom: var(--space-2);
  flex-shrink: 0;
}

.customer-actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
  margin-bottom: var(--space-1);
}

#page-customers .product-card {
  padding: var(--space-4);
  align-items: flex-start;
  cursor: default;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.customer-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #F97316, #FB923C);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(249,115,22,.18);
}

.customer-name-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: 2px;
}

.customer-name {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
}

.customer-phone {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-left: auto;
}

.customer-status {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  flex-shrink: 0;
  line-height: 1.5;
}

.customer-status.active  { background: var(--color-success-bg); color: var(--color-success); }
.customer-status.sleeping { background: var(--color-warning-bg); color: var(--color-warning); }
.customer-status.lost     { background: var(--color-danger-bg); color: var(--color-danger); }

.customer-stats {
  display: flex;
  gap: var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  flex-wrap: wrap;
  line-height: 1.5;
  margin-top: 2px;
}

.customer-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  line-height: 1;
}

.customer-delete:active {
  color: var(--color-danger);
  background: var(--color-danger-bg);
}

/* ----- Feedback Buttons ----- */
.product-actions {
  display: flex;
  gap: var(--space-1);
  margin-top: var(--space-2);
  justify-content: flex-end;
}

.feedback-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--color-surface);
  font-size: 0.875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--duration-fast) var(--ease-out);
}

.feedback-btn:active {
  transform: scale(1.2);
  background: var(--color-primary-soft);
}

/* ----- Feedback Reason Picker ----- */
.feedback-reason-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-4);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  z-index: 1200;
  transform: translateY(100%);
  transition: transform 250ms cubic-bezier(0.16, 1, 0.3, 1);
}
.feedback-reason-panel.show {
  transform: translateY(0);
}
.feedback-reason-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-3);
  text-align: center;
}
.feedback-reason-chips {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.feedback-reason-chip {
  padding: var(--space-3) var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--text-sm);
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--duration-fast);
  text-align: center;
}
.feedback-reason-chip:active {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.feedback-reason-close {
  display: block;
  width: 100%;
  padding: var(--space-3);
  border: none;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  cursor: pointer;
}
.feedback-reason-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 1199;
}

/* ----- Copy Generator ----- */
.form-group { margin-bottom: var(--space-4); }

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.form-select, .form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color var(--duration-fast) var(--ease-out);
  -webkit-appearance: none;
  appearance: none;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23A8A29E' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.form-textarea {
  min-height: 76px;
  resize: vertical;
}

/* Style pills */
.style-pills {
  display: flex;
  gap: var(--space-2);
}

.style-pill {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  text-align: center;
  transition: all var(--duration-fast) var(--ease-out);
}

.style-pill.active {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

/* ----- AI 智能体生成控制台 ----- */
.generate-console {
  height: auto !important;
  min-height: 104px !important;
  padding: var(--space-3) var(--space-4) !important;
  border: 1.5px solid #6366F1 !important;
  border-radius: 14px !important;
  background: linear-gradient(160deg, #1E1B2E 0%, #1A1728 50%, #1E1B2E 100%) !important;
  color: #A5B4FC !important;
  font-size: var(--text-xs) !important;
  font-weight: 400 !important;
  line-height: 1.6 !important;
  text-align: left !important;
  letter-spacing: .01em !important;
  box-shadow: 0 0 12px rgba(99,102,241,.2), 0 4px 24px rgba(99,102,241,.08), inset 0 1px 0 rgba(255,255,255,.04) !important;
  cursor: default !important;
  overflow: hidden !important;
  transition: all .3s ease !important;
}

.console-lines {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.console-line {
  animation: consoleSlideIn .35s cubic-bezier(.16,1,.3,1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.console-prompt {
  color: #818CF8;
  font-weight: 700;
  margin-right: 2px;
}

.console-line.log-info  { color: #94A3B8; }
.console-line.log-think { color: #A5B4FC; }
.console-line.log-action { color: #F9A8D4; }
.console-line.log-highlight { color: #FBBF24; font-weight: 500; }

@keyframes consoleSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Copy result card */
.copy-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.copy-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border-light);
  background: var(--color-surface);
}

.badge {
  font-size: 0.625rem;
  font-weight: 700;
  padding: 3px var(--space-3);
  border-radius: var(--radius-full);
  letter-spacing: .03em;
  text-transform: uppercase;
}

.badge-primary { background: var(--color-primary-soft); color: var(--color-primary); }
.badge-warm    { background: #FFF7ED; color: var(--color-primary); }
.badge-muted   { background: var(--color-surface-hover); color: var(--color-text-muted); }

.copy-card-body {
  padding: var(--space-5);
  font-size: var(--text-base);
  line-height: 1.8;
  white-space: pre-line;
  color: var(--color-text);
}

.copy-card-actions {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-border-light);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
}
.btn:active { background: var(--color-surface-hover); transform: scale(.97); }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  font-weight: 700;
}
.btn-primary:active { background: var(--color-primary-hover); }

.btn-secondary {
  background: var(--color-surface-hover);
  color: var(--color-text);
  border-color: transparent;
}
.btn-secondary:active { background: var(--color-border); }

.btn-outline {
  background: transparent;
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.btn-outline:active { background: var(--color-primary-soft); }

.btn-block { width: 100%; }

.btn-lg {
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-base);
  border-radius: var(--radius-lg);
}

/* ----- Profile Page ----- */
/* ===== Profile Header ===== */
.profile-header {
  text-align: center;
  padding: var(--space-10) var(--space-6) var(--space-8);
  background: linear-gradient(170deg, #FFF8F0 0%, #FFFBF7 30%, #FFFFFF 70%);
  border-radius: 22px;
  margin-bottom: var(--space-5);
  position: relative;
  overflow: hidden;
}
.profile-bg-blob {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  top: -40px;
  right: -30px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(249,115,22,.1) 0%, rgba(249,115,22,.02) 60%, transparent 100%);
}
.profile-bg-blob--small {
  top: auto;
  right: auto;
  bottom: -20px;
  left: -20px;
  width: 100px;
  height: 100px;
  background: radial-gradient(circle, rgba(249,115,22,.06) 0%, transparent 70%);
}

.avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: linear-gradient(135deg, #F97316, #FB923C);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: var(--space-3);
  box-shadow: 0 4px 20px rgba(249,115,22,.28), 0 0 0 4px rgba(249,115,22,.08);
}

.profile-name {
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: 2px;
}

.profile-detail {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.profile-detail + .profile-detail { margin-top: 0; }

.plan-tag {
  display: inline-block;
  margin-top: var(--space-2);
  padding: 3px 12px;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 600;
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.profile-tags {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.role-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
}

.role-tag.merchant {
  background: #FEF3C7;
  color: #D97706;
}

.role-tag.agent {
  background: #EDE9FE;
  color: #7C3AED;
}

/* Quick Action Cards (profile page) */
#page-profile .quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

/* ===== Quick Action Cards (Profile) ===== */
.qa-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-3);
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: all .2s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.qa-card:active { transform: scale(.94); filter: brightness(.96); }

.qa-card--upload { background: linear-gradient(180deg, #FFFBF7, #FFF5EC); }
.qa-card--store  { background: linear-gradient(180deg, #FAFBFF, #F0F4FF); }
.qa-card--promo  { background: linear-gradient(180deg, #FFFBF5, #FFF7E6); }
.qa-card--agent  { background: linear-gradient(180deg, #FAFDFB, #EDF7EE); }
.qa-card--admin  { background: linear-gradient(180deg, #F9F8F6, #ECEBE8); }

.qa-card.qa-span-2 {
  grid-column: 1 / -1;
  max-width: 50%;
  justify-self: center;
}

.qa-card-icon {
  font-size: 28px;
  line-height: 1;
}

.qa-card-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

.qa-card[style*="display:none"],
.qa-card[style*="display: none"] { display: none !important; }

.menu-list {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-light);
  overflow: hidden;
}

.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  transition: background var(--duration-instant) var(--ease-out);
}
.menu-item + .menu-item { border-top: 1px solid var(--color-border-light); }
.menu-item:active { background: var(--color-surface-hover); }

.menu-item-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.menu-item-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .875rem;
}

.menu-item-label {
  font-size: var(--text-base);
  font-weight: 500;
}

.menu-item-extra {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-right: var(--space-2);
}

.menu-item-arrow {
  color: var(--color-text-muted);
  font-size: var(--text-lg);
}

/* ----- Empty State ----- */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--color-text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  opacity: .6;
  animation: emptyFloat 3s ease-in-out infinite;
}
@keyframes emptyFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.empty-state-text {
  font-size: var(--text-sm);
  line-height: 1.5;
}

/* ----- Store Management (Warm Orange Theme) ----- */
#page-store-mgmt {
  --store-gray-50: #FAFAF8;
  --store-gray-100: #F4F3F0;
  --store-gray-200: #EBE9E5;
  --store-gray-300: #D7D5D1;
  --store-gray-500: #A8A29E;
  --store-gray-700: #57534E;
  --store-gray-900: #1C1917;
}

/* ===== Store Banner Card ===== */
.store-banner {
  margin: var(--space-3) var(--space-4) 0;
  padding: var(--space-4);
  background: linear-gradient(145deg, #FFFBF7 0%, #FFF7ED 40%, #FFF5F0 100%);
  border-radius: 16px;
  border: 1px solid rgba(249,115,22,.08);
  box-shadow: 0 1px 3px rgba(0,0,0,.03), 0 4px 14px rgba(249,115,22,.05);
  transition: background .4s ease, box-shadow .4s ease;
}
.store-banner-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.store-banner-icon {
  font-size: 32px;
  flex-shrink: 0;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(249,115,22,.15));
}
.store-banner-info {
  flex: 1;
  min-width: 0;
}
.store-banner-name {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: .01em;
}
.store-banner-settings {
  flex-shrink: 0;
  height: 30px;
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 8px;
  background: rgba(255,255,255,.6);
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0 8px;
  font-size: var(--text-xs);
  font-weight: 500;
  transition: all .2s ease;
}
.store-banner-settings:hover,
.store-banner-settings.open {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(249,115,22,.06);
}
.store-banner-settings .gear-chevron {
  transition: transform .25s ease;
}
.store-banner-settings.open .gear-chevron {
  transform: rotate(180deg);
}

/* Status Row */
.store-banner-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-3);
}
.store-status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: var(--text-xs);
  font-weight: 500;
  transition: all .35s ease;
}
.store-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #A8A29E;
  transition: background .35s ease;
}
.store-status-label {
  transition: color .35s ease;
  color: var(--color-text-muted);
}

/* Open state */
.store-banner.open .store-status-badge {
  background: #ECFDF5;
}
.store-banner.open .store-status-dot {
  background: #10B981;
  box-shadow: 0 0 0 3px rgba(16,185,129,.15);
  animation: statusPulse 2s ease-in-out infinite;
}
.store-banner.open .store-status-label {
  color: #059669;
}
@keyframes statusPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(16,185,129,.15); }
  50%      { box-shadow: 0 0 0 6px rgba(16,185,129,.06); }
}

/* Closed state banner tint */
.store-banner:not(.open) {
  background: linear-gradient(145deg, #FAFAF9 0%, #F6F5F3 40%, #F5F4F1 100%);
  box-shadow: 0 1px 3px rgba(0,0,0,.02), 0 2px 8px rgba(0,0,0,.03);
}

/* Stats */
.store-banner-stats {
  display: flex;
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid rgba(0,0,0,.05);
}
.store-stat {
  flex: 1;
  text-align: center;
  cursor: pointer;
  border-radius: 10px;
  padding: var(--space-2) 0;
  transition: background .15s ease;
}
.store-stat:active {
  background: rgba(249,115,22,.06);
}
.store-stat-num {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
}
.store-stat-desc {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}
.store-stat-divider {
  width: 1px;
  background: rgba(0,0,0,.06);
  margin: var(--space-1) 0;
  flex-shrink: 0;
}

/* iOS-style toggle switch (in banner context) */
.tswitch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}
.tswitch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.tswitch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #D7D3CC;
  border-radius: 26px;
  transition: all .3s cubic-bezier(.4,0,.2,1);
}
.tswitch-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: all .3s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 1px 4px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
}
.tswitch input:checked + .tswitch-slider {
  background: var(--color-primary);
}
.tswitch input:checked + .tswitch-slider::before {
  transform: translateX(18px);
}
  transform: rotate(180deg);
}

/* ===== Store Settings Panel ===== */
.store-settings-panel {
  border-bottom: 1px solid var(--color-border-light);
  background: var(--color-surface);
  overflow: hidden;
  animation: storeSlideDown .25s var(--ease-out);
}
@keyframes storeSlideDown {
  from { max-height: 0; opacity: 0; }
  to   { max-height: 400px; opacity: 1; }
}
.store-settings-inner {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.store-field-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-1);
  letter-spacing: .02em;
  text-transform: uppercase;
}
.store-field-input,
.store-field-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: 10px;
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-surface);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  box-sizing: border-box;
}
.store-field-input:focus,
.store-field-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(249,115,22,.08);
}
.store-field-input::placeholder,
.store-field-textarea::placeholder {
  color: var(--color-text-muted);
}
.store-field-textarea {
  resize: vertical;
  min-height: 56px;
}
.store-field-actions {
  display: flex;
  gap: var(--space-2);
}
.btn-pill {
  flex: 1;
  padding: 9px 0;
  border-radius: 10px;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .2s ease;
}
.btn-pill-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-pill-primary:active {
  background: var(--color-primary-hover);
}
.btn-pill-outline {
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
}
.btn-pill-outline:active {
  background: var(--color-primary-soft);
}

/* ===== Store Tabs Bar ===== */
.store-tabs-bar {
  display: flex;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border-light);
}
.store-tab-item {
  flex: 1;
  padding: var(--space-3);
  border: none;
  background: transparent;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  transition: color .2s;
}
.store-tab-item.active {
  color: var(--color-primary);
  font-weight: 600;
}
.store-tab-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--color-primary);
  border-radius: 1px;
}
.store-tab-count {
  font-size: var(--text-xs);
  font-weight: 400;
  opacity: .7;
}
.store-tab-item.active .store-tab-count {
  opacity: 1;
}

/* ===== Store Tab Panel ===== */
.store-tab-panel {
  display: none;
  padding: var(--space-4) var(--space-4) 0;
  background: var(--color-surface);
}
.store-tab-panel.active {
  display: block;
  animation: storeFadeIn .2s var(--ease-out);
}
@keyframes storeFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Product search */
.store-search-row {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.store-search-input {
  flex: 1;
  height: 36px;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-surface);
  outline: none;
  transition: border-color var(--duration-fast);
}
.store-search-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}
.store-search-input::placeholder {
  color: var(--color-text-muted);
}

.store-search-btn {
  flex-shrink: 0;
  height: 36px;
  padding: 0 var(--space-4);
  border: none;
  border-radius: 8px;
  background: var(--color-primary);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--duration-fast);
}
.store-search-btn:active {
  background: var(--color-primary-hover);
}

/* Search results & shelf */
.store-result-list,
.store-shelf-list {
  border-top: 1px solid var(--color-border-light);
}

.store-result-item,
.store-shelf-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border-light);
}
.store-result-item:last-child,
.store-shelf-item:last-child {
  border-bottom: none;
}

.store-item-thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--color-primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.store-item-info {
  flex: 1;
  min-width: 0;
}
.store-item-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.store-item-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 1px;
}
.store-item-note {
  font-size: var(--text-xs);
  color: var(--color-primary);
  margin-top: 2px;
}

.store-item-actions {
  display: flex;
  gap: var(--space-1);
  flex-shrink: 0;
}
.store-item-actions .btn {
  font-size: var(--text-xs);
  padding: 4px var(--space-3);
  border-radius: 8px;
}

.store-shelf-item.inactive {
  opacity: .4;
}

/* Order filters */
.store-order-filters {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.store-order-filters::-webkit-scrollbar { display: none; }

.store-filter-chip {
  flex-shrink: 0;
  padding: var(--space-1) var(--space-3);
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}
.store-filter-chip.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.store-filter-chip:not(.active):active {
  background: var(--color-surface-hover);
}

/* Order list */
.store-order-list {
  border-top: 1px solid var(--color-border-light);
}

.store-order-item {
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--color-border-light);
}
.store-order-item:last-child {
  border-bottom: none;
}

.store-order-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}
.store-order-sn {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-family: "SF Mono", "Menlo", monospace;
}
.store-order-status {
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 2px var(--space-2);
  border-radius: 4px;
}
.store-order-status.pending   { background: var(--color-warning-bg); color: var(--color-warning); }
.store-order-status.confirmed { background: var(--color-primary-soft); color: var(--color-primary); }
.store-order-status.completed { background: var(--color-success-bg); color: var(--color-success); }
.store-order-status.cancelled { background: var(--color-surface-hover); color: var(--color-text-muted); }

.store-order-items {
  font-size: var(--text-sm);
  color: var(--color-text);
  margin-bottom: var(--space-2);
  line-height: 1.5;
}

.store-order-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.store-order-customer {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.store-order-amount {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
}

.store-order-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
  justify-content: flex-end;
}
.store-order-actions .btn {
  font-size: var(--text-xs);
  border-radius: 8px;
  padding: 4px var(--space-3);
}

/* Empty state */
.store-empty {
  text-align: center;
  padding: var(--space-10) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* ----- Spinner ----- */
.spinner {
  display: flex;
  justify-content: center;
  padding: var(--space-10);
  gap: 6px;
}

.spinner-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-primary);
  animation: dotBounce 1.2s infinite ease-in-out;
}
.spinner-dot:nth-child(2) { animation-delay: .15s; }
.spinner-dot:nth-child(3) { animation-delay: .30s; }

@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(.5); opacity: .3; }
  40% { transform: scale(1); opacity: 1; }
}

/* ----- Toast ----- */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--space-6));
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--color-text);
  color: #fff;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: all var(--duration-normal) var(--ease-out);
  box-shadow: var(--shadow-lg);
  max-width: calc(100vw - 48px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }

/* ----- Alert Cards ----- */
.alert-card {
  padding: var(--space-4);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  border: 1px solid;
}

.alert-critical { background: var(--color-danger-bg); border-color: #FECACA; }
.alert-high     { background: var(--color-warning-bg); border-color: #FDE68A; }
.alert-medium   { background: #FFF7ED; border-color: #FED7AA; }

.alert-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-1);
}

.alert-level {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.alert-critical .alert-level { color: var(--color-danger); }
.alert-high     .alert-level { color: var(--color-warning); }
.alert-medium   .alert-level { color: var(--color-primary); }

.alert-days {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.alert-suggestion {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

/* ----- Growth Cards ----- */
.growth-card {
  padding: var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-light);
  margin-bottom: var(--space-3);
}

.growth-priority {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: var(--space-1);
}

.growth-title { font-size: var(--text-lg); font-weight: 600; margin-bottom: 2px; }
.growth-desc  { font-size: var(--text-sm); color: var(--color-text-secondary); }

/* ----- Search Bar ----- */
.search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: #F8F7F5;
  border: 1.5px solid transparent;
  border-radius: 14px;
  padding: 0 var(--space-4);
  margin-bottom: var(--space-3);
  transition: all .25s var(--ease-out);
}
.search-bar:focus-within {
  background: var(--color-surface);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(249,115,22,.08);
}

.search-icon {
  font-size: 0.875rem;
  opacity: 0.4;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: var(--space-3) 0;
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  color: var(--color-text);
  outline: none;
  min-width: 0;
}
.search-input::placeholder {
  color: var(--color-text-muted);
}

.search-clear {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--color-surface-hover);
  color: var(--color-text-muted);
  font-size: 0.625rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.search-clear:active { background: var(--color-border); }

/* ----- Filter Chips (horizontal scroll) ----- */
.filter-scroll {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-3);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filter-scroll::-webkit-scrollbar { display: none; }

/* ===== Filter Chips ===== */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--color-surface);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all .2s var(--ease-out);
  flex-shrink: 0;
}
.filter-chip:active { transform: scale(.95); }
.filter-chip.active {
  background: #FFF7ED;
  border-color: rgba(249,115,22,.2);
  color: #EA580C;
  box-shadow: 0 1px 3px rgba(249,115,22,.06);
}

.filter-chip-count {
  font-weight: 400;
  opacity: 0.5;
  font-size: 0.5625rem;
}

/* ===== Sort Bar ===== */
.sort-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border-light);
}

.sort-label {
  font-size: var(--text-sm);
  color: var(--color-text);
  font-weight: 600;
}

.sort-select {
  border: none;
  border-radius: 8px;
  padding: 6px 28px 6px 12px;
  font-size: var(--text-xs);
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--color-text-secondary);
  background: #F4F2EF;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2378716C' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.sort-select:focus { outline: none; }

/* ===== Tab Toggle — Refined Pill ===== */
.tab-toggle {
  display: flex;
  background: #F4F2EF;
  border-radius: 14px;
  padding: 4px;
  margin-bottom: var(--space-5);
  position: relative;
}

.tab-toggle-btn {
  flex: 1;
  padding: var(--space-2) var(--space-4);
  border: none;
  border-radius: 11px;
  background: transparent;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all .25s var(--ease-out);
  position: relative;
  z-index: 1;
  letter-spacing: .01em;
}

.tab-toggle-btn.active {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
}

/* ===== Price Filter ===== */
.price-filter-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.price-input {
  width: 0;
  flex: 1;
  min-width: 60px;
  padding: var(--space-2) var(--space-3);
  border: 1.5px solid transparent;
  border-radius: 10px;
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  color: var(--color-text);
  background: #F8F7F5;
  outline: none;
  -moz-appearance: textfield;
  transition: all .2s var(--ease-out);
}
.price-input:focus {
  background: var(--color-surface);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(249,115,22,.06);
}
.price-input::-webkit-inner-spin-button,
.price-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

.price-separator {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  flex-shrink: 0;
  font-weight: 500;
}

.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--color-text-muted);
}
.btn-ghost:active {
  background: var(--color-surface-hover);
}

/* ----- Category Grid (Home) ----- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-3) var(--space-1);
  border-radius: 14px;
  cursor: pointer;
  transition: all .2s var(--ease-out);
  border: none;
}
.category-card:nth-child(4n+1) { background: #FFFBF7; }
.category-card:nth-child(4n+2) { background: #FAFBFF; }
.category-card:nth-child(4n+3) { background: #FAFDFB; }
.category-card:nth-child(4n+4) { background: #FFF5F5; }
.category-card:active {
  transform: scale(.94);
  filter: brightness(.97);
}

.category-card-icon {
  font-size: 1.625rem;
  line-height: 1;
}

.category-card-name {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  line-height: 1.2;
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-6) 0 var(--space-4);
}

.page-btn {
  padding: var(--space-2) var(--space-4);
  border: none;
  border-radius: 10px;
  background: var(--color-surface);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-primary);
  cursor: pointer;
  transition: all .2s var(--ease-out);
}
.page-btn:active { background: #FFF7ED; transform: scale(.95); }
.page-btn[disabled] {
  color: var(--color-text-muted);
  pointer-events: none;
  opacity: 0.35;
}

.page-info {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ----- Product Detail Modal ----- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--ease-out);
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 100%;
  max-width: var(--content-max);
  max-height: 85vh;
  margin: 0 var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  position: relative;
  padding: var(--space-5);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalIn var(--duration-normal) var(--ease-out);
}

@keyframes modalIn {
  from { transform: translateY(20px) scale(0.96); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* ========== Upload Product Modal ========== */

.upload-modal {
  width: 100%;
  max-width: 448px;
  max-height: 92vh;
  margin: auto var(--space-4);
  background: var(--color-surface);
  border-radius: 22px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: uploadModalIn .35s cubic-bezier(.34,1.56,.64,1);
  box-shadow: 0 0 0 1px rgba(0,0,0,.04), 0 8px 32px rgba(0,0,0,.12), 0 20px 64px rgba(249,115,22,.08);
}
@keyframes uploadModalIn {
  from { transform: translateY(32px) scale(.92); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.upload-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,.06);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .2s, color .2s;
  -webkit-tap-highlight-color: transparent;
}
.upload-modal-close:active { background: rgba(0,0,0,.12); color: var(--color-text); }

/* Header */
.upload-header {
  padding: var(--space-6) var(--space-5) var(--space-3);
  text-align: center;
  background: linear-gradient(180deg, #FFFBF7 0%, #FFF8F0 60%, var(--color-surface) 100%);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.upload-header-visual {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  margin-bottom: var(--space-3);
}
.upload-header-blob {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, rgba(249,115,22,.18) 0%, rgba(249,115,22,.04) 70%, transparent 100%);
  animation: uploadBlobPulse 3s ease-in-out infinite;
}
@keyframes uploadBlobPulse {
  0%, 100% { transform: scale(1); opacity: .7; }
  50%      { transform: scale(1.12); opacity: 1; }
}
.upload-header-emoji {
  position: relative;
  z-index: 1;
  font-size: 36px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(249,115,22,.25));
}
.upload-header-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--color-text);
}
.upload-header-desc {
  margin: 4px 0 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* Body */
.upload-body {
  padding: var(--space-3) var(--space-5) var(--space-6);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;
}

/* Image Zone */
.upload-zone {
  background: #FBFAF7;
  border: 2px dashed #E8E4DA;
  border-radius: 16px;
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  transition: border-color .25s;
}
.upload-zone:has(.upload-previews:not(:empty)) {
  border-style: solid;
  border-color: #E8E4DA;
}
.upload-zone-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text);
}
.upload-zone-hint {
  font-weight: 500;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  background: rgba(0,0,0,.04);
  padding: 2px 8px;
  border-radius: 100px;
}
.upload-zone-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* Preview images */
.upload-previews {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.upload-previews:empty { display: none; }
.upload-preview-item {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  animation: previewIn .3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes previewIn {
  from { transform: scale(.6); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.upload-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.upload-preview-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 12px;
  line-height: 22px;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
  -webkit-tap-highlight-color: transparent;
}
.upload-preview-del:active { background: rgba(0,0,0,.7); }

/* Upload buttons */
.upload-zone-actions {
  display: flex;
  gap: var(--space-2);
}
.upload-zone-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: var(--space-3);
  border-radius: 12px;
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 600;
  transition: all .2s;
  -webkit-tap-highlight-color: transparent;
  color: var(--color-text-secondary);
  background: var(--color-surface);
  border: 1.5px solid #E8E4DA;
}
.upload-zone-btn input[type="file"] { display: none; }
.upload-zone-btn:active {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: #FFF7ED;
}
.upload-zone-btn--camera { color: #F97316; border-color: rgba(249,115,22,.25); background: #FFFBF7; }
.upload-zone-btn--album  { color: #8B5CF6; border-color: rgba(139,92,246,.25); background: #FBFAFE; }

/* Section */
.upload-section {
  margin-bottom: var(--space-4);
}
.upload-section-chip {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--space-3);
  padding: 3px 10px;
  border-radius: 100px;
  background: linear-gradient(135deg, #FFF7ED, #FFF0E0);
}

/* Fields */
.upload-field {
  margin-bottom: var(--space-3);
}
.upload-field-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}
.upload-required { color: var(--color-primary); }
.upload-field-unit { color: var(--color-text-muted); font-weight: 400; }
.upload-field-optional { color: var(--color-text-muted); font-weight: 400; font-size: var(--text-xs); }

/* Rows */
.upload-row {
  display: flex;
  gap: var(--space-3);
}
.upload-field--half { flex: 1; }
.upload-field--third { flex: 1; }

/* Promotion hint */
.upload-promo-hint {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: linear-gradient(135deg, #FFFBEB, #FFF7ED);
  border-radius: 12px;
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  border: 1px solid rgba(249,115,22,.1);
}
.upload-promo-icon { font-size: 16px; line-height: 1; flex-shrink: 0; margin-top: 1px; }
.upload-promo-link { color: var(--color-primary); font-weight: 700; text-decoration: none; }

/* Submit */
.upload-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #F97316 0%, #EA580C 100%);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
  transition: all .2s;
  box-shadow: 0 4px 16px rgba(249,115,22,.3), 0 1px 4px rgba(249,115,22,.15);
  -webkit-tap-highlight-color: transparent;
}
.upload-submit:active {
  transform: scale(.98);
  box-shadow: 0 2px 8px rgba(249,115,22,.25);
}
.upload-submit:disabled {
  opacity: .6;
  pointer-events: none;
}
.upload-submit-icon { font-size: 18px; line-height: 1; }

.modal-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 1rem;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}
.modal-close:active { background: var(--color-surface-hover); }

.modal-scroll {
  overflow-y: auto;
  padding-top: var(--space-4);
  -webkit-overflow-scrolling: touch;
}

/* Detail content */
.detail-emoji {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  background: var(--color-primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: var(--space-3);
}

.detail-name {
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: var(--space-2);
}

.detail-brand {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-3);
}

.detail-pricing {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
  border: 1px solid var(--color-border-light);
}

.detail-price-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.detail-price-now {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-primary);
}

.detail-price-cost {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: line-through;
}

.detail-margin {
  font-size: var(--text-xs);
  color: var(--color-success);
  font-weight: 600;
  background: var(--color-success-bg);
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  margin-left: auto;
}

.detail-section {
  margin-bottom: var(--space-5);
}

.detail-section h4 {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
  letter-spacing: .02em;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  border: 1px solid var(--color-border-light);
}

.detail-label {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}

.detail-desc {
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--color-text-secondary);
}

.detail-spec {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
  border-radius: var(--radius-sm);
}

.detail-tags {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.detail-actions {
  padding: var(--space-6) 0 var(--space-4);
}

/* ----- Product Image Carousel ----- */
.pd-carousel {
  margin: calc(-1 * var(--space-5)) calc(-1 * var(--space-5)) var(--space-4);
  position: relative;
}

.pd-carousel-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-radius: 18px 18px 0 0;
}
.pd-carousel-track::-webkit-scrollbar { display: none; }

.pd-carousel-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  aspect-ratio: 1 / 1;
  background: #F4F3F0;
}

.pd-carousel-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pd-carousel-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: var(--space-2) 0 0;
}

.pd-dot {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: #D6D3CE;
  transition: all .25s ease;
}
.pd-dot.active {
  width: 18px;
  background: var(--color-primary);
}

.pd-carousel-arrow {
  position: absolute;
  top: calc(50% - 38px);
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: background .2s;
}
.pd-carousel-arrow:active { background: rgba(0,0,0,.65); }
.pd-carousel-prev { left: 8px; }
.pd-carousel-next { right: 8px; }

/* ----- Product Detail (redesigned) ----- */
.pd-header {
  text-align: center;
  padding-bottom: var(--space-4);
}
.pd-category-badge {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  border-radius: 99px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-size: var(--text-xs);
  font-weight: 600;
  margin-bottom: var(--space-3);
}
.pd-name {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.4;
  margin: 0 0 var(--space-1) 0;
}
.pd-brand {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.pd-price-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-light);
  margin-bottom: var(--space-4);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.pd-price-main {
  flex: 1;
  text-align: center;
  min-width: 72px;
}
.pd-price-value {
  display: block;
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.2;
}
.pd-price-value.pd-price-cost {
  color: var(--color-text-secondary);
  font-size: var(--text-lg);
}
.pd-price-label {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}
.pd-margin-badge {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  border-radius: 99px;
  background: #DCFCE7;
  color: #16A34A;
  font-size: var(--text-lg);
  font-weight: 700;
}
.pd-price-divider {
  width: 1px;
  height: 36px;
  background: var(--color-border);
  flex-shrink: 0;
}

.pd-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-light);
  margin-bottom: var(--space-4);
}
.pd-info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border-light);
}
.pd-info-item:last-child,
.pd-info-item:nth-last-child(2):nth-child(odd) {
  border-bottom: none;
}
.pd-info-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 500;
}
.pd-info-value {
  font-size: var(--text-sm);
  color: var(--color-text);
  font-weight: 600;
}

.pd-section {
  margin-bottom: var(--space-4);
}
.pd-section-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 var(--space-2) 0;
}
.pd-desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin: 0;
}
.pd-spec {
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  background: var(--color-surface);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-light);
}
.pd-tags {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.pd-tag {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  border-radius: 99px;
  font-size: var(--text-xs);
  font-weight: 600;
}
.pd-tag-warm { background: var(--color-primary-soft); color: var(--color-primary); }
.pd-tag-cool { background: #EEF2FF; color: #4F46E5; }
.pd-tag-green { background: #DCFCE7; color: #16A34A; }

.pd-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4) 0 var(--space-2);
}

/* Secondary button */
.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1.5px solid var(--color-border);
  font-weight: 600;
}
.btn-secondary:active {
  background: var(--color-surface-hover);
  border-color: var(--color-text-muted);
}

/* ----- Subscription Info Card ----- */
.sub-info-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-light);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
}

.sub-info-grid {
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.sub-info-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) 0;
}

.sub-info-divider {
  width: 1px;
  height: 36px;
  background: var(--color-border-light);
  flex-shrink: 0;
}

.sub-info-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.sub-info-value {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
}

/* ----- Plan Cards ----- */
.plan-card {
  position: relative;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-3);
  text-align: center;
}

.plan-featured {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary), 0 4px 16px rgba(249,115,22,.12);
}

.plan-ribbon {
  position: absolute;
  top: -1px;
  right: var(--space-4);
  background: var(--color-primary);
  color: #fff;
  padding: 2px var(--space-4);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-size: 0.625rem;
  font-weight: 700;
}

.plan-current-tag {
  position: absolute;
  top: var(--space-3);
  left: var(--space-4);
  background: var(--color-success-bg);
  color: var(--color-success);
  padding: 1px var(--space-2);
  border-radius: var(--radius-sm);
  font-size: 0.625rem;
  font-weight: 700;
}

.plan-current {
  border-color: var(--color-success);
  background: var(--color-success-bg);
  opacity: 0.85;
}

.plan-name {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-top: var(--space-2);
  margin-bottom: var(--space-1);
}

.plan-price {
  margin-bottom: var(--space-1);
}

.plan-price-value {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--color-primary);
}

.plan-price-unit {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.plan-period-prices {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

.plan-features {
  list-style: none;
  text-align: left;
  margin-bottom: var(--space-4);
}

.plan-features li {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  padding: var(--space-1) 0;
}

.btn-disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* ----- Period Option ----- */
.period-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}
.period-option:active {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
}

/* ----- Settings Form ----- */
.settings-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.form-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
}
.form-input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-surface);
  outline: none;
  transition: border-color 200ms;
  box-sizing: border-box;
}
.form-input:focus {
  border-color: var(--color-primary);
}

/* ----- Nav Badge ----- */
.nav-icon-badge-wrap {
  position: relative;
  display: inline-flex;
}
.nav-badge {
  position: absolute;
  top: -6px;
  right: -10px;
  min-width: 18px;
  height: 18px;
  border-radius: 99px;
  background: var(--color-danger);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 2px 6px rgba(220,38,38,.35);
  pointer-events: none;
}

/* ----- Bell Badge (header) ----- */
.header-bell {
  position: relative;
}
.bell-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  border-radius: 99px;
  background: var(--color-danger);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 2px 6px rgba(220,38,38,.35);
  pointer-events: none;
}

/* ----- Promotion Center ----- */
/* ===== Promotions — Stats Cards ===== */
.promo-stats-row {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-4) var(--space-3);
}
.promo-stat-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-3);
  border-radius: 14px;
}
.promo-stat-card--total  { background: linear-gradient(135deg, #FFF7ED, #FFF0E0); }
.promo-stat-card--month  { background: linear-gradient(135deg, #ECFDF5, #D1FAE5); }
.promo-stat-card--pending { background: linear-gradient(135deg, #FFFBEB, #FEF3C7); }
.promo-stat-icon {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}
.promo-stat-body { min-width: 0; }
.promo-stat-value {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.promo-stat-card--total  .promo-stat-value { color: #C2410C; }
.promo-stat-card--month  .promo-stat-value { color: #065F46; }
.promo-stat-card--pending .promo-stat-value { color: #B45309; }
.promo-stat-label {
  font-size: 0.625rem;
  color: var(--color-text-muted);
  font-weight: 500;
  line-height: 1.2;
}

/* ===== Subscribe Banner ===== */
.promo-sub-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: calc(100% - var(--space-8));
  margin: 0 auto var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: linear-gradient(135deg, #FFFBF7, #FFF7ED);
  border: 1px solid rgba(249,115,22,.12);
  border-radius: 12px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-primary);
  cursor: pointer;
  transition: all .2s var(--ease-out);
}
.promo-sub-btn:active {
  background: #FFF0E0;
  border-color: rgba(249,115,22,.25);
}
.promo-sub-btn:disabled {
  background: #F0FDF4;
  color: #065F46;
  border-color: #BBF7D0;
  cursor: default;
}
.promo-sub-icon { font-size: 1rem; line-height: 1; }
.promo-sub-text { letter-spacing: .01em; }

/* ===== Campaign Cards ===== */
.promo-campaign-list {
  padding: 0 var(--space-4);
}
.promo-campaign-card {
  background: linear-gradient(160deg, #FFFBF5 0%, #FFF8F0 40%, #FFFFFF 100%);
  border: 1px solid #FDE8D0;
  border-radius: 14px;
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  box-shadow: 0 1px 2px rgba(249,115,22,.03);
  transition: box-shadow .2s, transform .15s;
}
.promo-campaign-card:active {
  box-shadow: 0 4px 16px rgba(249,115,22,.08);
  transform: scale(.985);
}
.promo-campaign-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: #1C1917;
  margin-bottom: 2px;
  letter-spacing: -0.01em;
}
.promo-campaign-desc {
  font-size: var(--text-sm);
  color: #78716C;
  margin-bottom: var(--space-3);
  line-height: 1.5;
}

.promo-campaign-meta {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}
.promo-meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 8px;
}
.promo-meta-tag--fee {
  background: linear-gradient(135deg, #FFF7ED, #FFEDD5);
  color: #C2410C;
}
.promo-meta-tag--count {
  background: #F4F3F0;
  color: #57534E;
}
.promo-meta-tag--end {
  background: #FEF2F2;
  color: #B91C1C;
}

.promo-campaign-products {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.promo-product-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #FFFFFF;
  border: 1px solid #EBE9E5;
  border-radius: 100px;
  padding: 5px 14px 5px 5px;
  font-size: var(--text-xs);
  font-weight: 500;
  color: #44403C;
  cursor: pointer;
  transition: all .15s;
}
.promo-product-pill:active {
  transform: scale(.97);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.promo-product-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.promo-product-thumb-emoji {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

/* ===== Earnings List ===== */
.promo-earning-list {
  padding: 0 var(--space-4) var(--space-6);
}
.promo-earning-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-2);
  background: var(--color-surface);
  border-radius: 12px;
  transition: background .15s;
}
.promo-earning-item:active {
  background: #FFFBF7;
}
.promo-earning-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.promo-earning-campaign {
  font-size: var(--text-sm);
  font-weight: 600;
  color: #1C1917;
}
.promo-earning-date {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.promo-earning-right {
  text-align: right;
  flex-shrink: 0;
  margin-left: var(--space-3);
}
.promo-earning-amount {
  font-size: var(--text-lg);
  font-weight: 700;
  color: #059669;
  letter-spacing: -0.02em;
  line-height: 1;
}
.promo-earning-status {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  margin-top: 4px;
}
.promo-earning-status--confirmed {
  background: #ECFDF5;
  color: #059669;
}
.promo-earning-status--pending {
  background: #FFFBEB;
  color: #D97706;
}

/* Promo campaign detail overlay */
.promo-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn .2s;
}
.promo-detail-card {
  background: #FFF;
  border-radius: 16px 16px 0 0;
  padding: var(--space-5);
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp .25s var(--ease-out-expo);
}

/* Promo campaign card actions */
.promo-campaign-actions {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid #F0EFEA;
}

.promo-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  justify-content: center;
  padding: var(--space-2) var(--space-4);
  background: linear-gradient(135deg, var(--color-primary-soft), #FFF0E6);
  border: 1px solid #FFC896;
  border-radius: 10px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-primary);
  cursor: pointer;
  transition: all .15s;
  -webkit-tap-highlight-color: transparent;
}
.promo-copy-btn:active {
  background: var(--color-primary-pale);
  transform: scale(.98);
}

/* Promo copy panel (bottom sheet) */
.promo-copy-panel {
  background: var(--color-bg);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp .25s var(--ease-out-expo);
}

.promo-copy-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border-light);
  flex-shrink: 0;
}

.promo-copy-title {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
}

.promo-copy-close {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface-hover);
  border: none;
  border-radius: 50%;
  font-size: 1rem;
  color: var(--color-text-muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.promo-copy-close:active { background: var(--color-border); }

.promo-copy-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) var(--space-5);
}

/* Product chip selection */
.promo-copy-products { margin-bottom: var(--space-4); }

.promo-copy-products-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.promo-copy-products-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.promo-copy-product-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: 100px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all .15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.promo-copy-product-chip.is-checked {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
  color: var(--color-primary);
  font-weight: 600;
}
.promo-copy-product-chip:active { transform: scale(.96); }

.promo-copy-chip-icon {
  font-size: 0.75rem;
  width: 16px;
  text-align: center;
}

/* Chat bubble preview */
.promo-result-section {
  margin-top: var(--space-4);
  animation: fadeIn .3s;
}

.promo-result-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.promo-chat-bubble {
  background: #95EC69;
  border-radius: 4px 16px 16px 16px;
  padding: var(--space-4);
  font-size: var(--text-sm);
  line-height: 1.8;
  color: #1C1917;
  position: relative;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.promo-chat-bubble::before {
  content: '';
  position: absolute;
  top: 0;
  left: -8px;
  width: 0;
  height: 0;
  border-top: 8px solid #95EC69;
  border-left: 8px solid transparent;
}

/* Product cards in result */
.promo-result-products {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.promo-result-product-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: 12px;
  padding: var(--space-3);
}

.promo-result-product-img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.promo-result-product-emoji {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
  background: var(--color-bg);
  border-radius: 8px;
}

.promo-result-product-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.promo-result-product-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

.promo-result-product-price {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-primary);
}

.promo-result-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

/* Copy page — product cards in result */
.copy-result-products {
  padding: 0 var(--space-4) var(--space-4);
}

.copy-product-mini {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  border-radius: 10px;
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-1);
}

.copy-product-mini-emoji {
  font-size: 24px;
  flex-shrink: 0;
}

.copy-product-mini-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.copy-product-mini-name {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text);
}

.copy-product-mini-price {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--color-primary);
}

/* ----- Notifications ----- */
.notif-actions {
  display: flex;
  justify-content: flex-end;
  padding: var(--space-2) var(--space-4);
}
.notif-list {
  padding: 0 var(--space-4) var(--space-4);
}
.notif-item {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-2);
  cursor: pointer;
  transition: background var(--duration-fast);
}
.notif-item:active {
  background: var(--color-surface);
}
.notif-unread {
  border-left: 3px solid var(--color-primary);
  background: var(--color-primary-soft);
}
.notif-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-1);
}
.notif-item-type {
  font-size: var(--text-xs);
  color: var(--color-primary);
  font-weight: 600;
  background: var(--color-primary-pale);
  padding: 1px 8px;
  border-radius: var(--radius-full);
}
.notif-item-time {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.notif-item-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 2px;
}
.notif-item-content {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  line-height: 1.5;
}
.notif-dot {
  position: absolute;
  top: var(--space-3);
  right: var(--space-4);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
}

/* ----- Cart Page ----- */
.cart-items {
  padding: 0 var(--space-4);
}

/* Cart item */
.cart-item {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  align-items: center;
  border-bottom: 1px solid var(--color-border-light);
}
.cart-item-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-soft);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}
.cart-item-info {
  flex: 1;
  min-width: 0;
}
.cart-item-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cart-item-price {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.cart-item-qty {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.cart-qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast);
}
.cart-qty-btn:active {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.cart-qty-num {
  font-size: var(--text-sm);
  font-weight: 600;
  width: 24px;
  text-align: center;
  color: var(--color-text);
}
.cart-item-subtotal {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-primary);
  min-width: 48px;
  text-align: right;
}

/* ----- Add to Cart Button on Product Cards ----- */
.btn-cart {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-primary);
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast);
  white-space: nowrap;
}
.btn-cart:active {
  background: var(--color-primary);
  color: #fff;
}

.btn-shelf {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-success);
  background: var(--color-success-bg);
  color: var(--color-success);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast);
  white-space: nowrap;
}
.btn-shelf:active {
  background: var(--color-success);
  color: #fff;
}
.btn-shelf-added {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface-hover);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
}

/* ----- Delivery Toggle ----- */
.delivery-toggle {
  display: flex;
  gap: var(--space-3);
}
.delivery-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-2);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast);
}
.delivery-option.active {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  color: var(--color-primary);
}
.delivery-icon {
  font-size: 1.5rem;
  line-height: 1;
}

/* ----- Order Summary ----- */
.order-summary {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-light);
  padding: var(--space-3);
  margin-bottom: var(--space-4);
}
.order-summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) 0;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}
.order-summary-item + .order-summary-item {
  border-top: 1px solid var(--color-border-light);
}
.order-summary-item-name {
  flex: 1;
  margin-right: var(--space-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.order-summary-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-3);
  margin-top: var(--space-2);
  border-top: 1px solid var(--color-border);
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--color-text);
}

/* ----- Subscription Gate ----- */
.sub-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 2500;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 200ms ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sub-gate-card {
  width: 100%;
  max-width: var(--content-max);
  background: var(--color-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-8) var(--space-5) var(--space-10);
  text-align: center;
  animation: slideUp 300ms cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 85vh;
  overflow-y: auto;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sub-gate-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
}
.sub-gate-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}
.sub-gate-desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: var(--space-6);
}

.sub-gate-prices {
  text-align: left;
  margin-bottom: var(--space-5);
}
.sub-gate-plan {
  display: flex;
  flex-direction: column;
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border-light);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  cursor: pointer;
  transition: all var(--duration-fast);
}
.sub-gate-plan:active,
.sub-gate-plan.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
}
.sub-gate-plan-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-1);
}
.sub-gate-plan-name {
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--color-text);
}
.sub-gate-plan-price {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-primary);
}
.sub-gate-plan-features {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ----- Product Picker (Copywriting page) ----- */
.product-picker {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  overflow: hidden;
}
.product-picker-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: var(--space-3);
  min-height: 44px;
  align-items: center;
}
.product-picker-placeholder {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.product-picker-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 600;
}
.product-picker-chip-remove {
  width: 18px; height: 18px;
  border: none;
  border-radius: 50%;
  background: rgba(244,129,32,0.2);
  color: var(--color-primary);
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}
.product-picker-search {
  border-top: 2px solid var(--color-primary);
  padding: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-surface);
}
.product-picker-search .search-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}
.product-picker-search .search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: var(--text-base);
  outline: none;
  color: var(--color-text);
}
.product-picker-dropdown {
  max-height: 260px;
  overflow-y: auto;
  border-top: 1px solid var(--color-border-light);
  background: var(--color-surface);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  position: relative;
  z-index: 20;
}
.product-picker-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  border-bottom: 1px solid var(--color-border-light);
  transition: background 0.15s;
}
.product-picker-item:active {
  background: var(--color-primary-soft);
}
.product-picker-item.selected {
  background: #FFF7ED;
}
.product-picker-item-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.product-picker-item-info {
  flex: 1;
  min-width: 0;
}
.product-picker-item-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.product-picker-item-price {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.product-picker-add {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.product-picker-check {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--color-success);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}

/* ----- Responsive ----- */
@media (min-width: 480px) {
  .app {
    border-left: 1px solid var(--color-border-light);
    border-right: 1px solid var(--color-border-light);
  }
}

/* ===== Product Thumbnail Images ===== */
.product-thumb img,
.store-item-thumb img,
.cart-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

@media (max-width: 360px) {
  :root {
    --text-base: 0.875rem;
    --text-lg: 1rem;
    --text-xl: 1.125rem;
    --text-2xl: 1.375rem;
  }
  .app-main { padding: var(--space-4) var(--space-4) calc(var(--nav-height) + var(--space-4) + env(safe-area-inset-bottom, 0px)); }
  .quick-actions { grid-template-columns: repeat(4, 1fr); gap: var(--space-2); }
  .quick-action { padding: var(--space-3) var(--space-1); }
  .quick-action-icon { width: 32px; height: 32px; font-size: 1rem; }
}

/* ===== Quick Profile Setup Card (Cold Start) ===== */
.profile-setup-card {
  background: linear-gradient(135deg, #FFF7ED 0%, #FFFFFF 50%, #FFF7ED 100%);
  border: 1px solid #FED7AA;
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  position: relative;
  overflow: hidden;
}
.profile-setup-card::before {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 80px; height: 80px;
  background: #FED7AA;
  border-radius: 50%;
  opacity: 0.3;
}
.profile-setup-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.profile-setup-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-lg);
  background: var(--color-primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.profile-setup-heading h3 {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 2px;
}
.profile-setup-heading p {
  font-size: var(--text-xs);
  color: #78716C;
  margin: 0;
}
.profile-setup-templates {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-3);
}
.profile-tpl-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #E8E4DF;
  border-radius: var(--radius-md);
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}
.profile-tpl-btn:hover {
  border-color: var(--color-primary);
  background: #FFF7ED;
  transform: translateX(2px);
}
.profile-tpl-btn.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  box-shadow: 0 0 0 2px rgba(249,115,22,0.15);
}
.profile-tpl-emoji {
  font-size: 1.25rem;
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  background: #FFF7ED;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.profile-tpl-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  min-width: 80px;
}
.profile-tpl-desc {
  font-size: var(--text-xs);
  color: #A8A29E;
  margin-left: auto;
  white-space: nowrap;
}
.profile-setup-divider {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  color: #A8A29E;
  font-size: var(--text-xs);
}
.profile-setup-divider::before,
.profile-setup-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #E8E4DF;
}
.profile-setup-textarea {
  width: 100%;
  min-height: 72px;
  padding: var(--space-4) var(--space-4);
  border: 1px solid #E8E4DF;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  background: #fff;
  color: var(--color-text);
  transition: border-color 0.15s ease;
  box-sizing: border-box;
  word-break: break-word;
  overflow-wrap: break-word;
  -webkit-appearance: none;
}
.profile-setup-textarea:focus {
  border-color: var(--color-primary);
}
.profile-setup-textarea::placeholder {
  color: #C4BEB9;
  line-height: 1.6;
}
.profile-setup-submit {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: var(--space-3);
  background: linear-gradient(135deg, #F97316, #FB923C);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.profile-setup-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(249,115,22,0.25);
}
.profile-setup-submit:disabled {
  opacity: 0.5;
  transform: none;
  cursor: default;
}
.profile-setup-skip {
  display: block;
  width: 100%;
  padding: 10px;
  margin-top: var(--space-2);
  background: none;
  border: none;
  color: #A8A29E;
  font-size: var(--text-xs);
  cursor: pointer;
}

/* ===== 推广 Feed 卡片（一品一卡）===== */
.promo-feed-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.promo-feed-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.promo-feed-img-wrap {
  width: 100%;
  height: 200px;
  background: var(--color-bg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.promo-feed-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.promo-feed-img-emoji {
  font-size: 4rem;
}

.promo-feed-body {
  padding: var(--space-3);
}

.promo-feed-name {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.4;
  margin-bottom: 2px;
}

.promo-feed-price {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: var(--space-2);
}

.promo-feed-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-bottom: var(--space-2);
}

.promo-feed-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: var(--text-xs);
  font-weight: 500;
}

.promo-feed-tag--fee {
  background: #FFF7ED;
  color: #F97316;
}

.promo-feed-tag--comm {
  background: #F0FDF4;
  color: #16A34A;
}

.promo-feed-tag--end {
  background: #FEF2F2;
  color: #DC2626;
}

.promo-feed-earn {
  font-size: var(--text-sm);
  color: var(--color-text);
  padding: var(--space-1) var(--space-2);
  background: #FFF7ED;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-1);
  display: inline-block;
}

.promo-feed-earn strong {
  color: #EA580C;
  font-size: var(--text-base);
}

.promo-feed-merchant {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.promo-feed-actions {
  padding: 0 var(--space-3) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.promo-go-btn {
  width: 100%;
  padding: var(--space-2) 0;
  font-size: var(--text-base);
  font-weight: 600;
}

/* ===== 单品文案页 ===== */
.pc-step {
  margin-bottom: var(--space-5);
}

.pc-step-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.pc-step-num {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-primary);
  background: #FFF7ED;
  padding: 2px 8px;
  border-radius: 100px;
}

.pc-step-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
}

.pc-product-preview {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--color-bg-muted);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-bottom: var(--space-4);
}

.pc-product-img {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-md);
  object-fit: cover;
}

.pc-product-img-emoji {
  font-size: 3rem;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pc-product-info {
  flex: 1;
}

.pc-product-name {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.4;
}

.pc-product-price {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-primary);
  margin-top: 2px;
}

.pc-share-btn {
  background: #07C160;
  color: #fff;
  border: none;
  margin-top: 10px;
}

.pc-share-btn:active {
  background: #06AD56;
}

/* ===== WeChat Share Guide Overlay ===== */

.wx-share-guide-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12px;
  animation: wxGuideFadeIn 0.3s ease;
}

@keyframes wxGuideFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.wx-share-guide-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-5);
  max-width: 300px;
  width: 85%;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
  animation: wxGuideSlideDown 0.3s ease;
}

@keyframes wxGuideSlideDown {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.wx-share-guide-arrow {
  font-size: 2rem;
  margin-bottom: var(--space-2);
  animation: wxArrowBounce 1.5s ease infinite;
}

@keyframes wxArrowBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.wx-share-guide-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.wx-share-guide-sub {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

.wx-share-guide-tip {
  font-size: var(--text-xs);
  color: var(--color-primary);
  background: #FFF7ED;
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-4);
}

.wx-share-guide-close {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}
