:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
.btn { background: var(--primary); color: #fff; border: none; padding: 8px 16px; border-radius: 8px; font-size: 14px; transition: .15s; }
.btn:hover { background: var(--primary-dark); }
.btn.ghost { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn.gray { background: #e5e7eb; color: #374151; }
.btn.gray:hover { background: #d1d5db; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { font-family: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; width: 100%; background: #fff; color: var(--text); }
label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 4px; }

/* top nav */
.nav { background: #fff; border-bottom: 1px solid var(--border); padding: 0 20px; height: 56px; display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 50; }
.nav .brand { font-weight: 700; font-size: 16px; color: var(--primary); }
.nav .spacer { flex: 1; }
.nav .lang { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.nav .lang button { border: none; background: #fff; padding: 6px 12px; font-size: 13px; }
.nav .lang button.active { background: var(--primary); color: #fff; }

/* layout */
.wrap { max-width: 1200px; margin: 20px auto; padding: 0 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.card .img { width: 100%; height: 160px; object-fit: cover; background: #f0f2f5; display: flex; align-items: center; justify-content: center; color: #9ca3af; font-size: 13px; }
.card .body { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.card .title { font-weight: 600; font-size: 15px; }
.card .meta { color: var(--muted); font-size: 12px; }
.card .price { font-size: 18px; font-weight: 700; color: var(--primary); }
.card .row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.card .qty { width: 64px; text-align: center; }
.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #eff6ff; color: var(--primary); }
.tag.combo { background: #fef3c7; color: #b45309; }
.tag.battery { background: #ecfdf5; color: #047857; }
.stock-ok { color: var(--ok); } .stock-low { color: var(--warn); } .stock-out { color: var(--bad); }

/* section */
.section-title { font-size: 18px; font-weight: 700; margin: 24px 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title .count { font-size: 13px; color: var(--muted); font-weight: 400; }

/* login */
.center { max-width: 380px; margin: 80px auto; background: #fff; padding: 28px; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); }
.center h2 { margin: 0 0 16px; }
.field { margin-bottom: 14px; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-bg.open { display: flex; }
.modal { background: #fff; border-radius: var(--radius); max-width: 520px; width: 100%; max-height: 90vh; overflow: auto; padding: 20px; }
.modal h3 { margin: 0 0 14px; }
.modal .close { float: right; border: none; background: none; font-size: 22px; cursor: pointer; color: var(--muted); }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.tabs button { border: none; background: none; padding: 8px 4px; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* table */
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); font-size: 13px; }
th { color: var(--muted); font-weight: 600; background: #f9fafb; }
.badge { font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 600; }
.badge.pending { background: #fef3c7; color: #b45309; }
.badge.submitted { background: #dbeafe; color: #1d4ed8; }
.badge.confirmed { background: #ede9fe; color: #6d28d9; }
.badge.processing { background: #cffafe; color: #0e7490; }
.badge.shipped { background: #dcfce7; color: #15803d; }
.badge.completed { background: #e5e7eb; color: #374151; }
.badge.cancelled { background: #fee2e2; color: #b91c1c; }

/* cart drawer */
.drawer { position: fixed; top: 0; right: 0; height: 100%; width: 380px; background: #fff; box-shadow: -2px 0 12px rgba(0,0,0,.12); transform: translateX(100%); transition: .25s; z-index: 90; display: flex; flex-direction: column; }
.drawer.open { transform: translateX(0); }
.drawer .head { padding: 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.drawer .items { flex: 1; overflow: auto; padding: 12px 16px; }
.drawer .ci { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.drawer .ci img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
.drawer .foot { padding: 16px; border-top: 1px solid var(--border); }
.cart-btn { position: relative; }
.cart-btn .n { position: absolute; top: -6px; right: -8px; background: var(--bad); color: #fff; font-size: 11px; border-radius: 999px; padding: 0 5px; }

.row2 { display: flex; gap: 12px; } .row2 > * { flex: 1; }
.muted { color: var(--muted); } .right { text-align: right; } .mt { margin-top: 12px; } .mb { margin-bottom: 12px; }
.preview-img { max-width: 120px; max-height: 120px; border-radius: 8px; border: 1px solid var(--border); }
.empty { text-align: center; color: var(--muted); padding: 40px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat .n { font-size: 24px; font-weight: 700; } .stat .l { color: var(--muted); font-size: 13px; }
.dash-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.dash-nav button { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; }
.dash-nav button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.langshow::after { content: ''; }
.hidden { display: none !important; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 200; opacity: 0; transition: .2s; }
.toast.show { opacity: 1; }
img.full { max-width: 100%; border-radius: 8px; border: 1px solid var(--border); margin-top: 8px; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }

/* IP country notice banner (storefront) */
.ipbanner { position: sticky; top: 0; z-index: 90; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #fff7e6; border-bottom: 1px solid #ffd591; color: #874d00; padding: 8px 16px; font-size: 13px; }
.ipbanner .btn { flex-shrink: 0; }
.badge.ipwarn { display: inline-block; background: #fff1f0; color: #cf1322; border: 1px solid #ffa39e; border-radius: 999px; padding: 0 8px; font-size: 12px; }

/* ---------- environment badge (dev / prod) ---------- */
.env-badge { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 20px; margin-left: 10px; letter-spacing: .5px; vertical-align: middle; }
.env-badge.dev { background: #eef2ff; color: #1f4fd8; border: 1px solid #c7d2fe; }
.env-badge.prod { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
