/* ===== 基础 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Microsoft YaHei", Helvetica, Arial, sans-serif;
    color: #222; background: #f5f6f8; line-height: 1.6; min-height: 100vh;
    display: flex; flex-direction: column;
}
a { color: #2b6cb0; text-decoration: none; }
a:hover { text-decoration: underline; }
.text-muted { color: #888; }
.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }
main.container { flex: 1; padding-top: 20px; padding-bottom: 40px; }

/* ===== 头部 ===== */
.site-header {
    background: #fff; border-bottom: 1px solid #e3e6ea;
    box-shadow: 0 1px 4px rgba(0,0,0,.04); position: sticky; top: 0; z-index: 10;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { font-size: 20px; font-weight: 700; color: #1a202c; }
.top-nav a { margin-left: 18px; color: #4a5568; font-size: 14px; }
.top-nav a:hover { color: #2b6cb0; }
.badge {
    display: inline-block; min-width: 18px; height: 18px; line-height: 18px;
    background: #e53e3e; color: #fff; font-size: 12px; border-radius: 9px;
    padding: 0 5px; text-align: center; margin-left: 2px;
}

/* ===== 按钮 ===== */
.btn {
    display: inline-block; padding: 8px 16px; border: none; border-radius: 4px;
    font-size: 14px; cursor: pointer; background: #edf2f7; color: #2d3748;
    text-decoration: none; transition: all .15s;
}
.btn:hover { text-decoration: none; opacity: .9; }
.btn-primary { background: #3182ce; color: #fff; }
.btn-success { background: #38a169; color: #fff; }
.btn-danger { background: #e53e3e; color: #fff; }
.btn-warn { background: #dd6b20; color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { background: #cbd5e0; cursor: not-allowed; }

/* ===== 卡片 ===== */
.card { background: #fff; border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,.06); padding: 20px; }
.page-title { font-size: 22px; margin-bottom: 16px; color: #1a202c; }

/* ===== 商品网格 ===== */
.product-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
}
.product-card {
    background: #fff; border-radius: 6px; overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.06); transition: box-shadow .2s;
    display: flex; flex-direction: column;
}
.product-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.product-card .thumb {
    width: 100%; height: 180px; background: #edf2f7; object-fit: cover;
    display: block;
}
.product-card .thumb-placeholder {
    width: 100%; height: 180px; background: #edf2f7;
    display: flex; align-items: center; justify-content: center; color: #a0aec0;
    font-size: 14px;
}
.product-card .body { padding: 12px; flex: 1; display: flex; flex-direction: column; }
.product-card .name { font-size: 15px; font-weight: 600; color: #1a202c; margin-bottom: 6px; }
.product-card .desc { font-size: 12px; color: #718096; flex: 1; margin-bottom: 8px;
    overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.product-card .price { color: #e53e3e; font-weight: 700; font-size: 18px; margin-bottom: 8px; }
.product-card .meta { font-size: 12px; color: #718096; margin-bottom: 10px; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 4px; font-size: 14px; color: #4a5568; }
.form-control {
    width: 100%; padding: 8px 10px; border: 1px solid #cbd5e0; border-radius: 4px;
    font-size: 14px; font-family: inherit;
}
.form-control:focus { outline: none; border-color: #3182ce; }
textarea.form-control { resize: vertical; min-height: 70px; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

/* ===== 表格 ===== */
table.data-table { width: 100%; border-collapse: collapse; background: #fff; }
table.data-table th, table.data-table td {
    padding: 10px 12px; border-bottom: 1px solid #e2e8f0; text-align: left; font-size: 14px;
}
table.data-table th { background: #f7fafc; font-weight: 600; color: #4a5568; }
table.data-table tr:hover { background: #f7fafc; }

/* ===== 状态标签 ===== */
.tag {
    display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px;
}
.tag-pending { background: #feebc8; color: #c05621; }
.tag-paid { background: #bee3f8; color: #2b6cb0; }
.tag-delivered { background: #c6f6d5; color: #276749; }
.tag-closed { background: #e2e8f0; color: #718096; }

/* ===== 购物车 ===== */
.cart-item { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid #e2e8f0; }
.cart-item .qty-control { display: flex; align-items: center; gap: 8px; }
.qty-control button { width: 28px; height: 28px; border: 1px solid #cbd5e0; background: #fff; cursor: pointer; border-radius: 4px; }
.qty-control input { width: 44px; text-align: center; border: 1px solid #cbd5e0; border-radius: 4px; padding: 4px 0; }

/* ===== 支付页 ===== */
.pay-wrap { text-align: center; padding: 30px 0; }
.pay-wrap .qr-box { display: inline-block; padding: 16px; background: #fff; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.pay-wrap .qr-box img { width: 220px; height: 220px; }
.pay-wrap .amount { font-size: 28px; color: #e53e3e; font-weight: 700; margin: 16px 0 8px; }
.pay-wrap .hint { color: #718096; font-size: 14px; }
.countdown { color: #dd6b20; font-weight: 600; }

/* ===== 通用工具 ===== */
.row-between { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.flash-wrap { margin-bottom: 16px; }
.flash { padding: 10px 14px; border-radius: 4px; margin-bottom: 8px; font-size: 14px; }
.flash-success { background: #c6f6d5; color: #22543d; }
.flash-error { background: #fed7d7; color: #742a2a; }
.flash-info { background: #bee3f8; color: #2a4365; }
.flash-warn { background: #feebc8; color: #7b341e; }
.muted-box { color: #718096; font-size: 14px; }
.total-line { font-size: 18px; font-weight: 600; }
.total-line .amount { color: #e53e3e; }
.empty-state { text-align: center; padding: 60px 0; color: #a0aec0; }
.empty-state a { display: inline-block; margin-top: 12px; }

/* 后台布局 */
.admin-layout { display: grid; grid-template-columns: 200px 1fr; gap: 20px; }
.admin-side { background: #fff; border-radius: 6px; padding: 14px; height: fit-content; }
.admin-side a { display: block; padding: 8px 12px; border-radius: 4px; color: #4a5568; margin-bottom: 2px; }
.admin-side a.active, .admin-side a:hover { background: #ebf8ff; color: #2b6cb0; text-decoration: none; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: #fff; padding: 18px; border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.stat-card .num { font-size: 28px; font-weight: 700; color: #2b6cb0; }
.stat-card .lbl { color: #718096; font-size: 14px; }

footer.site-footer { background: #fff; border-top: 1px solid #e3e6ea; padding: 18px 0; color: #a0aec0; font-size: 13px; text-align: center; margin-top: auto; }
