:root {
  --bg: #faf8f4;
  --card: #ffffff;
  --ink: #1c1a17;
  --ink2: #8a8378;
  --line: #e9e3d8;
  --brand: #a8895b;      /* champagne gold */
  --brand2: #9a7b4f;     /* deep gold */
  --ok: #6f8f6f;
  --warn: #b48a3c;
  --bad: #b05a4a;
  --radius: 4px;
  --serif: "Playfair Display", Georgia, "Times New Roman", "Songti SC", "SimSun", serif;
}
html.dark {
  --bg: #0e0d0b;
  --card: #161512;
  --ink: #ece7dd;
  --ink2: #8d877b;
  --line: #2a2721;
  --brand: #c9a86a;
  --brand2: #d4b483;
  --ok: #7fae8a;
  --warn: #d9b25f;
  --bad: #d98a76;
  --radius: 4px;
}
html.dark .topbar { background: #0a0908; border-bottom: 1px solid #26231d; }
html.dark .hero { background-image: linear-gradient(160deg, #0a0908 0%, #1a160f 55%, #0d0b08 100%) !important; }
html.dark .annbar { background: #1a160f; color: var(--brand); border-bottom: 1px solid #2a251c; }
html.dark .filterbar { background: #0e0d0b; }
html.dark .searchrow input, html.dark .searchrow select { background: #161512; color: var(--ink); }
html.dark .pcard .pimg { background: linear-gradient(160deg, #1c1915, #14120e); }
html.dark .whtab { background: #161512; }
html.dark .drawer { background: #161512; }
html.dark .drawer .dhead { border-color: #2a2721; }
html.dark .drawer .dfoot { background: #12100d; border-color: #2a2721; }
html.dark .qty button { background: #26231d; color: var(--ink); }
html.dark .citem .ci-emoji { background: #26231d; }
html.dark .bottombar { background: rgba(14,13,11,.94); border-color: #2a2721; }
html.dark .bottombar .bbtn.cartb { background: #ece7dd; color: #0e0d0b; }
html.dark .mylink { background: #1a1710; }
html.dark .mylink .url { color: var(--brand); }
html.dark .tblwrap, html.dark .admfilters input, html.dark .admfilters select { background: #161512; }
html.dark th { background: #12100d; }
html.dark .tabs button { background: #161512; color: var(--ink2); border-color: #2a2721; }
html.dark .tabs button.on { background: var(--brand); color: #141008; border-color: var(--brand); }
html.dark .stat { background: #161512; }
html.dark .modal .mbox { background: #161512; }
html.dark .fgroup input, html.dark .fgroup select, html.dark .fgroup textarea { background: #12100d; color: var(--ink); }
html.dark .bigbtn { background: var(--brand); color: #141008; }
html.dark .errmsg { background: #361812; color: var(--bad); }
html.dark .okmsg { background: #17251b; color: var(--ok); }
html.dark .batchbar { background: #1a1710; }
html.dark .smallbtn { background: #161512; color: var(--ink); border-color: #2a2721; }
html.dark .smallbtn.pri { background: var(--brand); border-color: var(--brand); color: #141008; }
html.dark .iconbtn { background: none; border-color: #2a2721; color: var(--ink); }
html.dark .langbtn { background: none; border-color: #2a2721; color: var(--ink); }
html.dark #toast { background: #ece7dd; color: #0e0d0b; }
html.dark .hero .tagline { color: #a89f8d; }
html.dark .footer { color: #5c5548; }
html.dark .footer a { color: #8b93a0; }
html.dark .psku b { color: var(--brand) !important; }
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 15px; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--ink); }

/* ---- header ---- */
.topbar { position: sticky; top: 0; z-index: 50; background: var(--bg); color: var(--ink); border-bottom: 1px solid var(--line); padding: 10px 14px; display: flex; align-items: center; gap: 10px; }
.topbar .logo { font-family: var(--serif); font-weight: 700; font-size: 1.02rem; letter-spacing: 2.5px; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.topbar .logo .accent { color: var(--brand); }
.langbtn { background: none; border: 1px solid var(--line); color: var(--ink2); border-radius: 2px; padding: 5px 12px; font-size: .78rem; font-weight: 600; letter-spacing: 1px; cursor: pointer; }
.iconbtn { position: relative; background: none; border: 1px solid var(--line); color: var(--ink); border-radius: 2px; padding: 5px 11px; font-size: .95rem; cursor: pointer; }
.iconbtn .badge { position: absolute; top: -6px; right: -6px; background: var(--brand2); color: #fff; font-size: .68rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }

/* ---- announcement + hero v2 ---- */
.annbar { display: flex; align-items: center; gap: 8px; background: var(--ink); color: #e8dcc3; font-size: .78rem; font-weight: 500; letter-spacing: .8px; padding: 9px 14px; line-height: 1.4; }
.andot { flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); animation: pulse 2.2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1);} 50% { opacity: .5; transform: scale(.75);} }
.hero { position: relative; background: linear-gradient(160deg, #16130e 0%, #241e14 60%, #16130e 100%); background-size: cover; background-position: center; color: #f2ede3; padding: 34px 18px 30px; }
.hero-in { max-width: 980px; margin: 0 auto; }
.hero .h1 { font-family: var(--serif); font-weight: 700; font-size: 1.7rem; letter-spacing: 4px; text-transform: uppercase; }
.hero .tagline { color: #b3a98f; font-size: .86rem; margin-top: 8px; letter-spacing: .5px; }
.hstats { display: flex; gap: 22px; margin-top: 18px; }
.hstat b { font-family: var(--serif); font-size: 1.5rem; font-weight: 700; color: var(--brand); display: block; line-height: 1.1; }
.hstat span { font-size: .68rem; color: #8d8574; text-transform: uppercase; letter-spacing: 1.5px; }
.hcta { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.hbtn { display: inline-flex; align-items: center; gap: 6px; background: var(--brand); color: #17130b; font-weight: 700; font-size: .88rem; letter-spacing: 1px; text-transform: uppercase; border-radius: 2px; padding: 11px 22px; text-decoration: none; }
.hbtn.wa { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
.stockchip.newb { background: var(--brand2); top: 8px; right: 8px; left: auto; }
.hero .hstats { gap: 26px; }
@media (max-width: 640px) {
  .hero { padding: 24px 16px 22px; }
  .hero .h1 { font-size: 1.3rem; }
  .hstats { gap: 20px; margin-top: 14px; }
  .hstat b { font-size: 1.25rem; }
  .hbtn { padding: 10px 18px; font-size: .88rem; }
}
.hero .tagline { color: #b9c3cc; font-size: .88rem; margin-top: 6px; }
.hero .who { display: flex; align-items: center; gap: 12px; }
.hero .avatar { width: 46px; height: 46px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand2)); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; font-weight: 800; }
.hero .hname { font-size: 1.15rem; font-weight: 800; }
.hero .hsub { color: #9aa5ae; font-size: .8rem; margin-top: 2px; }

/* ---- filter bar ---- */
.filterbar { position: sticky; top: 52px; z-index: 40; background: var(--bg); padding: 10px 12px 8px; }
.whtabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.whtabs::-webkit-scrollbar { display: none; }
.whtab { flex-shrink: 0; border: 1px solid var(--line); background: var(--card); color: var(--ink2); border-radius: 2px; padding: 7px 15px; font-size: .82rem; font-weight: 600; letter-spacing: .5px; cursor: pointer; }
.whtab.on { border-color: var(--ink); color: #fff; background: var(--ink); }
.searchrow { display: flex; gap: 8px; }
.searchrow input { flex: 1; border: 1px solid var(--line); border-radius: 2px; padding: 10px 12px; font-size: .9rem; background: var(--card); outline: none; }
.searchrow input:focus { border-color: var(--brand); }
.searchrow select { border: 1px solid var(--line); border-radius: 2px; padding: 10px 8px; font-size: .85rem; background: var(--card); color: var(--ink); }

/* ---- product grid ---- */
.wrap { max-width: 980px; margin: 0 auto; padding: 4px 12px 110px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.pcard { background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; display: flex; flex-direction: column; }
.pcard .pimg { position: relative; aspect-ratio: 1/0.92; background: linear-gradient(160deg, #f3efe6, #eae4d6); display: flex; align-items: center; justify-content: center; }
.pcard .pimg img { width: 100%; height: 100%; object-fit: cover; }
.pcard .pimg .emoji { font-size: 3rem; filter: drop-shadow(0 4px 8px rgba(0,0,0,.12)); }
.stockchip { position: absolute; top: 8px; left: 8px; font-size: .68rem; font-weight: 700; padding: 3px 8px; border-radius: 12px; color: #fff; }
.stockchip.ok { background: #5c7a5c; }
.stockchip.low { background: var(--warn); }
.stockchip.out { background: #9aa5ae; }
.whchip { position: absolute; bottom: 8px; left: 8px; font-size: .66rem; font-weight: 600; background: rgba(16,17,20,.75); color: #fff; padding: 3px 8px; border-radius: 10px; max-width: 85%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pbody { padding: 9px 10px 10px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.pname { font-family: var(--serif); font-weight: 600; font-size: .9rem; line-height: 1.3; min-height: 2.2em; }
.psku { color: var(--ink2); font-size: .72rem; font-family: ui-monospace, Menlo, Consolas, monospace; }
.prow { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; margin-top: auto; }
.price { font-weight: 800; color: var(--brand2); font-size: 1rem; }
.price.hideprice { color: var(--ink2); font-size: .78rem; font-weight: 600; }
.moq { color: var(--ink2); font-size: .7rem; }
.addbtn { border: 1px solid var(--ink); background: var(--ink); color: #f4f0e8; font-weight: 600; letter-spacing: 1px; border-radius: 2px; padding: 9px 0; font-size: .8rem; cursor: pointer; width: 100%; transition: all .15s; }
.addbtn:active { transform: scale(.97); }
.addbtn[disabled] { background: transparent; color: var(--ink2); border-color: var(--line); cursor: not-allowed; }
.empty { text-align: center; color: var(--ink2); padding: 50px 20px; font-size: .95rem; }

/* ---- cart drawer ---- */
.mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 90; opacity: 0; pointer-events: none; transition: opacity .2s; }
.mask.show { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; left: 0; right: 0; bottom: 0; max-height: 82vh; background: var(--card); z-index: 95; border-radius: 18px 18px 0 0; transform: translateY(105%); transition: transform .25s; display: flex; flex-direction: column; }
.drawer.show { transform: translateY(0); }
.drawer .dhead { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); font-weight: 800; }
.drawer .dbody { overflow-y: auto; padding: 10px 16px; flex: 1; }
.citem { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); align-items: center; }
.citem .ci-emoji { width: 44px; height: 44px; border-radius: 10px; background: #eef4f7; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; overflow: hidden; }
.citem .ci-emoji img { width: 100%; height: 100%; object-fit: cover; }
.citem .ci-mid { flex: 1; min-width: 0; }
.citem .ci-name { font-weight: 700; font-size: .85rem; }
.citem .ci-sub { color: var(--ink2); font-size: .72rem; margin-top: 2px; }
.qty { display: flex; align-items: center; gap: 0; border: 1.5px solid var(--line); border-radius: 8px; overflow: hidden; }
.qty button { width: 30px; height: 32px; border: none; background: #f2f4f7; font-size: 1rem; font-weight: 700; cursor: pointer; }
.qty input { width: 52px; height: 32px; border: none; text-align: center; font-size: .9rem; font-weight: 700; outline: none; }
.citem .rm { color: var(--bad); background: none; border: none; font-size: 1.1rem; cursor: pointer; padding: 4px; }
.dfoot { padding: 12px 16px 18px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 9px; background: #fafbfc; border-radius: 0 0 0 0; }
.totalline { display: flex; justify-content: space-between; font-weight: 800; font-size: 1rem; }
.totalline .val { color: var(--brand2); }
.dinput { border: 1.5px solid var(--line); border-radius: 9px; padding: 8px 10px; font-size: .85rem; outline: none; width: 100%; }
.btnrow { display: flex; gap: 8px; }
.btn { flex: 1; border: none; border-radius: 2px; padding: 11px 0; font-weight: 700; letter-spacing: .5px; font-size: .9rem; cursor: pointer; }
.btn.copy { background: var(--ink); color: #f4f0e8; }
.btn.wa { background: #1f7a4d; color: #fff; }
.btn.ghost { background: none; border: 1.5px solid var(--line); color: var(--ink2); flex: 0 0 auto; padding: 11px 14px; }

/* ---- forms / pages ---- */
.page { max-width: 460px; margin: 0 auto; padding: 26px 18px 110px; }
.page h2 { font-size: 1.25rem; margin-bottom: 4px; }
.page .sub { color: var(--ink2); font-size: .85rem; margin-bottom: 18px; }
.fgroup { margin-bottom: 13px; }
.fgroup label { display: block; font-size: .8rem; font-weight: 700; margin-bottom: 5px; color: var(--ink2); }
.fgroup input, .fgroup select, .fgroup textarea { width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: .92rem; outline: none; background: var(--card); }
.fgroup input:focus, .fgroup textarea:focus { border-color: var(--brand); }
.bigbtn { width: 100%; border: none; background: var(--ink); color: #f4f0e8; font-weight: 700; letter-spacing: 1px; font-size: .95rem; border-radius: 2px; padding: 13px; cursor: pointer; margin-top: 6px; }
.bigbtn:disabled { background: #c9ced6; }
.linkline { text-align: center; margin-top: 14px; font-size: .85rem; color: var(--ink2); }
.linkline a { color: var(--brand); font-weight: 700; text-decoration: none; }
.errmsg { background: #fdecec; color: var(--bad); border-radius: 10px; padding: 9px 12px; font-size: .85rem; margin-bottom: 12px; }
.okmsg { background: #e8f7ef; color: var(--ok); border-radius: 10px; padding: 9px 12px; font-size: .85rem; margin-bottom: 12px; }

/* my page picker */
.mypick .pc { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); align-items: center; }
.mypick .pc .nm { flex: 1; font-size: .88rem; font-weight: 600; }
.mypick .pc .sk { color: var(--ink2); font-size: .72rem; }
.mylink { background: #eef7f8; border: 1.5px dashed var(--brand); border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; }
.mylink .url { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; word-break: break-all; margin: 6px 0 8px; color: #0b7c82; font-weight: 700; }

/* ---- admin ---- */
.admin { max-width: 1060px; margin: 0 auto; padding: 14px 14px 110px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex-shrink: 0; border: 1.5px solid var(--line); background: var(--card); color: var(--ink2); padding: 7px 14px; border-radius: 18px; font-size: .84rem; font-weight: 700; cursor: pointer; }
.tabs button.on { background: #101114; color: #fff; border-color: #101114; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat .v { font-size: 1.5rem; font-weight: 800; }
.stat .k { color: var(--ink2); font-size: .76rem; margin-top: 2px; }
.tblwrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #fafbfc; font-size: .74rem; color: var(--ink2); text-transform: uppercase; letter-spacing: .4px; }
tr:last-child td { border-bottom: none; }
.smallbtn { border: 1.5px solid var(--line); background: var(--card); border-radius: 8px; padding: 4px 10px; font-size: .78rem; font-weight: 700; cursor: pointer; margin-right: 4px; }
.smallbtn.danger { color: var(--bad); border-color: #f5c9c9; }
.smallbtn.pri { background: var(--brand); border-color: var(--brand); color: #fff; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: .7rem; font-weight: 700; }
.pill.new { background: #e8f7ef; color: var(--ok); }
.pill.contacted { background: #fff4e0; color: var(--warn); }
.pill.done { background: #eef1f4; color: var(--ink2); }
.pill.cancelled { background: #fdecec; color: var(--bad); }
.pill.on { background: #e8f7ef; color: var(--ok); }
.pill.off { background: #eef1f4; color: var(--ink2); }
.admtop { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; flex-wrap: wrap; gap: 8px; }
.admtop h3 { font-size: 1rem; }
.admfilters { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.admfilters input, .admfilters select { border: 1.5px solid var(--line); border-radius: 9px; padding: 8px 10px; font-size: .85rem; background: var(--card); outline: none; }
.batchbar { display: none; align-items: center; gap: 8px; flex-wrap: wrap; background: #eef7f8; border: 1.5px solid var(--brand); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; font-weight: 700; font-size: .84rem; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 120; display: none; align-items: flex-end; justify-content: center; }
.modal.show { display: flex; }
.modal .mbox { background: var(--card); width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 18px; }
@media(min-width: 640px) { .modal { align-items: center; } .modal .mbox { border-radius: 16px; } }
.modal h3 { margin-bottom: 12px; font-size: 1.05rem; }
.modal .frow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* toast + footer */
#toast { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #f4f0e8; padding: 10px 20px; border-radius: 24px; font-size: .86rem; font-weight: 600; opacity: 0; transition: all .25s; z-index: 200; pointer-events: none; max-width: 88vw; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.footer { text-align: center; color: #9aa5ae; font-size: .74rem; padding: 18px 14px 90px; }
.footer a { color: #6b7280; }
.checkline { display: flex; align-items: center; gap: 8px; padding: 8px 0; font-size: .86rem; }
.checkline input { width: 18px; height: 18px; accent-color: var(--brand); }

/* ---- mobile bottom action bar (thumb zone) ---- */
.bottombar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; display: flex; gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(255,255,255,.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); }
.bottombar .bbtn { flex: 1; border: none; border-radius: 2px; padding: 13px 0; font-size: .9rem; font-weight: 700; letter-spacing: 1px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 7px; }
.bottombar .bbtn.cartb { background: var(--ink); color: #f4f0e8; }
.bottombar .bbtn.wab { background: #1f7a4d; color: #fff; flex: 0 0 44%; }
.bottombar .bbtn .bbadge { background: var(--brand2); color: #fff; font-size: .72rem; min-width: 20px; height: 20px; border-radius: 10px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
@media (min-width: 768px) { .bottombar { display: none; } }
@media (max-width: 767px) { #topcart { display: none; } }
/* touch targets: comfortable 44px+ on mobile */
@media (max-width: 640px) {
  .whtab { padding: 9px 16px; font-size: .9rem; }
  .searchrow { flex-wrap: wrap; }
  .searchrow input { flex: 1 1 100%; padding: 12px 14px; font-size: 1rem; }
  .searchrow select { flex: 1 1 30%; max-width: none; padding: 12px 8px; font-size: .88rem; }
  .addbtn { padding: 12px 0; font-size: .92rem; }
  .qty button { width: 36px; height: 40px; }
  .qty input { width: 58px; height: 40px; font-size: 1rem; }
  .dfoot .btnrow .btn, .dfoot .btn.wa { padding: 14px 0; font-size: .95rem; }
  .footer { padding-bottom: 120px; }
  .wrap { padding-bottom: 130px; }
  .page { padding-bottom: 130px; }
  .admin { padding-bottom: 130px; }
}
