* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #e8631a;
  --primary-dark: #c44f0e;
  --bg: #fdf6ee;
  --surface: #fff;
  --text: #2d2d2d;
  --muted: #888;
  --border: #eee;
  --radius: 12px;
}

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── 导航 ── */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}
.logo span { font-size: 26px; }
.nav-actions { display: flex; align-items: center; gap: 16px; }
.cart-btn {
  position: relative;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 8px 20px;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background .2s;
}
.cart-btn:hover { background: var(--primary-dark); }
.cart-badge {
  background: #fff;
  color: var(--primary);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.admin-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}
.admin-link:hover { color: var(--primary); }

/* ── 主体布局 ── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ── 分类筛选 ── */
.category-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.cat-btn {
  padding: 8px 22px;
  border-radius: 24px;
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: 15px;
  cursor: pointer;
  transition: all .2s;
  color: var(--text);
}
.cat-btn:hover, .cat-btn.active {
  border-color: var(--primary);
  color: var(--primary);
  background: #fff4ed;
}

/* ── 商品网格 ── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}
.product-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  transition: transform .2s, box-shadow .2s;
  display: flex;
  flex-direction: column;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
}
.product-img {
  background: linear-gradient(135deg, #fff4ed, #ffe0c8);
  font-size: 72px;
  text-align: center;
  padding: 28px 0;
  line-height: 1;
}
.product-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.product-category {
  font-size: 12px;
  color: var(--primary);
  background: #fff4ed;
  padding: 2px 8px;
  border-radius: 12px;
  align-self: flex-start;
}
.product-name {
  font-size: 15px;
  font-weight: 600;
}
.product-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  flex: 1;
}
.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}
.product-price {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}
.product-price span { font-size: 13px; font-weight: 400; }
.add-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.add-btn:hover { background: var(--primary-dark); }

/* ── 购物车侧栏 ── */
.cart-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 200;
}
.cart-overlay.open { display: block; }
.cart-drawer {
  position: fixed;
  right: -420px;
  top: 0;
  width: 400px;
  max-width: 100vw;
  height: 100vh;
  background: var(--surface);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transition: right .3s ease;
  box-shadow: -4px 0 24px rgba(0,0,0,.12);
}
.cart-drawer.open { right: 0; }
.cart-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cart-header h2 { font-size: 18px; }
.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
}
.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cart-empty {
  text-align: center;
  color: var(--muted);
  margin-top: 60px;
  font-size: 15px;
}
.cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg);
  border-radius: 10px;
}
.cart-item-emoji { font-size: 32px; }
.cart-item-info { flex: 1; }
.cart-item-name { font-size: 14px; font-weight: 600; }
.cart-item-price { font-size: 13px; color: var(--primary); margin-top: 2px; }
.qty-control {
  display: flex;
  align-items: center;
  gap: 8px;
}
.qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qty-btn:hover { border-color: var(--primary); color: var(--primary); }
.qty-num { font-size: 15px; font-weight: 600; min-width: 20px; text-align: center; }
.cart-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
}
.cart-total {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  margin-bottom: 16px;
}
.cart-total strong { font-size: 22px; color: var(--primary); }
.checkout-btn {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}
.checkout-btn:hover { background: var(--primary-dark); }

/* ── 结算弹窗 ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 300;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: 16px;
  padding: 32px;
  width: 480px;
  max-width: 95vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal h2 { margin-bottom: 24px; font-size: 20px; }
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.form-group label { font-size: 14px; font-weight: 600; }
.form-group input, .form-group textarea {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s;
}
.form-group input:focus, .form-group textarea:focus {
  border-color: var(--primary);
}
.form-group textarea { resize: vertical; min-height: 72px; }
.order-summary {
  background: var(--bg);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 2;
}
.order-summary .total-line {
  font-weight: 700;
  color: var(--primary);
  font-size: 16px;
  border-top: 1px dashed var(--border);
  padding-top: 8px;
  margin-top: 4px;
}
.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}
.btn-cancel {
  flex: 1;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
}
.btn-submit {
  flex: 2;
  padding: 12px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}
.btn-submit:hover { background: var(--primary-dark); }

/* ── 成功提示 ── */
.toast {
  position: fixed;
  top: 80px;
  right: 24px;
  background: #2d9c5a;
  color: #fff;
  padding: 14px 24px;
  border-radius: 10px;
  font-size: 15px;
  z-index: 400;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  transform: translateX(200%);
  transition: transform .3s;
}
.toast.show { transform: translateX(0); }

/* ── 后台样式 ── */
.admin-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
}
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.stat-card .label { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.stat-card .value { font-size: 28px; font-weight: 700; color: var(--primary); }
.section-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}
.orders-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  font-size: 14px;
}
.orders-table th {
  background: #fdf0e6;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--primary);
}
.orders-table td {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}
.orders-table tr:hover td { background: var(--bg); }
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.status-待处理 { background: #fff3cd; color: #856404; }
.status-已发货 { background: #cce5ff; color: #004085; }
.status-已完成 { background: #d4edda; color: #155724; }
.status-已取消 { background: #f8d7da; color: #721c24; }
.status-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

@media (max-width: 600px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .cart-drawer { width: 100vw; }
  .orders-table { font-size: 12px; }
  .orders-table td, .orders-table th { padding: 8px 10px; }
}
