/* Tenant visual styles: colors/tokens come from theme.css, mechanics from core.css. */

h1 { font-size: 34px; line-height: 1.15; letter-spacing: -0.02em; }
h2 { font-size: 22px; line-height: 1.25; letter-spacing: -0.01em; }
h3 { font-size: 15px; line-height: 1.35; }
.header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  min-height: 68px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; }
.brand-mark { width: 36px; height: 36px; object-fit: contain; }
.brand-name { font-size: 15px; }
.nav { display: flex; align-items: center; gap: 18px; margin-left: auto; font-size: 13px; color: var(--muted); overflow-x: auto; }
.nav a:hover { color: var(--ink); }
.nav-cats { display: inline-flex; gap: 18px; align-items: center; }
.nav-cart { display: inline-flex; align-items: center; gap: 6px; }
.cart-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
}

.page { max-width: var(--max); margin: 0 auto; padding: 28px 20px 72px; }
.footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: 40px; }
.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 36px 20px;
  display: grid;
  gap: 20px;
  grid-template-columns: 1.4fr 1fr;
  color: var(--muted);
  font-size: 13px;
}
.footer-inner nav { display: flex; gap: 20px; flex-wrap: wrap; }
.footer .copyright { grid-column: 1 / -1; color: var(--faint); font-size: 12px; }
.footer strong { color: var(--ink); display: block; margin-bottom: 6px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 14px;
  transition: filter 0.15s ease, background 0.15s ease;
}
.btn:hover { filter: brightness(0.95); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost { background: transparent; color: var(--muted); border-color: transparent; }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 12px; }

.field { display: grid; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); }
.input, .select, .textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: var(--surface);
  outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); }
.textarea { min-height: 110px; resize: vertical; }

.hero {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: linear-gradient(120deg, #0f172a, color-mix(in srgb, var(--accent) 78%, #0f172a));
  min-height: 380px;
  color: #fff;
}
.hero-track { position: relative; min-height: 380px; }
.carousel-item { display: none; position: relative; min-height: 380px; }
.carousel-item.has-fallback { background: linear-gradient(90deg, rgba(15,23,42,.86), rgba(15,23,42,.28)); }
.carousel-item.is-active { display: block; }
.carousel-item img { width: 100%; height: 380px; object-fit: cover; }
.carousel-caption {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 12px;
  padding: 48px;
  color: #fff;
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.78), rgba(15, 23, 42, 0.18));
}
.carousel-caption p { color: rgba(255, 255, 255, 0.82); max-width: 460px; }
.carousel-caption h1 { max-width: 560px; }
.hero-fallback {
  min-height: 380px;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  background:
    linear-gradient(120deg, rgba(15, 23, 42, 0.9), color-mix(in srgb, var(--accent) 62%, transparent));
}
.hero-fallback p { max-width: 520px; color: rgba(255, 255, 255, 0.82); }
.hero-fallback h1 { font-size: 44px; max-width: 560px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.hero .btn-secondary { background: rgba(255,255,255,0.12); color: #fff; border-color: rgba(255,255,255,0.28); }
.hero-dots { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }
.hero-dots button { width: 8px; height: 8px; border-radius: 999px; border: 0; background: rgba(255,255,255,0.45); padding: 0; }
.hero-dots button[aria-current="true"] { background: #fff; width: 22px; }

.section { margin-top: 44px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-head p { color: var(--muted); font-size: 13px; }
.section-head a { color: var(--accent); font-size: 13px; font-weight: 600; }
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}
.goods-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.goods-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.goods-card-link { display: block; }
.card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 7%, #ffffff), color-mix(in srgb, var(--accent) 12%, #eef2f7));
  color: #64748b;
  font-weight: 700;
  font-size: 26px;
  overflow: hidden;
}
.card-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.media-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 12px;
  background-image: radial-gradient(rgba(15, 23, 42, 0.07) 1px, transparent 1px);
  background-size: 14px 14px;
}
.media-mark { font-size: 28px; letter-spacing: 0.22em; color: #334155; }
.media-note { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: #64748b; }
.detail-fallback .media-mark { font-size: 56px; }
.detail-fallback .media-note { font-size: 12px; }
.card-body { padding: 12px 14px 16px; display: grid; gap: 6px; }
.card-tag { color: var(--accent); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.goods-price { font-weight: 700; }
.price-was { color: var(--faint); text-decoration: line-through; font-size: 12px; margin-left: 6px; font-weight: 400; }
.card-intro { color: var(--muted); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.toolbar .field { flex: 1 1 200px; }
.search-form { display: flex; gap: 10px; flex: 2 1 320px; }
.search-form .input { min-width: 0; }
.result-meta { margin: 18px 0 10px; color: var(--muted); font-size: 13px; }
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 26px; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: end; margin-bottom: 18px; }
.page-head p { color: var(--muted); font-size: 13px; margin-top: 6px; }

.detail-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr); gap: 36px; align-items: start; }
.detail-media { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; aspect-ratio: 1 / 1; display: grid; place-items: center; color: #64748b; font-size: 42px; font-weight: 700; }
.detail-media img { width: 100%; height: 100%; object-fit: cover; }
.detail-info { display: grid; gap: 14px; }
.detail-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stock { color: var(--muted); font-size: 13px; }
.qty-row { display: flex; gap: 12px; align-items: center; }
.qty-row .input { width: 88px; text-align: center; }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.goods-detail { margin-top: 36px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.goods-detail h2 { margin-bottom: 12px; }
.detail-rich { color: var(--muted); white-space: pre-line; line-height: 1.8; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.cart-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
.cart-list { display: grid; }
.cart-item { display: grid; grid-template-columns: 88px minmax(0, 1fr) auto; gap: 16px; padding: 16px; border-bottom: 1px solid var(--line); align-items: center; }
.cart-item:last-child { border-bottom: 0; }
.cart-thumb { width: 88px; height: 72px; border-radius: 8px; overflow: hidden; background: #eef2f7; display: grid; place-items: center; color: #64748b; font-weight: 700; }
.cart-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-item-qty { width: 74px; text-align: center; }
.cart-side { padding: 18px; display: grid; gap: 14px; position: sticky; top: 92px; }
.summary-row { display: flex; justify-content: space-between; gap: 16px; font-size: 14px; }
.summary-total { font-size: 20px; font-weight: 700; border-top: 1px solid var(--line); padding-top: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.auth-wrap { max-width: 440px; margin: 40px auto; padding: 28px; }
.auth-wrap h1 { font-size: 26px; margin-bottom: 6px; }
.auth-wrap p.lead { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.form-stack { display: grid; gap: 14px; }
.form-error { background: var(--danger-soft); color: var(--danger); border: 1px solid #fecaca; border-radius: 8px; padding: 10px 12px; font-size: 12px; }
.turnstile-note { border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; color: var(--faint); font-size: 12px; }
.auth-alt { text-align: center; color: var(--muted); font-size: 13px; margin-top: 14px; }
.auth-alt a { color: var(--accent); font-weight: 600; }

.order-list { display: grid; }
.order-row { display: grid; grid-template-columns: 1.4fr 0.8fr 0.8fr 1fr auto; gap: 14px; align-items: center; padding: 16px; border-bottom: 1px solid var(--line); }
.order-row:last-child { border-bottom: 0; }
.order-no { font-weight: 600; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; background: #f1f5f9; color: var(--muted); white-space: nowrap; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--accent-soft); color: var(--accent); }
.settle-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.settle-block { padding: 18px; display: grid; gap: 12px; }
.settle-block h2 { font-size: 16px; }
.settle-items { display: grid; }
.settle-item { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.settle-item:last-child { border-bottom: 0; }
.pay-methods { display: grid; gap: 10px; }
.pay-method { display: flex; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
.pay-method input { width: 16px; height: 16px; accent-color: var(--accent); }
.pay-method:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.profile-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 22px; align-items: start; }
.profile-card { padding: 20px; display: grid; gap: 14px; }
.profile-meta { display: grid; gap: 10px; font-size: 13px; color: var(--muted); }
.profile-meta strong { color: var(--ink); }

.state-panel { margin-top: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 36px 20px; text-align: center; display: grid; gap: 10px; justify-items: center; }
.state-panel h2 { font-size: 18px; }
.state-panel p { color: var(--muted); font-size: 13px; max-width: 520px; }
.global-loading { text-align: center; color: var(--muted); font-size: 13px; padding: 10px 0; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 80;
  background: #0f172a;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
}
.toast[data-type="error"] { background: #7f1d1d; }
.toast[data-type="success"] { background: #14532d; }

@media (max-width: 1024px) {
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .detail-layout, .cart-layout, .settle-layout, .profile-grid { grid-template-columns: 1fr; }
  .cart-side { position: static; }
}
@media (max-width: 768px) {
  h1 { font-size: 28px; }
  .header-inner { flex-wrap: wrap; gap: 10px; }
  .nav { margin-left: 0; width: 100%; gap: 14px; padding-bottom: 2px; }
  .brand-name { font-size: 14px; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .hero, .hero-track, .hero-fallback, .carousel-item, .carousel-item img { min-height: 320px; height: 320px; }
  .carousel-caption { padding: 28px 22px; }
.hero-fallback-original { padding: 28px 22px; }
  .hero-fallback h1 { font-size: 30px; }
  .order-row { grid-template-columns: 1fr 1fr; }
  .order-row .btn { grid-column: 1 / -1; justify-self: start; }
  .cart-item { grid-template-columns: 72px 1fr; }
  .cart-thumb { width: 72px; height: 60px; }
  .cart-item-actions { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; }
  .footer-inner { grid-template-columns: 1fr; }
}
@media (max-width: 360px) {
  .product-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page { padding: 20px 16px 56px; }
}
.hero-title { font-size: 44px; line-height: 1.15; letter-spacing: -0.02em; margin: 0; }
@media (max-width: 768px) { .hero-title { font-size: 30px; } }

.carousel-item.has-fallback,
.hero-fallback {
  background-image: linear-gradient(120deg, rgba(15, 23, 42, 0.86), rgba(29, 78, 216, 0.62)), url('../images/hero.jpg');
  background-size: cover;
  background-position: center;
}

.section[data-empty="true"] { display: none; }
