:root {
  --brand: #0f4c3a; --brand-2: #0a3a2c; --brand-soft: #edf4f1;
  --ink: #151a17; --ink-2: #3c443f; --muted: #8a928d; --line: #e8ebe9; --line-2: #f0f2f1;
  --bg: #fafbfa; --card: #ffffff;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,20,.04), 0 4px 16px rgba(16,24,20,.05);
  --serif: "Georgia", "Times New Roman", "Songti SC", "SimSun", serif;
  --sans: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 14.5px/1.55 var(--sans); background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, select, textarea { font: inherit; color: var(--ink); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 28px; }
.ico { display: inline-flex; vertical-align: -3px; }
.ico svg { width: 100%; height: 100%; }

/* ============ top bar ============ */
.topbar { position: sticky; top: 0; z-index: 60; background: #fff; border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; gap: 20px; height: 62px; max-width: 1240px; margin: 0 auto; padding: 0 28px; }
.logo { font-family: var(--serif); font-weight: 700; font-size: 22px; letter-spacing: -.2px; color: var(--ink); white-space: nowrap; display: flex; align-items: baseline; gap: 4px; }
.logo .dot { color: var(--brand); }
.logo .sub { font-family: var(--sans); font-size: 11px; font-weight: 400; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin-left: 2px; }
.search { flex: 1; display: flex; align-items: center; gap: 10px; background: #f3f5f4; border: 1px solid transparent; border-radius: 8px; height: 40px; padding: 0 14px; max-width: 560px; margin: 0 auto; transition: border .15s, background .15s; }
.search:focus-within { background: #fff; border-color: var(--brand); }
.search .ico { color: var(--muted); }
.search input { flex: 1; border: 0; background: transparent; outline: none; font-size: 14px; color: var(--ink); }
.search input::placeholder { color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.top-actions a, .top-actions button { color: var(--ink-2); padding: 8px 11px; border-radius: 7px; font-size: 13.5px; display: inline-flex; align-items: center; gap: 7px; font-weight: 500; }
.top-actions a:hover, .top-actions button:hover { background: #f2f4f3; color: var(--ink); }
.top-actions a .ico { color: var(--muted); }
.cart-btn { position: relative; }
.badge { position: absolute; top: 1px; right: 1px; background: var(--brand); color: #fff; font-size: 10.5px; font-weight: 600; min-width: 17px; height: 17px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; }
.lang { border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; font-size: 12.5px; color: var(--ink-2); }

/* ============ category bar ============ */
.cats { display: flex; gap: 4px; overflow-x: auto; padding: 0 28px; background: #fff; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cat { flex: 0 0 auto; padding: 13px 16px; color: var(--ink-2); cursor: pointer; white-space: nowrap; font-size: 13.5px; font-weight: 500; border-bottom: 2px solid transparent; }
.cat:hover { color: var(--ink); }
.cat.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* ============ hero ============ */
.hero { margin: 22px 0 6px; padding: 34px 36px; background: #10241c; color: #fff; border-radius: 14px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.hero h1 { margin: 0 0 8px; font-family: var(--serif); font-size: 27px; font-weight: 600; letter-spacing: -.3px; }
.hero p { margin: 0; color: #b7c6bf; font-size: 14px; max-width: 460px; }
.hero .points { display: flex; gap: 22px; }
.hero .pt { display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 12.5px; color: #cbd7d1; }
.hero .pt .ico { width: 22px; height: 22px; }

/* ============ quick categories ============ */
.quickcats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 20px 0; }
.quickcat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 14px; cursor: pointer; transition: border .15s, box-shadow .15s; display: flex; align-items: center; gap: 11px; }
.quickcat:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.quickcat .ic { width: 34px; height: 34px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.quickcat .t { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }

/* ============ section ============ */
.section { display: flex; align-items: center; gap: 10px; margin: 30px 0 14px; }
.section h2 { margin: 0; font-family: var(--serif); font-size: 20px; font-weight: 600; letter-spacing: -.2px; }
.section .rule { flex: 1; height: 1px; background: var(--line); }
.section a { color: var(--brand); font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.section a:hover { text-decoration: underline; }

/* ============ product grid / card ============ */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: box-shadow .18s, border .18s, transform .18s; display: flex; flex-direction: column; position: relative; }
.card:hover { box-shadow: var(--shadow); border-color: var(--line-2); transform: translateY(-2px); }
.card .thumb { aspect-ratio: 1/1; background: #f6f7f6; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.card:hover .thumb img { transform: scale(1.03); }
.card .thumb .flag { position: absolute; top: 10px; left: 10px; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 5px; background: rgba(255,255,255,.92); color: var(--ink-2); letter-spacing: .02em; }
.card .thumb .flag.border { color: var(--brand); background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.card .body { padding: 13px 15px 15px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.card .name { font-size: 13.5px; line-height: 1.45; min-height: 39px; color: var(--ink); font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.card .meta .dotsep { width: 3px; height: 3px; border-radius: 50%; background: var(--line); }
.card .price { font-weight: 650; color: var(--ink); font-size: 16px; letter-spacing: -.2px; }
.card .price .cur { font-size: 11.5px; color: var(--muted); font-weight: 500; margin-right: 2px; }
.card .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.card .sold { font-size: 12px; color: var(--muted); }
.card .addbtn { width: 32px; height: 32px; border-radius: 8px; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; transition: background .15s; }
.card .addbtn:hover { background: var(--brand); }

/* ============ buttons / forms ============ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 8px; padding: 11px 20px; background: var(--ink); color: #fff; font-weight: 600; font-size: 14px; transition: background .15s; }
.btn:hover { background: var(--brand); }
.btn.primary { background: var(--brand); }
.btn.primary:hover { background: var(--brand-2); }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: #f6f7f6; }
.btn.danger { background: #fdf1f1; color: #b33; }
.btn.sm { padding: 8px 14px; font-size: 13px; border-radius: 7px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-outline { background: #fff; color: var(--brand); border: 1px solid var(--brand); border-radius: 7px; padding: 8px 13px; font-size: 13px; }
.btn-outline:hover { background: var(--brand-soft); }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 16px; }
.panel h2, .panel h3 { margin: 0 0 16px; font-family: var(--serif); font-size: 18px; font-weight: 600; }
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; font-weight: 500; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 13px; background: #fff; outline: none; transition: border .15s; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); }
.field textarea { min-height: 84px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

/* ============ detail ============ */
.detail { display: grid; grid-template-columns: 440px 1fr; gap: 36px; margin-top: 22px; }
.detail .gallery { aspect-ratio: 1/1; border-radius: 12px; overflow: hidden; background: #f6f7f6; border: 1px solid var(--line); }
.detail .gallery img { width: 100%; height: 100%; object-fit: cover; }
.detail h1 { font-family: var(--serif); font-size: 24px; margin: 0 0 8px; font-weight: 600; line-height: 1.3; letter-spacing: -.3px; }
.detail .sku-line { font-size: 13px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.detail .price { font-size: 28px; color: var(--ink); font-weight: 700; letter-spacing: -.5px; margin: 14px 0 4px; }
.detail .price .cur { font-size: 15px; color: var(--muted); font-weight: 500; margin-right: 3px; }
.detail .row { display: flex; gap: 12px; flex-wrap: wrap; margin: 18px 0; align-items: center; }
.qtybox { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.qtybox button { width: 38px; height: 42px; font-size: 17px; color: var(--ink-2); }
.qtybox button:hover { background: #f5f6f5; }
.qtybox input { width: 58px; height: 42px; border: 0; text-align: center; font-weight: 600; }
.spec-table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 13.5px; }
.spec-table td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); }
.spec-table td:first-child { color: var(--muted); width: 34%; }

/* ============ cart ============ */
.cart-line { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.cart-line img { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; background: #f6f7f6; flex: 0 0 auto; }
.cart-line .info { flex: 1; min-width: 0; }
.cart-line .info .n { font-weight: 600; font-size: 14px; }
.cart-line .err { color: #b33; font-size: 12.5px; }
.cart-sum { text-align: right; font-size: 14px; }
.cart-sum .big { font-size: 22px; font-weight: 700; color: var(--ink); }
.groupbar { background: var(--brand-soft); border: 1px solid #dce8e2; border-radius: 8px; padding: 9px 13px; font-size: 13px; margin: 12px 0; color: var(--brand-2); display: flex; align-items: center; gap: 8px; }
.groupbar .ico { color: var(--brand); }

/* ============ orders ============ */
.oc { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px; cursor: pointer; }
.status-pill { padding: 3px 10px; border-radius: 5px; font-size: 12px; font-weight: 600; background: #f0f2f1; color: var(--ink-2); }
.status-pill.pending_payment, .status-pill.proof_uploaded { background: #fdf5e6; color: #a06a1a; }
.status-pill.paid, .status-pill.completed { background: #eaf5ef; color: #1e7a4d; }
.status-pill.cancelled { background: #fdecec; color: #b33; }
.status-pill.purchasing, .status-pill.shipped { background: #eaf1fb; color: #2b6cb0; }
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.status-pill { display: inline-block; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 9px 0 9px 22px; border-left: 2px solid var(--line); margin-left: 6px; position: relative; font-size: 13.5px; color: var(--ink-2); }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 15px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }

/* ============ account ============ */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.tabs button { padding: 11px 18px; color: var(--ink-2); font-size: 14px; white-space: nowrap; border-bottom: 2px solid transparent; font-weight: 500; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.lvlbar { display: flex; gap: 12px; margin: 14px 0; }
.lvl { flex: 1; text-align: center; border: 1px solid var(--line); border-radius: 8px; padding: 14px 8px; font-size: 12.5px; background: #fff; }
.lvl.cur { border-color: var(--brand); background: var(--brand-soft); }
.lvl .v { font-size: 20px; font-weight: 700; color: var(--brand); font-family: var(--serif); }

/* ============ toast / empty / pager ============ */
#toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 999; display: flex; flex-direction: column; gap: 8px; width: max-content; max-width: 90vw; }
.toast { background: #151a17; color: #fff; padding: 12px 20px; border-radius: 8px; font-size: 13.5px; box-shadow: 0 6px 24px rgba(0,0,0,.18); transition: opacity .3s; }
.toast.ok { background: #1e7a4d; }
.toast.err { background: #b33; }
.toast.out { opacity: 0; }
.empty { text-align: center; color: var(--muted); padding: 56px 16px; }
.empty .ic { font-size: 34px; margin-bottom: 10px; color: var(--line); }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 28px 0; }
.link { color: var(--brand); cursor: pointer; }
.link:hover { text-decoration: underline; }

/* ============ bottom mobile nav ============ */
.bottombar { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); z-index: 70; padding-bottom: env(safe-area-inset-bottom); }
.bottombar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0 9px; font-size: 11px; color: var(--muted); position: relative; }
.bottombar a.on { color: var(--brand); }
.bottombar a .ico { width: 21px; height: 21px; }
.bottombar .badge { position: absolute; top: 3px; left: 54%; background: var(--brand); color: #fff; font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 3px; }

/* ============ admin ============ */
.admin-body { display: flex; min-height: 100vh; background: #f4f6f5; }
.aside { width: 228px; background: #14201a; color: #b9c6bf; flex: 0 0 auto; display: flex; flex-direction: column; }
.aside .brand { padding: 20px 22px; font-weight: 700; color: #fff; font-family: var(--serif); font-size: 18px; border-bottom: 1px solid rgba(255,255,255,.07); }
.aside nav { flex: 1; padding: 10px 0; overflow-y: auto; }
.aside nav a { display: flex; align-items: center; gap: 11px; padding: 11px 22px; color: #b9c6bf; font-size: 14px; }
.aside nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.aside nav a.on { background: var(--brand); color: #fff; }
.aside .foot { padding: 14px 22px; border-top: 1px solid rgba(255,255,255,.07); font-size: 13px; color: #9fb0a7; display: flex; justify-content: space-between; align-items: center; }
.aside .foot button { color: #b9c6bf; display: inline-flex; gap: 5px; align-items: center; }
.menu-toggle { display: none; }
.main { flex: 1; padding: 26px; min-width: 0; }
.main h1 { font-family: var(--serif); font-size: 22px; margin: 0 0 20px; font-weight: 600; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.stat .v { font-size: 26px; font-weight: 700; font-family: var(--serif); }
.stat .k { color: var(--muted); font-size: 13px; }
.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.table th, .table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.table th { background: #fafbfa; color: var(--muted); font-weight: 600; white-space: nowrap; font-size: 12.5px; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #fbfcfb; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.toolbar-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.toolbar-row input, .toolbar-row select { height: 38px; border: 1px solid var(--line); border-radius: 7px; padding: 0 12px; }
.modal-mask { position: fixed; inset: 0; background: rgba(12,18,15,.5); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: #fff; border-radius: 12px; max-width: 700px; width: 100%; max-height: 90vh; overflow: auto; padding: 24px; }
.modal h2 { margin: 0 0 18px; font-family: var(--serif); font-size: 18px; font-weight: 600; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.admin-login { max-width: 400px; margin: 70px auto; }

/* ============ responsive ============ */
@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .detail { grid-template-columns: 1fr; gap: 18px; }
  .detail .gallery { aspect-ratio: 1/1; }
  .form-row { grid-template-columns: 1fr; }
  .topbar-inner { gap: 10px; height: 56px; padding: 0 14px; }
  .logo { font-size: 19px; }
  .logo .sub, .top-actions a .lbl-txt { display: none; }
  .search { height: 36px; }
  .cats { padding: 0 14px; }
  .hero { padding: 24px 20px; flex-direction: column; align-items: flex-start; }
  .hero h1 { font-size: 22px; }
  .hero .points { width: 100%; justify-content: space-between; }
  .quickcats { grid-template-columns: repeat(2, 1fr); }
  .bottombar { display: flex; }
  body { padding-bottom: 58px; }
  /* Phone: a compact top bar plus an expandable full-label grid. No clipped
     Chinese menu text, and no hidden functions behind a 56px icon rail. */
  .admin-body { flex-direction: column; }
  .aside { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center;
    padding: 0 12px; min-height: 50px; }
  .aside .brand { display: block; padding: 10px 0; font-size: 15px; border: 0; }
  .aside .foot { margin-left: auto; padding: 8px 0; border: 0; }
  .aside .foot .lbl { display: none; }
  .menu-toggle { display: inline-flex; align-items: center; margin-left: 12px;
    padding: 6px 10px; border: 1px solid rgba(255,255,255,.25); border-radius: 5px;
    color: #fff; background: transparent; font-size: 13px; }
  .aside nav { display: none; flex: 1 0 100%; order: 5; padding: 4px 0 12px; overflow: visible; }
  .aside.open nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .aside nav a { justify-content: center; padding: 9px 4px; font-size: 12.5px;
    border-radius: 5px; background: rgba(255,255,255,.06); text-align: center; }
  .main { padding: 12px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px; }
  .stat .v { font-size: 20px; }
  .panel { padding: 14px; }
  .modal { padding: 16px; }
  .table { display: block; overflow-x: auto; }
  /* Source list becomes labelled cards so every editable field stays on screen. */
  .src-table { display: block; overflow: visible; }
  .src-table tr:first-child { display: none; }
  .src-table tr[data-code] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 10px; }
  .src-table td { display: block; border: 0; padding: 0; min-width: 0; }
  .src-table td:not(:empty)::before { content: attr(data-l); display: block;
    font-size: 11px; color: var(--muted); margin-bottom: 4px; }
  .src-table td:nth-child(3), .src-table td:nth-child(6) { grid-column: 1 / -1; }
  .src-table input, .src-table select { width: 100%; box-sizing: border-box; }
}

/* ============ footer ============ */
.site-footer { background: #14201a; color: #b9c6bf; margin-top: 56px; }
.footer-inner { max-width: 1240px; margin: 0 auto; padding: 48px 28px 32px; display: grid; grid-template-columns: 2fr 1fr 1fr 1.4fr; gap: 32px; }
.f-brand .f-logo { font-family: var(--serif); font-weight: 700; font-size: 22px; color: #fff; }
.f-brand .f-logo span { color: #5fc497; }
.f-brand p { font-size: 13px; color: #9fb0a7; line-height: 1.6; margin: 12px 0 14px; max-width: 320px; }
.f-hot { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: #e6eee9; }
.f-col h4 { margin: 0 0 14px; font-size: 13px; font-weight: 600; color: #e6eee9; letter-spacing: .02em; }
.f-col a, .f-col p { display: block; font-size: 13px; color: #9fb0a7; margin: 0 0 10px; line-height: 1.5; }
.f-col a:hover { color: #fff; }
.footer-bot { border-top: 1px solid rgba(255,255,255,.07); padding: 18px 28px; text-align: center; font-size: 12.5px; color: #7d9187; }
@media (max-width: 760px) {
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 24px; padding: 36px 20px 24px; }
  .f-brand { grid-column: 1 / -1; }
  .footer-bot { padding: 14px 16px; }
}
