/* ========== 公共基础样式 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #FF4D4F;
  --primary-light: #FFF1F0;
  --primary-dark: #CF1322;
  --orange: #FF7A45;
  --green: #52C41A;
  --blue: #1890FF;
  --purple: #722ED1;
  --gray-1: #1a1a2e;
  --gray-2: #555;
  --gray-3: #999;
  --gray-4: #d9d9d9;
  --gray-5: #f7f8fa;
  --white: #fff;
  --shadow: 0 2px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 6px;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: #f5f6f8;
  color: var(--gray-1);
  font-size: 14px;
  line-height: 1.6;
  max-width: 414px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.admin-body { max-width: 100%; background: #f0f2f5; }

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button, input, select, textarea {
  font-family: inherit; font-size: inherit; border: none; outline: none;
}
button { cursor: pointer; }
input, select, textarea { background: var(--white); }

/* ========== 页面容器 ========== */
.page { padding-bottom: 74px; min-height: 100vh; background: #f5f6f8; }

/* ========== 顶部导航栏 ========== */
.navbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  height: 52px; background: var(--white);
  font-size: 17px; font-weight: 600; letter-spacing: .3px;
  box-shadow: 0 1px 0 rgba(0,0,0,.04);
}
.navbar .back {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 22px; color: var(--gray-2); cursor: pointer;
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; transition: background .2s;
}
.navbar .back:active { background: var(--gray-5); }
.navbar-primary {
  background: #fff; color: var(--primary); box-shadow: 0 1px 8px rgba(0,0,0,.04);
}
.navbar-primary .back { color: var(--gray-2); }
.navbar-primary .back:active { background: var(--gray-5); }

/* ========== 底部TabBar ========== */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 414px;
  display: flex; background: var(--white);
  border-top: 1px solid rgba(0,0,0,.04);
  height: 62px; z-index: 100;
  box-shadow: 0 -2px 10px rgba(0,0,0,.03);
}
.tabbar-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--gray-3); font-size: 10px; gap: 3px;
  transition: color .2s; text-decoration: none;
}
.tabbar-item .tab-icon { font-size: 24px; line-height: 1; }
.tabbar-item.active { color: var(--primary); font-weight: 600; }

/* ========== 卡片 ========== */
.card {
  background: var(--white); border-radius: var(--radius);
  margin: 12px 14px; padding: 18px; box-shadow: var(--shadow);
}
.card-title {
  font-size: 16px; font-weight: 600; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: space-between;
  color: var(--gray-1);
}
.card-title .more { font-size: 12px; color: var(--gray-3); font-weight: 400; }

/* ========== 按钮 ========== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 24px; border-radius: 24px;
  font-size: 14px; font-weight: 500; transition: all .2s;
  border: none; cursor: pointer;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: #ff4d4f; color: var(--white); box-shadow: 0 4px 12px rgba(255,77,79,.2); }
.btn-primary:active { background: #e8383a; box-shadow: 0 2px 6px rgba(255,77,79,.15); }
.btn-outline { border: 1.5px solid var(--primary); color: var(--primary); background: transparent; }
.btn-block { display: flex; width: 100%; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-sm { padding: 6px 16px; font-size: 12px; border-radius: 16px; }
.btn-disabled { opacity: .5; pointer-events: none; }

/* ========== 表单 ========== */
.form-group { margin-bottom: 16px; }
.form-label { font-size: 13px; color: var(--gray-2); margin-bottom: 6px; display: block; font-weight: 500; }
.form-input {
  width: 100%; padding: 12px 14px; border: 1.5px solid #e8e8e8;
  border-radius: var(--radius-sm); font-size: 14px;
  transition: border-color .2s, box-shadow .2s; background: var(--gray-5);
}
.form-input:focus { border-color: var(--primary); background: var(--white); box-shadow: 0 0 0 3px rgba(255,77,79,.08); }
.form-select {
  width: 100%; padding: 12px 14px; border: 1.5px solid #e8e8e8;
  border-radius: var(--radius-sm); font-size: 14px; background: var(--gray-5);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%23999'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  transition: border-color .2s;
}
.form-select:focus { border-color: var(--primary); background-color: var(--white); }

/* ========== 标签 ========== */
.tag {
  display: inline-block; padding: 3px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .3px;
}
.tag-red { background: var(--primary-light); color: var(--primary); }
.tag-green { background: #f6ffed; color: var(--green); }
.tag-blue { background: #e6f7ff; color: var(--blue); }
.tag-orange { background: #fff7e6; color: var(--orange); }

/* ========== 底部操作栏 ========== */
.bottom-bar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 414px;
  display: flex; align-items: center;
  background: var(--white); padding: 10px 16px;
  border-top: 1px solid rgba(0,0,0,.04); z-index: 100;
  gap: 12px; box-shadow: 0 -4px 16px rgba(0,0,0,.04);
}
.bottom-bar .price { flex: 1; }
.bottom-bar .price .label { font-size: 12px; color: var(--gray-3); }
.bottom-bar .price .amount { font-size: 22px; font-weight: 700; color: var(--primary); }
.bottom-bar .price .amount small { font-size: 14px; }

/* ========== 广告轮播 ========== */
.swiper {
  position: relative; overflow: hidden;
  border-radius: var(--radius); margin: 14px;
  height: 150px; box-shadow: var(--shadow);
}
.swiper-track {
  display: flex; transition: transform .5s cubic-bezier(.4,0,.2,1);
  height: 100%;
}
.swiper-slide {
  min-width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 6px;
  font-size: 18px; font-weight: 700; color: var(--white);
  border-radius: var(--radius); cursor: pointer;
  text-shadow: 0 1px 4px rgba(0,0,0,.15);
}
.swiper-slide .slide-sub { font-size: 12px; font-weight: 400; opacity: .85; text-shadow: none; }
.swiper-dots {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px;
}
.swiper-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,.4); transition: all .3s;
}
.swiper-dot.active { background: var(--white); width: 20px; border-radius: 3px; }

/* ========== 选择器网格 ========== */
.spec-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.spec-item {
  background: var(--gray-5); border-radius: var(--radius);
  padding: 18px 8px; text-align: center; cursor: pointer;
  border: 2px solid transparent; transition: all .25s;
}
.spec-item:hover { border-color: #ffc0c0; background: #fff8f8; }
.spec-item.active {
  border-color: var(--primary); background: var(--primary-light);
  box-shadow: 0 4px 12px rgba(255,77,79,.15);
}
.spec-item .icon { font-size: 36px; margin-bottom: 8px; }
.spec-item .name { font-size: 14px; font-weight: 600; }
.spec-item .price { font-size: 12px; color: var(--primary); margin-top: 4px; font-weight: 600; }

/* ========== 数量选择器 ========== */
.qty-selector {
  display: inline-flex; align-items: center; border: 1.5px solid #e8e8e8;
  border-radius: var(--radius-sm); overflow: hidden;
}
.qty-btn {
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  background: var(--gray-5); font-size: 18px; color: var(--gray-2);
  cursor: pointer; transition: all .2s; font-weight: 500;
}
.qty-btn:active { background: #e0e0e0; }
.qty-value {
  width: 50px; height: 38px; text-align: center; font-size: 16px;
  font-weight: 700; border: none; border-left: 1.5px solid #e8e8e8; border-right: 1.5px solid #e8e8e8;
  background: var(--white);
}

/* ========== 订单列表 ========== */
.order-card {
  background: var(--white); border-radius: var(--radius);
  margin: 10px 14px; padding: 16px; box-shadow: var(--shadow);
  transition: box-shadow .2s; cursor: pointer;
}
.order-card:active { box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.order-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid #f5f5f5;
}
.order-no { font-size: 12px; color: var(--gray-3); font-family: 'SF Mono', 'Menlo', monospace; }
.order-body { display: flex; gap: 12px; margin-bottom: 12px; }
.order-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
}
.order-icon.pickup { background: linear-gradient(135deg, #fff1f0, #ffe7e6); }
.order-icon.send { background: linear-gradient(135deg, #f0f0ff, #e6e6ff); }
.order-info { flex: 1; }
.order-info .title { font-weight: 600; margin-bottom: 3px; font-size: 14px; }
.order-info .desc { font-size: 12px; color: var(--gray-3); line-height: 1.5; }
.order-footer { display: flex; justify-content: space-between; align-items: center; }
.order-price { font-size: 17px; font-weight: 700; color: var(--primary); }
.order-actions { display: flex; gap: 8px; }

/* ========== 用户中心 ========== */
.user-header {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
  padding: 44px 20px 32px; color: var(--white);
  border-radius: 0 0 24px 24px;
}
.user-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(255,255,255,.25); display: flex; align-items: center;
  justify-content: center; font-size: 30px; margin-bottom: 10px;
  border: 3px solid rgba(255,255,255,.4);
}
.user-name { font-size: 20px; font-weight: 700; }
.user-stats { display: flex; gap: 32px; margin-top: 18px; }
.user-stat { text-align: center; }
.user-stat .num { font-size: 22px; font-weight: 700; }
.user-stat .label { font-size: 11px; opacity: .75; margin-top: 2px; }

.order-shortcuts { display: flex; justify-content: space-around; padding: 18px 0; }
.order-shortcut {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: 12px; color: var(--gray-2); cursor: pointer; text-decoration: none;
}
.order-shortcut .icon {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; transition: transform .2s;
}
.order-shortcut:active .icon { transform: scale(.9); }

.menu-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; padding: 8px 0; }
.menu-item {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: 12px; color: var(--gray-2); cursor: pointer;
}
.menu-item .icon {
  width: 46px; height: 46px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; transition: transform .2s;
}
.menu-item:active .icon { transform: scale(.9); }

/* ========== 优惠券 ========== */
.coupon-card {
  display: flex; border-radius: var(--radius); overflow: hidden;
  margin-bottom: 12px; box-shadow: var(--shadow);
}
.coupon-left {
  width: 100px; padding: 16px 12px; text-align: center;
  color: var(--white); display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  position: relative;
}
.coupon-left::after {
  content: ''; position: absolute; right: -6px; top: 50%; transform: translateY(-50%);
  width: 12px; height: 12px; border-radius: 50%; background: var(--gray-5);
}
.coupon-amount { font-size: 28px; font-weight: 700; }
.coupon-amount small { font-size: 14px; }
.coupon-condition { font-size: 10px; opacity: .8; }
.coupon-right {
  flex: 1; padding: 14px 16px; background: var(--white);
  display: flex; flex-direction: column; justify-content: center;
}
.coupon-name { font-weight: 600; margin-bottom: 4px; font-size: 14px; }
.coupon-expire { font-size: 11px; color: var(--gray-3); }

/* ========== 配送端 ========== */
.rider-order-card {
  background: var(--white); border-radius: var(--radius);
  margin-bottom: 12px; padding: 16px; box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
  transition: box-shadow .2s;
}
.rider-order-card:active { box-shadow: 0 1px 4px rgba(0,0,0,.04); }
.rider-order-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.rider-order-detail { font-size: 13px; color: var(--gray-2); line-height: 1.9; }
.rider-order-detail .label { color: var(--gray-3); display: inline-block; width: 70px; }

.stat-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 14px; }
.stat-card {
  background: var(--white); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); text-align: center;
}
.stat-card .num { font-size: 30px; font-weight: 700; color: var(--primary); }
.stat-card .label { font-size: 12px; color: var(--gray-3); margin-top: 4px; }

/* ========== 后台管理 ========== */
.admin-sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: 220px; background: linear-gradient(180deg, #001529 0%, #002140 100%);
  color: var(--white); padding-top: 20px; z-index: 200;
}
.admin-logo {
  padding: 0 20px 20px; font-size: 18px; font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 10px;
}
.admin-menu-item {
  padding: 13px 20px; cursor: pointer; transition: all .2s;
  display: flex; align-items: center; gap: 10px; font-size: 14px;
  color: rgba(255,255,255,.65); text-decoration: none; border-left: 3px solid transparent;
}
.admin-menu-item:hover { color: var(--white); background: rgba(255,255,255,.06); }
.admin-menu-item.active {
  background: rgba(255,77,79,.15); color: var(--white);
  border-left-color: var(--primary);
}
.admin-content { margin-left: 220px; padding: 24px; }
.admin-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px;
}
.admin-header h2 { font-size: 20px; font-weight: 700; }

.admin-stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  margin-bottom: 24px;
}
.admin-stat-card {
  background: var(--white); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.admin-stat-card .label { font-size: 13px; color: var(--gray-3); }
.admin-stat-card .num { font-size: 30px; font-weight: 700; margin: 8px 0 4px; }
.admin-stat-card .trend { font-size: 12px; }
.admin-stat-card .trend.up { color: var(--green); }
.admin-stat-card .trend.down { color: var(--primary); }

.admin-table {
  width: 100%; background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.admin-table table { width: 100%; border-collapse: collapse; }
.admin-table th {
  background: var(--gray-5); padding: 12px 16px;
  text-align: left; font-size: 13px; color: var(--gray-2); font-weight: 600;
}
.admin-table td { padding: 12px 16px; border-bottom: 1px solid #f5f5f5; font-size: 13px; }
.admin-table tr:hover td { background: #fafafa; }

.admin-filter {
  display: flex; gap: 12px; margin-bottom: 16px; align-items: center; flex-wrap: wrap;
}
.admin-filter input, .admin-filter select {
  padding: 8px 12px; border: 1.5px solid #d9d9d9; border-radius: 8px; font-size: 13px;
  transition: border-color .2s;
}
.admin-filter input:focus, .admin-filter select:focus { border-color: var(--primary); }

/* ========== 配送方式选择 ========== */
.delivery-options { display: flex; gap: 12px; }
.delivery-option {
  flex: 1; padding: 18px; border-radius: var(--radius);
  border: 2px solid #eee; text-align: center; cursor: pointer;
  transition: all .25s; position: relative; overflow: hidden;
}
.delivery-option:hover { border-color: #ffc0c0; }
.delivery-option.active {
  border-color: var(--primary); background: var(--primary-light);
  box-shadow: 0 4px 12px rgba(255,77,79,.12);
}
.delivery-option .icon { font-size: 30px; margin-bottom: 8px; }
.delivery-option .name { font-size: 14px; font-weight: 600; }
.delivery-option .desc { font-size: 11px; color: var(--gray-3); margin-top: 3px; }
.delivery-option .check {
  position: absolute; top: 0; right: 0;
  width: 26px; height: 26px; background: var(--primary);
  color: var(--white); font-size: 12px;
  display: none; align-items: center; justify-content: center;
  border-radius: 0 0 0 12px;
}
.delivery-option.active .check { display: flex; }

/* ========== 时间选择 ========== */
.time-slots { display: flex; gap: 10px; flex-wrap: wrap; }
.time-slot {
  padding: 10px 18px; border-radius: 22px;
  border: 1.5px solid #e8e8e8; font-size: 13px;
  cursor: pointer; transition: all .25s; font-weight: 500;
}
.time-slot:hover { border-color: #ffc0c0; }
.time-slot.active {
  background: #ff4d4f;
  color: var(--white); border-color: #ff4d4f;
  box-shadow: 0 3px 10px rgba(255,77,79,.2);
}

/* ========== 取件号输入 ========== */
.pickup-code-list { display: flex; flex-direction: column; gap: 10px; }
.pickup-code-item { display: flex; align-items: center; gap: 10px; }
.pickup-code-item .num {
  width: 26px; height: 26px; border-radius: 50%;
  background: #ff4d4f;
  color: var(--white); display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.pickup-code-item input { flex: 1; }

/* ========== 图片上传 ========== */
.upload-area {
  width: 80px; height: 80px; border: 2px dashed #d9d9d9;
  border-radius: var(--radius-sm); display: flex;
  flex-direction: column; align-items: center; justify-content: center;
  color: var(--gray-3); font-size: 24px; cursor: pointer;
  transition: all .2s;
}
.upload-area:hover { border-color: var(--primary); color: var(--primary); }
.upload-area .text { font-size: 10px; margin-top: 4px; }
.upload-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.upload-preview {
  width: 80px; height: 80px; border-radius: var(--radius-sm);
  background: var(--gray-5); position: relative; overflow: hidden;
}
.upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.upload-preview .remove {
  position: absolute; top: 2px; right: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; cursor: pointer;
}

/* ========== Tabs ========== */
.tabs { display: flex; background: var(--white); box-shadow: 0 1px 0 rgba(0,0,0,.04); }
.tab-item {
  flex: 1; text-align: center; padding: 14px 0;
  font-size: 14px; color: var(--gray-3); cursor: pointer;
  position: relative; transition: color .2s; font-weight: 500;
}
.tab-item.active { color: var(--primary); font-weight: 600; }
.tab-item.active::after {
  content: ''; position: absolute; bottom: 0; left: 50%;
  transform: translateX(-50%); width: 28px; height: 3px;
  background: var(--primary);
  border-radius: 2px;
}

/* ========== 复选框 ========== */
.checkbox {
  width: 20px; height: 20px; border: 2px solid #d9d9d9;
  border-radius: 5px; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  transition: all .2s; flex-shrink: 0;
}
.checkbox.checked { background: var(--primary); border-color: var(--primary); color: var(--white); font-size: 12px; }

/* ========== 弹窗 ========== */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.45); z-index: 300;
  display: none; align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--white); border-radius: 18px;
  width: 90%; max-width: 360px; padding: 24px;
  max-height: 80vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
  animation: modalIn .25s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.92) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 16px; text-align: center; }

/* ========== 空状态 ========== */
.empty-state { text-align: center; padding: 50px 20px; color: var(--gray-3); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: .6; }

/* ========== 分割线 ========== */
.divider { height: 1px; background: #f0f0f0; margin: 14px 0; }

/* ========== 行 ========== */
.row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 0;
}
.row + .row { border-top: 1px solid #f5f5f5; }
.row .label { color: var(--gray-2); font-size: 14px; }
.row .value { font-size: 14px; display: flex; align-items: center; gap: 4px; }

/* ========== 批量操作 ========== */
.batch-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--primary-light);
  border-radius: var(--radius-sm); margin-bottom: 16px;
  border: 1px solid #ffccc7;
}
.batch-bar .count { font-size: 13px; color: var(--primary); flex: 1; font-weight: 500; }

/* ========== 服务入口卡片 ========== */
.service-entry {
  border-radius: 18px; padding: 28px 18px; text-align: center;
  color: #fff; transition: transform .2s, box-shadow .2s;
  cursor: pointer; text-decoration: none; display: block;
}
.service-entry:active { transform: scale(.97); }
.service-entry .entry-icon { font-size: 44px; margin-bottom: 10px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.1)); }
.service-entry .entry-title { font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.service-entry .entry-desc { font-size: 12px; opacity: .85; margin-top: 5px; }
