:root {
    --primary: #7c5cff;
    --primary-dark: #5b3fe0;
    --accent: #ffd166;
    --accent2: #ff8fab;
    --bg: #fff7fb;
    --card: #ffffff;
    --text: #3a2e4d;
    --muted: #8a7fa3;
    --ok: #2ecc71;
    --danger: #ff5d73;
    --radius: 18px;
    --shadow: 0 10px 30px rgba(124, 92, 255, 0.12);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Baloo 2', 'Comic Sans MS', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 18px; }

/* 导航条 */
.navbar {
    background: linear-gradient(120deg, var(--primary), #a07bff);
    color: #fff;
    padding: 14px 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}
.navbar .container { display: flex; align-items: center; justify-content: space-between; }
.brand { font-size: 26px; font-weight: 800; color: #fff; display: flex; align-items: center; gap: 8px; }
.brand .star { filter: drop-shadow(0 2px 4px rgba(0,0,0,.2)); }
.nav-links { display: flex; gap: 16px; align-items: center; }
.nav-links a { color: #fff; font-weight: 700; }
.cart-pill {
    background: var(--accent); color: #5b3fe0; font-weight: 800;
    border-radius: 999px; padding: 4px 12px; display: inline-flex; gap: 6px; align-items: center;
}

/* 通用 */
.card {
    background: var(--card); border-radius: var(--radius); padding: 20px;
    box-shadow: var(--shadow); margin-bottom: 20px;
}
.btn {
    display: inline-block; border: none; cursor: pointer; font-weight: 800;
    border-radius: 999px; padding: 10px 20px; font-size: 15px; transition: transform .08s;
    font-family: inherit;
}
.btn:active { transform: scale(.96); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }
.btn-secondary { background: #f1ecff; color: var(--primary); }
.btn-secondary:hover { background: #e6defe; text-decoration: none; }
.btn-accent { background: var(--accent); color: #5b3fe0; }
.btn-ghost { background: #f1ecff; color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { display: block; width: 100%; text-align: center; }

.alert { border-radius: 14px; padding: 12px 16px; margin-bottom: 16px; font-weight: 700; }
.alert-ok { background: #e7fbf0; color: #1c8a52; }
.alert-err { background: #ffe9ed; color: #c0392b; }

.notice {
    background: #fff5d6; border: 2px dashed var(--accent);
    border-radius: 14px; padding: 12px 16px; color: #8a6d00; font-weight: 700; margin-bottom: 18px;
}

.section-title { font-size: 22px; font-weight: 800; margin: 22px 0 14px; display: flex; align-items: center; gap: 8px; }

/* 商品网格 */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.product-card { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .12s; }
.product-card:hover { transform: translateY(-4px); }
.product-thumb {
    width: 100%; height: 160px; object-fit: cover; background: #f3edff;
    display: flex; align-items: center; justify-content: center; font-size: 54px;
}
.product-body { padding: 14px 16px; }
.product-name { font-weight: 800; font-size: 17px; }
.product-desc { color: var(--muted); font-size: 13px; min-height: 38px; }
.price { color: var(--primary); font-weight: 800; font-size: 20px; margin: 8px 0; }
.price small { color: var(--muted); font-weight: 600; font-size: 13px; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.badge-limit { background: #ffe9ed; color: #c0392b; }
.badge-stock { background: #e7fbf0; color: #1c8a52; }
.badge-out { background: #eee; color: #999; }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 700; margin-bottom: 6px; }
.input, select, textarea {
    width: 100%; padding: 11px 14px; border: 2px solid #ece6ff; border-radius: 12px;
    font-size: 15px; font-family: inherit; background: #fbfaff; color: var(--text);
}
.input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row .col { flex: 1; min-width: 160px; }

.tier-list { display: flex; gap: 14px; flex-wrap: wrap; }
.tier-card { border-radius: 16px; padding: 14px 18px; font-weight: 800; color: #4a3a00; min-width: 180px; box-shadow: var(--shadow); }
.tier-card .t-name { font-size: 18px; }
.tier-card .t-disc { font-size: 14px; opacity: .85; }

/* 结算摘要 */
.summary-line { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed #eee; }
.summary-total { font-size: 22px; font-weight: 800; color: var(--primary); }

/* 管理员布局 */
.admin-wrap { display: flex; min-height: 100vh; }
.admin-side { width: 220px; background: #2b2150; color: #fff; padding: 20px 0; flex-shrink: 0; }
.admin-side .brand { padding: 0 20px 16px; color: #fff; }
.admin-side a { display: block; color: #cfc6ee; padding: 11px 22px; font-weight: 700; }
.admin-side a:hover, .admin-side a.active { background: #3a2e6b; color: #fff; text-decoration: none; }
.admin-main { flex: 1; padding: 26px 32px; overflow: auto; }
.admin-main h1 { margin-top: 0; }

table.tbl { width: 100%; border-collapse: collapse; background: #fff; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
table.tbl th, table.tbl td { padding: 12px 14px; text-align: left; border-bottom: 1px solid #f1ecff; font-size: 14px; }
table.tbl th { background: #f7f3ff; font-weight: 800; }
table.tbl tr:last-child td { border-bottom: none; }
.img-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; background: #f3edff; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 16px; }
.stat { background: #fff; border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }
.stat .n { font-size: 30px; font-weight: 800; color: var(--primary); }
.stat .l { color: var(--muted); font-weight: 700; }

.captcha-img { border-radius: 10px; cursor: pointer; border: 2px solid #ece6ff; vertical-align: middle; }
.muted { color: var(--muted); }
.center { text-align: center; }
.mt { margin-top: 16px; }
.qty { width: 70px; text-align: center; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-weight: 800; font-size: 12px; }
.pill-paid { background: #e7fbf0; color: #1c8a52; }
.pill-unpaid { background: #fff0d6; color: #b8860b; }

/* ===== 问卷模块补充样式 ===== */
.tip { font-size: 12px; color: #8a8aa3; line-height: 1.6; }
.table-wrap { width: 100%; overflow-x: auto; margin-top: 8px; }
.table-wrap .tbl { min-width: 100%; }

/* ===== 问卷/模板 出题编辑器通用样式 ===== */
.q-card{border:1px solid #ececff;border-radius:12px;padding:14px;margin-bottom:12px;background:#fafaff;}
.q-head{display:flex;gap:10px;align-items:center;margin-bottom:10px;}
.opt-row{display:flex;gap:8px;align-items:center;margin-bottom:6px;}
.opt-row .input{flex:1;}
.mini-del{background:#ffe3e3;color:#c0392b;border:none;border-radius:8px;width:30px;height:30px;cursor:pointer;font-weight:800;flex:0 0 auto;}

/* ===== 优惠码 / 活动 banner 样式 ===== */
.coupon-box { background:#faf7ff; border:2px dashed #d9ccff; border-radius:14px; padding:12px 14px; }
.promo-banner {
    background: linear-gradient(120deg, #fff0d6, #ffe3ef);
    border: 2px dashed var(--accent2);
    border-radius: 14px; padding: 12px 16px; margin-bottom: 18px; font-weight: 700; color:#a23a5b;
}
code {
    font-family: 'SF Mono', Consolas, Menlo, monospace;
    background:#f1ecff; color:var(--primary-dark);
    padding:2px 8px; border-radius:8px; font-size:13px; letter-spacing:.5px;
}

/* ===== 移动端优化 ===== */
@media (max-width: 768px) {
    .container { padding: 0 12px; }
    .navbar .container { flex-direction: column; gap: 8px; }
    .nav-links { flex-wrap: wrap; justify-content: center; gap: 10px; font-size: 14px; }
    .brand { font-size: 22px; }
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .product-thumb { height: 120px; font-size: 40px; }
    .product-name { font-size: 15px; }
    .price { font-size: 17px; }
    .section-title { font-size: 19px; }
    .card { padding: 16px; }
    .row { flex-direction: column; gap: 0; }
    .row .col { min-width: 0; }
    .summary-total { font-size: 19px; }
    .btn-block { font-size: 16px; }
    /* 后台：侧边栏改为顶部横向排列 */
    .admin-wrap { flex-direction: column; }
    .admin-side { width: 100%; display: flex; flex-wrap: wrap; padding: 8px 0; gap: 0; }
    .admin-side .brand { width: 100%; padding: 6px 16px 10px; }
    .admin-side a { padding: 9px 14px; font-size: 13px; }
    .admin-main { padding: 16px; }
    table.tbl th, table.tbl td { padding: 9px 10px; font-size: 12px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .product-grid { grid-template-columns: 1fr; }
    .promo-banner, .notice { font-size: 13px; }
}
