/* ============================================================
   E · Mini App (Telegram WebView) shared chrome
   依赖 _tokens.css(已含 [data-telegram="1"] override)
   ============================================================ */

/* Phone-shaped browser frame for demo previews */
.tg-stage { min-height: 100vh; background: linear-gradient(180deg, #1A2924 0%, #0F1F1A 100%); display: flex; align-items: flex-start; justify-content: center; padding: 28px 16px 60px; }
.tg-stage__inner { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.tg-stage__label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; color: rgba(255,255,255,.5); text-transform: uppercase; }

/* —— Full-viewport mode (each mini-*.html when opened directly) —— */
.tg-page { max-width: 480px; margin: 0 auto; background: var(--color-bg); min-height: 100vh; display: flex; flex-direction: column; box-shadow: 0 0 40px rgba(0,0,0,.08); }
body.tg-mode { background: linear-gradient(180deg, #1A2924, #0F1F1A); margin: 0; }
body.tg-mode .tg-page { background: var(--color-bg); }
@media (min-width: 481px) { body.tg-mode .tg-page { margin-top: 20px; margin-bottom: 20px; border-radius: 18px; overflow: hidden; min-height: calc(100vh - 40px); } }

.tg-frame {
  width: 390px;
  height: 760px;
  background: #000;
  border-radius: 44px;
  padding: 12px;
  box-shadow: 0 30px 60px rgba(0,0,0,.5), inset 0 0 0 2px #2A3B36;
  position: relative;
  overflow: hidden;
}
.tg-frame__notch {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 28px;
  background: #000;
  border-radius: 14px;
  z-index: 50;
}
.tg-frame__screen {
  background: var(--color-bg);
  border-radius: 32px;
  height: 100%;
  overflow-y: auto;
  position: relative;
  scrollbar-width: thin;
}
.tg-frame__screen::-webkit-scrollbar { width: 0; }

/* ───────── Telegram status bar ───────── */
.tg-status {
  height: 44px;
  padding: 0 24px 0 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: -apple-system, system-ui, sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  position: sticky;
  top: 0;
  background: var(--color-bg);
  z-index: 10;
}
.tg-status__r { display: flex; gap: 6px; align-items: center; font-size: 11px; }

/* ───────── Telegram header chrome ───────── */
.tg-header {
  height: 44px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 44px;
  z-index: 9;
}
.tg-header__back { background: transparent; border: 0; color: var(--color-primary-fill); font-size: 22px; cursor: pointer; padding: 4px; line-height: 1; }
.tg-header__t { flex: 1; min-width: 0; font-size: 15px; font-weight: 700; color: var(--color-text); text-align: center; }
.tg-header__r { font-size: 14px; color: var(--color-primary-fill); background: transparent; border: 0; cursor: pointer; font-weight: 600; }

/* ───────── Telegram main button (Tg Web App standard) ───────── */
.tg-main {
  position: sticky;
  bottom: 0;
  z-index: 10;
  height: 56px;
  background: var(--color-cta);
  color: #fff;
  border: 0;
  width: 100%;
  font-family: -apple-system, system-ui, sans-serif;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  margin-top: auto;
}
.tg-main:active { opacity: 0.7; }

/* ───────── Telegram bottom safe area ───────── */
.tg-bottom-safe { height: 24px; background: var(--color-bg); }

/* ───────── Body / general content overrides for Mini App ───────── */
.tg-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.tg-body h1 { font-family: -apple-system, system-ui, sans-serif; font-size: 22px; font-weight: 800; letter-spacing: -0.01em; margin: 4px 0 2px; }
.tg-body p { font-size: 14px; line-height: 1.55; color: var(--color-text-muted); margin: 0; }

/* compact card for mini app */
.tg-card { background: #fff; border: 1px solid var(--color-border); border-radius: 14px; padding: 14px 16px; }
.tg-card + .tg-card { margin-top: 10px; }
.tg-card__h { font-family: -apple-system, system-ui, sans-serif; font-size: 13px; font-weight: 800; letter-spacing: -0.005em; margin: 0 0 8px; color: var(--color-text); }

/* product row in TG */
.tg-prod { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--color-border); align-items: center; }
.tg-prod:last-child { border-bottom: 0; }
.tg-prod__img { width: 56px; height: 56px; border-radius: 10px; background: var(--color-surface); display: grid; place-items: center; font-size: 24px; }
.tg-prod__t { font-size: 13px; font-weight: 600; line-height: 1.4; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tg-prod__s { font-size: 11px; color: var(--color-text-muted); margin-top: 2px; }
.tg-prod__price { font-family: -apple-system, system-ui, sans-serif; font-size: 14px; font-weight: 800; color: var(--color-price); font-variant-numeric: tabular-nums; text-align: right; }

/* TG hero (sky gradient) */
.tg-hero {
  background: linear-gradient(180deg, #E0F7F1 0%, #B8E8DD 60%, #7DD3C0 100%);
  padding: 20px 16px 24px;
}
.tg-hero h1 { font-size: 26px; font-weight: 900; line-height: 1.05; margin: 0 0 6px; color: var(--color-text); }
.tg-hero h1 .accent { color: var(--color-cta); }
.tg-hero p { font-size: 13px; color: var(--color-text-muted); margin: 0 0 14px; line-height: 1.5; }

.tg-search { background: #fff; border-radius: 14px; padding: 6px 6px 6px 14px; display: flex; align-items: center; gap: 8px; box-shadow: 0 4px 12px rgba(15,31,26,.06); }
.tg-search input { flex: 1; border: 0; outline: 0; font-size: 13px; padding: 8px 0; background: transparent; font-family: inherit; min-width: 0; }
.tg-search button { background: var(--color-cta); color: #fff; padding: 8px 14px; border-radius: 10px; font-weight: 800; font-size: 12px; border: 0; cursor: pointer; }

/* TG bottom nav */
.tg-bottom-nav {
  position: sticky;
  bottom: 0;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--color-border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 6px 4px 8px;
  z-index: 10;
}
.tg-bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px; text-decoration: none; color: var(--color-text-muted); }
.tg-bottom-nav a.is-active { color: var(--color-primary-fill); }
.tg-bottom-nav a .ic { font-size: 20px; line-height: 1; }
.tg-bottom-nav a .lbl { font-size: 9px; font-weight: 700; letter-spacing: 0.02em; }

/* status badge inside TG */
.tg-st { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 1; }
.tg-st__dot { width: 5px; height: 5px; border-radius: 50%; }
.tg-st--photo { background: var(--color-sticker-yellow-soft); color: var(--color-sticker-yellow-fg); border: 1px solid var(--color-sticker-yellow); }
.tg-st--photo .tg-st__dot { background: var(--color-sticker-yellow); }
.tg-st--transit { background: var(--color-info-soft); color: var(--color-info); }
.tg-st--transit .tg-st__dot { background: var(--color-info); }
.tg-st--delivered { background: var(--color-primary-soft); color: var(--color-primary-fill); }
.tg-st--delivered .tg-st__dot { background: var(--color-primary-fill); }

/* TG-sized order card */
.tg-order { background: #fff; border: 1px solid var(--color-border); border-radius: 12px; padding: 12px 14px; }
.tg-order + .tg-order { margin-top: 8px; }
.tg-order__top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.tg-order__id { font-family: -apple-system, system-ui, monospace; font-size: 12px; font-weight: 700; color: var(--color-text); }
.tg-order__date { font-size: 11px; color: var(--color-text-muted); font-family: monospace; }
.tg-order__body { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; }
.tg-order__img { width: 44px; height: 44px; border-radius: 8px; display: grid; place-items: center; font-size: 20px; }
.tg-order__t { font-size: 13px; font-weight: 600; line-height: 1.3; }
.tg-order__s { font-size: 10px; color: var(--color-text-muted); margin-top: 2px; }
.tg-order__price { font-family: -apple-system, system-ui, sans-serif; font-size: 13px; font-weight: 800; color: var(--color-price); white-space: nowrap; }

/* TG section header */
.tg-sec-h { display: flex; justify-content: space-between; align-items: baseline; margin: 16px 0 8px; padding: 0 4px; }
.tg-sec-h__t { font-size: 14px; font-weight: 800; }
.tg-sec-h__r { font-size: 11px; color: var(--color-primary-fill); font-weight: 700; }

/* TG promo card */
.tg-promo { background: linear-gradient(135deg,#5B3FE6,#9B6DFF); color: #fff; border-radius: 14px; padding: 16px; display: flex; gap: 10px; align-items: center; position: relative; overflow: hidden; }
.tg-promo__bear { font-size: 60px; line-height: 1; }
.tg-promo__t { font-size: 14px; font-weight: 800; line-height: 1.2; margin: 0 0 4px; }
.tg-promo__s { font-size: 11px; opacity: 0.85; line-height: 1.4; }
.tg-promo__cta { background: rgba(255,255,255,.95); color: var(--color-text); padding: 5px 10px; border-radius: 999px; font-size: 10px; font-weight: 800; margin-top: 6px; display: inline-block; }
