* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #3b82f6;
  --primary-bg: #eff6ff;
  --primary-border: #bfdbfe;
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --text-2: #64748b;
  --text-3: #94a3b8;
  --border: #e2e8f0;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
}
html, body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 14px; line-height: 1.6; }
body { min-height: 100vh; background: #f4f7fb; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: 14px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* 顶部导航 */
.topbar { position: sticky; top: 0; z-index: 50; background: #fff; border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; height: 60px; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: var(--text); }
.brand-logo { width: 36px; height: 36px; border-radius: 9px; background: var(--primary); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px; }
.brand small { display: block; font-size: 11px; color: var(--text-3); font-weight: 500; }
.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav a { padding: 8px 14px; border-radius: 8px; color: var(--text-2); font-weight: 600; font-size: 14px; }
.nav a:hover, .nav a.active { background: var(--primary-bg); color: var(--primary); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border-radius: 999px; background: #f1f5f9; }
.user-chip .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 18px; border-radius: 8px; font-weight: 600; font-size: 14px; transition: .15s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* 筛选条 */
.filter-bar { display: flex; align-items: center; gap: 16px; padding: 16px 0; flex-wrap: wrap; }
.tabs { display: inline-flex; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 4px; }
.tabs a { padding: 7px 16px; border-radius: 6px; color: var(--text-2); font-weight: 600; font-size: 13px; }
.tabs a.active { background: var(--primary); color: #fff; }
.search { flex: 1; min-width: 200px; max-width: 320px; position: relative; }
.search input { width: 100%; padding: 9px 14px 9px 36px; border: 1px solid var(--border); border-radius: 8px; background: #fff; outline: none; }
.search input:focus { border-color: var(--primary); }
.search::before { content: '🔍'; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; opacity: .5; }

/* 商品网格 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; padding: 8px 0 40px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; border: 1px solid var(--border); transition: .2s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(37, 99, 235, .10); border-color: var(--primary-border); }
.card-cover { aspect-ratio: 16/10; background: var(--primary-bg); display: flex; align-items: center; justify-content: center; color: #93c5fd; font-size: 40px; overflow: hidden; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 14px; }
.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; margin-bottom: 6px; }
.tag-source { background: var(--primary-bg); color: var(--primary); }
.tag-server { background: #ecfeff; color: #0891b2; }
.tag-service { background: #f0fdfa; color: #0d9488; }
.card-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-intro { font-size: 12px; color: var(--text-2); height: 34px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.price { color: #ef4444; font-weight: 800; font-size: 18px; }
.price small { font-size: 12px; font-weight: 600; }

/* 详情页 */
.detail { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; padding: 24px 0 40px; }
.detail-gallery .main-img { width: 100%; aspect-ratio: 4/3; border-radius: var(--radius); background: var(--primary-bg); overflow: hidden; box-shadow: var(--shadow); display:flex; align-items:center; justify-content:center; }
.detail-info h1 { font-size: 24px; margin-bottom: 10px; }
.detail-intro { color: var(--text-2); margin-bottom: 16px; }
.detail-price { font-size: 30px; color: #ef4444; font-weight: 800; margin: 16px 0; }
.detail-meta { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.content-box { background: #fff; border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-top: 20px; line-height: 1.8; white-space: pre-wrap; border: 1px solid var(--border); }
.section-title { font-size: 17px; font-weight: 700; margin: 24px 0 12px; }

/* 表单 */
.form-card { max-width: 420px; margin: 40px auto; background: #fff; border-radius: 14px; padding: 32px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.form-card h2 { text-align: center; margin-bottom: 6px; }
.form-card .sub { text-align: center; color: var(--text-3); font-size: 13px; margin-bottom: 22px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-2); font-weight: 600; margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 8px; outline: none; background: #fff; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.field textarea { min-height: 100px; resize: vertical; }
.form-foot { text-align: center; color: var(--text-3); font-size: 13px; margin-top: 16px; }

/* 订单列表 */
.order-list { padding: 16px 0 40px; }
.order-item { background: #fff; border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.order-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; flex-wrap: wrap; gap: 8px; }
.order-no { font-size: 12px; color: var(--text-3); }
.order-title { font-weight: 700; font-size: 15px; }
.order-meta { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); margin-top: 8px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; color: #fff; }
.info-box { background: #f8fafc; border: 1px dashed var(--border); border-radius: 8px; padding: 12px 14px; margin-top: 10px; font-size: 13px; }
.info-box .row { display: flex; gap: 10px; padding: 3px 0; }
.info-box .k { color: var(--text-3); width: 70px; flex-shrink: 0; }
.info-box .v { color: var(--text); word-break: break-all; }

/* 后台 */
.admin-wrap { max-width: 1240px; margin: 0 auto; padding: 20px; }
.admin-card { background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px; border: 1px solid var(--border); }
.admin-card h3 { font-size: 16px; margin-bottom: 14px; }
.admin-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.admin-nav a { padding: 8px 16px; border-radius: 8px; color: var(--text-2); font-weight: 600; font-size: 13px; background: #fff; border: 1px solid var(--border); }
.admin-nav a.active, .admin-nav a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #f1f5f9; }
th { background: #f8fafc; color: var(--text-2); font-weight: 600; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.pager a, .pager span { padding: 6px 12px; border-radius: 6px; background: #fff; border: 1px solid var(--border); font-size: 13px; }
.pager .cur { background: var(--primary); color: #fff; border-color: var(--primary); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: #fff; border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.stat .label { font-size: 12px; color: var(--text-3); }
.stat .num { font-size: 26px; font-weight: 800; margin-top: 6px; color: var(--text); }

/* 弹层/提示 */
.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.modal-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: #fff; border-radius: 12px; padding: 22px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
.modal h3 { margin-bottom: 14px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.empty { text-align: center; padding: 60px 20px; color: var(--text-3); }

@media (max-width: 720px) {
  .detail { grid-template-columns: 1fr; }
  .topbar-inner { height: auto; padding: 10px 0; flex-wrap: wrap; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .card-body { padding: 10px; }
  .price { font-size: 16px; }
}
