/* style.css — 商城前后台共用样式（深色 / 移动优先） */
:root {
  --bg: #0f172a; --card: #1e293b; --card2: #16213a;
  --border: #2b3b55; --text: #e2e8f0; --muted: #94a3b8;
  --primary: #3b82f6; --primary-d: #2563eb; --danger: #ef4444; --ok: #10b981;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body { font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.topbar { background: rgba(15, 23, 42, .92); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 8px; }
.brand { font-weight: 800; font-size: 18px; white-space: nowrap; }
.cart-btn { background: var(--primary); color: #fff; border: none; padding: 8px 14px;
  border-radius: 8px; font-size: 14px; cursor: pointer; }
.announcement { background: #1d4ed8; color: #fff; text-align: center; padding: 8px 12px; font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; padding: 20px 0 80px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.thumb { height: 150px; background: linear-gradient(135deg, #334155, #1e293b); display: flex; align-items: center; justify-content: center; color: #64748b; font-size: 34px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.p-name { font-size: 15px; font-weight: 600; line-height: 1.4; word-break: break-all; }
.p-desc { font-size: 12px; color: var(--muted); line-height: 1.5; word-break: break-all; }
.p-price { color: #60a5fa; font-weight: 800; font-size: 18px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stock-ok { color: var(--ok); font-size: 12px; }
.stock-no { color: var(--danger); font-size: 12px; }
.qty { display: flex; align-items: center; gap: 8px; }
.qty button { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--card2); color: var(--text); cursor: pointer; font-size: 16px; }
.qty input { width: 48px; height: 28px; text-align: center; border-radius: 6px;
  border: 1px solid var(--border); background: var(--card2); color: var(--text); }
.btn { border: none; border-radius: 8px; padding: 9px 14px; font-size: 14px; cursor: pointer; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn.block { display: block; width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.empty { color: var(--muted); text-align: center; padding: 60px 0; grid-column: 1 / -1; }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 30; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 92vw);
  background: var(--card); border-left: 1px solid var(--border); z-index: 31; display: flex; flex-direction: column; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 700; }
.drawer-head button { background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; }
.drawer-body { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.cart-item { border: 1px solid var(--border); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; background: var(--card2); }
.drawer-foot { border-top: 1px solid var(--border); padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 20px; width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 8px; max-height: 90vh; overflow-y: auto; }
.modal-box h3 { margin-bottom: 6px; }
.modal-box.center { text-align: center; align-items: center; }
.modal-box label { font-size: 13px; color: var(--muted); margin-top: 6px; }
.modal-box input, .modal-box select, .modal-box textarea {
  background: var(--card2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 9px 10px; font-size: 14px; width: 100%; }
.err-msg { color: var(--danger); font-size: 13px; min-height: 18px; }
.order-no { font-size: 22px; font-weight: 800; color: #60a5fa; margin: 4px 0; word-break: break-all; }
.muted { color: var(--muted); font-size: 13px; }

/* 管理后台 */
.login-box { max-width: 340px; margin: 16vh auto; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.login-box input { background: var(--card2); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 9px 10px; font-size: 14px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { background: transparent; border: none; color: var(--muted); padding: 8px 12px; font-size: 14px; cursor: pointer; border-radius: 8px; }
.tab.active { background: var(--primary); color: #fff; }
.stats-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 20px 0; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.stat-card .num { font-size: 24px; font-weight: 800; color: #60a5fa; word-break: break-all; }
.stat-card .lbl { font-size: 12px; color: var(--muted); margin-top: 4px; }
.table-wrap { overflow-x: auto; margin: 16px 0; border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; background: var(--card); font-size: 13px; }
th, td { padding: 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; background: var(--card2); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
select.status { background: var(--card2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 4px 6px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.badge.on { background: rgba(16,185,129,.15); color: #34d399; }
.badge.off { background: rgba(239,68,68,.15); color: #f87171; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 16px 0; }
.panel { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.panel input, .panel textarea, .panel select { background: var(--card2); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 9px 10px; font-size: 14px; }
.panel input.full, .panel textarea.full { width: 100%; }
img.thumb-mini { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; display: block; }
.mini-ph { width: 44px; height: 44px; border-radius: 6px; background: var(--card2); display: flex; align-items: center; justify-content: center; font-size: 18px; color: #475569; }
