﻿:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --line: #e5e7eb;
  --text: #1f2937;
  --muted: #6b7280;
  --brand: #ff6a00;
  --brand-deep: #e85d00;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at top right, #fff1e6, var(--bg) 30%);
  color: var(--text);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.brand { font-size: 22px; font-weight: 800; color: var(--brand); }

.topbar nav a { margin-left: 14px; text-decoration: none; color: #374151; font-weight: 600; }

.container { max-width: 1480px; margin: 0 auto; padding: 20px; }

.hero {
  background: linear-gradient(120deg, #fff, #fff6ee);
  border: 1px solid #f2ddcd;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 18px;
}

.hero h1 { margin: 0; font-size: 28px; }
.hero p { margin: 8px 0 0; color: var(--muted); }

.section-title { margin: 20px 0 10px; }
.cat-title { margin: 14px 0 8px; color: #374151; }

.grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.card {
  background: var(--card);
  border-radius: 14px;
  border: 1px solid var(--line);
  overflow: hidden;
  min-width: 0;
}

.card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
}

.card-body { padding: 6px 12px 10px; }
.card-body h3 { margin: 0 0 3px; font-size: 16px; }
.card-body p { margin: 0 0 3px; color: var(--muted); font-size: 13px; min-height: 12px; }
.price-tag { font-weight: 800; color: #d9480f; }

.shop-layout { display: grid; grid-template-columns: 270px 1fr; gap: 14px; }
.shop-sidebar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  height: fit-content;
  position: sticky;
  top: 78px;
}

.search-box { display: grid; gap: 8px; margin-bottom: 10px; }
.shop-sidebar ul { margin: 8px 0; padding-left: 18px; }
.side-link { display: inline-block; margin: 6px 0 8px; }

input, select, button, textarea {
  border-radius: 10px;
  border: 1px solid #d1d5db;
  padding: 10px;
  width: 100%;
  font: inherit;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

label { display: block; margin: 10px 0 6px; color: #4b5563; font-size: 14px; }

.btn-primary {
  margin-top: 10px;
  border: none;
  color: white;
  background: linear-gradient(120deg, var(--brand), var(--brand-deep));
  font-weight: 700;
  cursor: pointer;
}

.btn-link {
  display: inline-block;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #ffd4b3;
  background: #fff6ee;
  color: #9a3412;
  margin: 6px 8px 0 0;
}

.admin-links { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 14px; }
.warn-list-wrap {
  max-height: 420px;
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}
.warn-table { margin: 0; min-width: 540px; }
.warn-table th {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.sub-panel { border: 1px dashed #e5e7eb; border-radius: 10px; padding: 10px; margin-top: 10px; }

.inline-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.user-pill { display: inline-block; margin-left: 12px; font-weight: 700; color: #0f766e; }
.muted { color: var(--muted); font-size: 13px; }

.flash-wrap { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); width: min(680px, calc(100% - 24px)); margin: 0; z-index: 60; pointer-events: none; }
.flash { border-radius: 10px; padding: 10px 12px; margin: 0; font-weight: 600; box-shadow: 0 10px 26px rgba(15,23,42,0.15); pointer-events: auto; opacity: 1; transition: opacity .24s ease, transform .24s ease; }
.flash.hide { opacity: 0; transform: translateY(-6px); }
.flash.ok { background: #ecfdf3; border: 1px solid #86efac; color: #166534; }
.flash.error { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { border-bottom: 1px solid #e5e7eb; padding: 8px; text-align: left; vertical-align: top; }

.cart-mobile-list { display: grid; gap: 10px; }
.cart-item { border: 1px solid #e5e7eb; border-radius: 12px; padding: 10px; background: #fff; }
.cart-item-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cart-item-head a { font-weight: 700; color: #1f2937; text-decoration: none; }
.cart-item-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; color: #374151; font-size: 14px; }
.cart-qty-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.cart-qty-row label { margin: 0; font-size: 14px; color: #4b5563; width: 36px; }
.cart-qty-input { width: 110px; max-width: 110px; min-width: 110px; height: 40px; padding: 0 10px; }
.cart-remove { width: auto; min-width: 62px; margin: 0; padding: 6px 10px; }
.status-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 700;
}
.status-badge.revoked {
  color: #9a3412;
  background: #fff7ed;
  border: 1px solid #fed7aa;
}
.autoload {
  margin-top: 10px;
  text-align: center;
  color: #6b7280;
  font-size: 13px;
  padding: 6px 0 2px;
}

.product-detail {
  display: grid;
  grid-template-columns: minmax(300px, 420px) 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.product-media {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  align-self: start;
}

.product-media img { width: 100%; height: 100%; min-height: 0; object-fit: cover; }

.sku-list { display: grid; gap: 0; margin-bottom: 10px; max-height: 56vh; overflow: auto; padding-right: 2px; }
.sku-choice {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  border: 1px solid #f1f5f9;
  background: #fcfdff;
  border-radius: 10px;
  padding: 6px;
  margin-top: 0.5px;
  font-size: 16px;
}
.sku-choice:first-child { margin-top: 0; }
.sku-choice em { color: var(--muted); font-style: normal; margin: 0 6px; }
.sku-choice b { color: #d9480f; margin-right: 6px; }
.detail-buy { display: flex; align-items: center; gap: 8px; position: sticky; bottom: 0; z-index: 3; background: linear-gradient(180deg, rgba(255,255,255,0.78), #fff 24%); border-top: 1px solid #e5e7eb; padding-top: 8px; }
.detail-buy input[type=number] { width: 120px; min-width: 120px; max-width: 120px; height: 40px; padding: 0 10px; }
.detail-buy .btn-primary { width: auto; min-width: 132px; max-width: 160px; height: 40px; padding: 0 14px; margin-top: 0; white-space: nowrap; }

.doc-section { margin-top: 14px; }
.doc-body { line-height: 1.8; white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
.supplier-info p { margin: 0 0 8px; }
.supplier-info a { color: #0b7285; text-decoration: underline; overflow-wrap: anywhere; word-break: break-all; }

.auth-wrap { display: grid; place-items: center; padding-top: 40px; }
.auth { width: min(420px, 100%); }

.back-top {
  position: fixed;
  right: 18px;
  bottom: 22px;
  z-index: 30;
  width: auto;
  display: none;
  border: none;
  padding: 10px 14px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  cursor: pointer;
}

@media (max-width: 1400px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1220px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Sidebar stacks below goods area first, while keeping 3 cards per row. */
@media (max-width: 1020px) {
  .shop-layout { grid-template-columns: 1fr; }
  .shop-sidebar { position: static; }
  .product-detail { grid-template-columns: minmax(260px, 340px) 1fr; }
}

/* After stacked layout, continue narrowing to 2 cards per row. */
@media (max-width: 680px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}

@media (max-width: 520px) {
  .container { padding: 12px; }
  .topbar { padding: 10px 12px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card img { height: 118px; }
  .card-body h3 { font-size: 14px; }
  .card-body p { font-size: 12px; min-height: 11px; }
  .cart-item { padding: 9px; }
  .cart-item-meta { font-size: 13px; }
  .cart-qty-input { width: 98px; min-width: 98px; max-width: 98px; }
  .detail-buy { gap: 6px; }
  .detail-buy input[type=number] { width: 112px; min-width: 112px; max-width: 112px; }
  .detail-buy .btn-primary { min-width: 122px; max-width: 142px; }
  .product-detail { grid-template-columns: 1fr; }
  .product-media { width: min(100%, 520px); margin: 0 auto; aspect-ratio: 1 / 1; }
  .product-media img { min-height: 0; }

  /* Prevent iOS focus zoom/jump on inputs */
  input, select, textarea, button { font-size: 16px; }
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.editor-toolbar button {
  width: auto;
  padding: 8px 12px;
}

.rich-editor {
  min-height: 220px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 12px;
  background: #fff;
  line-height: 1.7;
}

.rich-editor img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}




















