* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif; background: #f5f6fa; color: #222; line-height: 1.6; }
a { color: #2f5597; text-decoration: none; }
a:hover { text-decoration: underline; }

.navbar { background: #2f5597; color: #fff; padding: 14px 24px; display: flex; justify-content: space-between; align-items: center; }
.navbar a { color: #fff; margin-left: 18px; }
.brand { font-size: 20px; font-weight: 700; margin-left: 0 !important; }
.nav-right a { position: relative; }
.badge { background: #ff5252; border-radius: 10px; padding: 1px 7px; font-size: 12px; margin-left: 2px; }

.container { max-width: 1080px; margin: 0 auto; padding: 24px; }
.hero { text-align: center; padding: 30px 0 10px; }
.muted { color: #888; }
.empty { color: #999; text-align: center; padding: 30px 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; margin-top: 20px; }
.card { background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.08); transition: transform .15s; }
.card:hover { transform: translateY(-4px); box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.thumb { width: 100%; height: 180px; background: #f0f0f0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.no-img { font-size: 48px; }
.card-body { padding: 12px; }
.name { font-size: 15px; font-weight: 600; }
.price-row { margin: 8px 0; }
.price { color: #e63946; font-weight: 700; font-size: 18px; }
.price-row.big .price { font-size: 28px; }
.orig { color: #aaa; text-decoration: line-through; margin-left: 8px; font-size: 13px; }
.desc { color: #666; font-size: 13px; }
.stock-label { margin-top: 8px; color: #2f5597; font-size: 12px; }

.detail { display: flex; gap: 30px; margin-top: 20px; background: #fff; padding: 24px; border-radius: 10px; }
.detail-img { flex: 0 0 45%; }
.detail-img img { width: 100%; border-radius: 8px; }
.detail-info { flex: 1; }
.no-img.big { font-size: 80px; text-align: center; padding: 60px 0; }
.back-link { margin: 10px 0; }

.buy-form { margin-top: 20px; display: flex; align-items: center; gap: 12px; }
.qty { width: 70px; padding: 8px; border: 1px solid #ddd; border-radius: 6px; }

.btn { display: inline-block; padding: 8px 16px; border: 1px solid #cfcfcf; background: #fff; color: #333; border-radius: 6px; cursor: pointer; font-size: 14px; }
.btn:hover { background: #f0f0f0; text-decoration: none; }
.btn.primary { background: #e63946; color: #fff; border-color: #e63946; }
.btn.primary:hover { background: #c92a37; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.danger { color: #e63946; border-color: #e63946; }
.btn.big { padding: 12px 28px; font-size: 16px; }
.btn.active { background: #2f5597; color: #fff; border-color: #2f5597; }

.flash { max-width: 1080px; margin: 10px auto 0; }
.flash-msg { background: #fff4e0; border: 1px solid #f0c36d; color: #7a5c00; padding: 10px 16px; border-radius: 6px; margin-bottom: 10px; }
.login-page .flash-msg { margin: 15px 0; }

.cart-list { background: #fff; border-radius: 10px; padding: 16px; }
.cart-row { display: flex; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid #eee; }
.cart-info { flex: 1; }
.cart-sub { font-weight: 700; color: #e63946; min-width: 90px; text-align: right; }
.cart-total-bar { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; background: #fff; padding: 16px 20px; border-radius: 10px; }
.total { font-size: 18px; }

.checkout-wrap { display: flex; gap: 24px; margin-top: 20px; }
.order-summary, .form { flex: 1; background: #fff; padding: 20px; border-radius: 10px; }
.summary-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.summary-total { text-align: right; font-size: 20px; margin-top: 14px; }
.form .field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-weight: 600; }
.field input[type=text], .field input[type=number], .field input[type=password], .field input[type=date], .field input[type=file], .field textarea { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
.pay-note { background: #eef4ff; padding: 12px; border-radius: 6px; margin: 16px 0; color: #2f5597; }

.ok-box { background: #fff; max-width: 640px; margin: 30px auto; padding: 30px; border-radius: 10px; text-align: center; }
.order-no { color: #2f5597; font-size: 20px; }
.order-detail { text-align: left; margin: 22px 0; background: #f8f9fc; padding: 16px; border-radius: 8px; }
.ok-actions { margin-top: 18px; }

.footer { text-align: center; color: #aaa; padding: 30px 0; font-size: 13px; }
.footer a { color: #999; }

/* ---- Admin ---- */
.admin-layout { display: flex; min-height: 100vh; }
.admin-side { width: 220px; background: #1f2d3d; color: #fff; display: flex; flex-direction: column; }
.side-brand { font-size: 18px; font-weight: 700; padding: 22px 20px; border-bottom: 1px solid #2c3c4f; }
.side-nav { padding: 12px 0; flex: 1; }
.side-nav a { display: block; color: #c8d3e0; padding: 12px 20px; }
.side-nav a:hover { background: #2c3c4f; text-decoration: none; }
.side-nav a.active { background: #2f5597; color: #fff; }
.side-foot { padding: 16px 20px; border-top: 1px solid #2c3c4f; font-size: 13px; display: flex; justify-content: space-between; }
.side-foot a { color: #ffb3b3; }
.admin-main { flex: 1; padding: 26px 30px; background: #f5f6fa; }
.admin-main h1 { margin-bottom: 16px; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.filter { display: flex; gap: 6px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin: 18px 0 26px; }
.stat-card { background: #fff; padding: 18px; border-radius: 10px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.stat-num { font-size: 30px; font-weight: 700; color: #2f5597; }
.stat-card.warn .stat-num { color: #e63946; }
.stat-label { color: #888; font-size: 13px; margin-top: 4px; }

.table { width: 100%; background: #fff; border-collapse: collapse; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.table th { background: #f0f2f5; padding: 12px 14px; text-align: left; font-size: 13px; color: #555; }
.table td { padding: 12px 14px; border-top: 1px solid #f0f0f0; font-size: 14px; }
.mini { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.actions { display: flex; gap: 6px; align-items: center; }
.tag { padding: 2px 10px; border-radius: 12px; font-size: 12px; }
.tag-warn { background: #fff3cd; color: #856404; }
.tag-ok { background: #d4edda; color: #155724; }
.tag-off { background: #eee; color: #666; }

.form.wide { max-width: 720px; background: #fff; padding: 24px; border-radius: 10px; }
.form-row { display: flex; gap: 16px; }
.form-row .field { flex: 1; }
.img-preview { margin-top: 8px; }
.preview { width: 90px; border-radius: 6px; }
.form-inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.select { padding: 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }

.detail-card { background: #fff; padding: 20px; border-radius: 10px; margin-bottom: 18px; max-width: 560px; }
.kv { display: flex; padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.kv span { flex: 0 0 100px; color: #888; }
.kv b { font-weight: 600; }
.status-form { max-width: 560px; background: #fff; padding: 20px; border-radius: 10px; }
.report-box { background: #fff; padding: 24px; border-radius: 10px; max-width: 780px; }
.report-box .field input, .report-box .field select { width: auto; }

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #2f5597; }
.login-box { background: #fff; padding: 40px; border-radius: 12px; width: 340px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.login-box h1 { margin-bottom: 20px; }
.center { text-align: center; }
.muted.center { margin-top: 14px; }

@media (max-width: 700px) {
  .detail, .checkout-wrap { flex-direction: column; }
  .admin-side { width: 100%; flex-direction: row; align-items: center; }
  .admin-layout { flex-direction: column; }
  .side-nav { display: flex; padding: 0; }
  .side-nav a { padding: 10px 12px; }
}
