/* =========================================================
   订货系统 · UI 原型 v2（精致版 + 可交互）
   自包含，无外部依赖
   ========================================================= */
:root {
    --brand: #4f46e5;
    --brand-2: #6366f1;
    --brand-soft: #eef2ff;
    --bg: #f7f8fa;
    --card: #ffffff;
    --text: #101828;
    --text-2: #475467;
    --muted: #98a2b3;
    --border: #eaecf0;
    --line: #f2f4f7;
    --success: #12b76a;
    --success-soft: #ecfdf3;
    --danger: #f04438;
    --danger-soft: #fef3f2;
    --warn: #f79009;
    --warn-soft: #fffaeb;
    --radius: 14px;
    --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-sm: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-md: 0 12px 32px rgba(16, 24, 40, .12);
    --shadow-lg: 0 24px 60px rgba(16, 24, 40, .18);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    color: var(--text); background: var(--bg); font-size: 14px; line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
::selection { background: var(--brand-soft); }

/* ---------------- 后台布局 ---------------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 236px; background: #fff; border-right: 1px solid var(--border);
    display: flex; flex-direction: column; flex-shrink: 0; position: sticky; top: 0; height: 100vh;
}
.sidebar .logo { height: 64px; display: flex; align-items: center; gap: 10px; padding: 0 20px; font-size: 16px; font-weight: 800; letter-spacing: .3px; }
.sidebar .logo .mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; display: grid; place-items: center; font-size: 15px; box-shadow: var(--shadow-xs); }
.sidebar nav { padding: 8px 12px; overflow-y: auto; flex: 1; }
.sidebar nav .group { font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .8px; padding: 16px 12px 6px; }
.sidebar nav a {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
    font-size: 13.5px; color: var(--text-2); cursor: pointer; margin-bottom: 2px; transition: .15s;
}
.sidebar nav a .ic { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; background: var(--line); }
.sidebar nav a:hover { background: var(--line); color: var(--text); }
.sidebar nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.sidebar nav a.active .ic { background: var(--brand); color: #fff; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    height: 64px; background: #fff; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
    position: sticky; top: 0; z-index: 20;
}
.crumb { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.crumb b { color: var(--text); font-weight: 700; }
.topbar .right { display: flex; align-items: center; gap: 14px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.content { padding: 22px 24px 40px; flex: 1; }

/* ---------------- 卡片 ---------------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs); padding: 18px; margin-bottom: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-head h3 { font-size: 15px; font-weight: 700; }

/* ---------------- 搜索栏 ---------------- */
.search-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.field .input, .field .select { min-width: 150px; }

/* ---------------- 控件 ---------------- */
.input, .select {
    height: 38px; border: 1px solid var(--border); border-radius: 10px; padding: 0 12px;
    font-size: 13.5px; background: #fff; color: var(--text); outline: none; transition: .15s; width: 100%;
}
.input::placeholder { color: var(--muted); }
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input.sm { height: 34px; width: 104px; }
select.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2398a2b3' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 30px; }

.btn {
    height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border);
    background: #fff; cursor: pointer; font-size: 13.5px; color: var(--text-2); font-weight: 500;
    display: inline-flex; align-items: center; gap: 6px; transition: .15s; white-space: nowrap;
}
.btn:hover { background: #fafbfc; border-color: #d0d5dd; color: var(--text); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: var(--shadow-xs); }
.btn.primary:hover { background: #4338ca; border-color: #4338ca; color: #fff; }
.btn.danger { color: var(--danger); border-color: #fecdca; background: #fff; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.text { border: none; background: none; padding: 0 6px; height: auto; color: var(--brand); font-weight: 600; }
.btn.text:hover { background: none; text-decoration: underline; }
.btn.text.danger { color: var(--danger); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 12px 16px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
th { background: #fcfcfd; color: var(--text-2); font-weight: 600; font-size: 12.5px; }
tbody tr { transition: .12s; }
tbody tr:hover { background: #fafbff; }
tbody tr:last-child td { border-bottom: none; }
.thumb { width: 38px; height: 38px; border-radius: 9px; background: linear-gradient(135deg, #e0e7ff, #c7d2fe); display: inline-block; }
.ops { display: flex; gap: 10px; }

/* ---------------- 标签 / 开关 ---------------- */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--brand-soft); color: var(--brand); }
.tag::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.tag.green { background: var(--success-soft); color: var(--success); }
.tag.orange { background: var(--warn-soft); color: var(--warn); }
.tag.red { background: var(--danger-soft); color: var(--danger); }
.tag.gray { background: var(--line); color: var(--text-2); }
.switch { width: 40px; height: 22px; border-radius: 999px; background: #d0d5dd; position: relative; display: inline-block; cursor: pointer; transition: .18s; vertical-align: middle; }
.switch.on { background: var(--brand); }
.switch::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: .18s; box-shadow: var(--shadow-xs); }
.switch.on::after { left: 20px; }

/* ---------------- 分页 ---------------- */
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 16px; color: var(--muted); font-size: 13px; }
.pager .pg { min-width: 32px; height: 32px; line-height: 30px; text-align: center; border: 1px solid var(--border); border-radius: 9px; padding: 0 10px; background: #fff; cursor: pointer; }
.pager .pg:hover { border-color: #d0d5dd; }
.pager .pg.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.screen { display: none; }
.screen.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.muted { color: var(--muted); } .bold { font-weight: 700; }
.row-between { display: flex; justify-content: space-between; align-items: center; }

/* ---------------- 弹窗 ---------------- */
.mask { position: fixed; inset: 0; background: rgba(16, 24, 40, .5); backdrop-filter: blur(2px); opacity: 0; visibility: hidden; transition: .2s; z-index: 100; }
.mask.show { opacity: 1; visibility: visible; }
.modal {
    position: fixed; left: 50%; top: 50%; transform: translate(-50%, -46%) scale(.98);
    width: 520px; max-width: calc(100vw - 32px); max-height: 86vh; background: #fff; border-radius: 16px;
    box-shadow: var(--shadow-lg); z-index: 101; opacity: 0; visibility: hidden; transition: .2s;
    display: flex; flex-direction: column; overflow: hidden;
}
.modal.show { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 16px; font-weight: 700; }
.modal-x { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; color: var(--muted); font-size: 15px; }
.modal-x:hover { background: var(--line); color: var(--text); }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; background: #fcfcfd; }

.form-row { margin-bottom: 16px; }
.form-row > label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; color: var(--text-2); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.desc-list { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; font-size: 13.5px; }
.desc-list dt { color: var(--muted); }
.desc-list dd { color: var(--text); }

/* ---------------- Toast ---------------- */
.toast {
    position: fixed; left: 50%; top: 28px; transform: translate(-50%, -16px);
    background: #101828; color: #fff; padding: 11px 20px; border-radius: 12px; font-size: 13.5px;
    box-shadow: var(--shadow-md); z-index: 200; opacity: 0; visibility: hidden; transition: .25s;
    display: flex; align-items: center; gap: 8px;
}
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.toast .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }

/* =========================================================
   手机端
   ========================================================= */
.stage { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 26px 16px 40px; background: linear-gradient(180deg, #eef1f8, #f7f8fa); }
.stage .hint { color: var(--text-2); margin-bottom: 14px; font-size: 13px; text-align: center; font-weight: 500; }
.switcher { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 20px; max-width: 780px; }
.switcher button { padding: 7px 15px; border-radius: 999px; border: 1px solid var(--border); background: #fff; font-size: 13px; cursor: pointer; color: var(--text-2); transition: .15s; }
.switcher button:hover { border-color: #d0d5dd; }
.switcher button.active { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: 0 4px 12px rgba(79, 70, 229, .3); }

.phone {
    width: 380px; height: 800px; background: #fff; border-radius: 44px; border: 12px solid #0b1020;
    box-shadow: var(--shadow-lg); overflow: hidden; display: flex; flex-direction: column; position: relative;
}
.phone-status { height: 32px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; font-size: 12px; font-weight: 600; color: #101828; flex-shrink: 0; background: #fff; }
.phone-nav { height: 48px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; border-bottom: 1px solid var(--line); flex-shrink: 0; background: #fff; position: relative; }
.phone-nav .back { position: absolute; left: 16px; font-size: 20px; color: var(--text-2); cursor: pointer; }
.phone-body { flex: 1; overflow-y: auto; background: var(--bg); position: relative; }
.phone-body::-webkit-scrollbar { width: 0; }
.phone-tabbar { height: 60px; display: flex; border-top: 1px solid var(--line); background: #fff; flex-shrink: 0; }
.phone-tabbar .tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: var(--muted); cursor: pointer; transition: .15s; }
.phone-tabbar .tab .ic { font-size: 17px; }
.phone-tabbar .tab.active { color: var(--brand); font-weight: 600; }

.mp-screen { display: none; }
.mp-screen.active { display: block; }
.mp-card { background: #fff; border-radius: 14px; padding: 15px; margin: 12px; box-shadow: var(--shadow-xs); }
.mp-pad { padding: 12px; }
.mp-btn { background: var(--brand); color: #fff; border-radius: 999px; height: 48px; line-height: 48px; text-align: center; font-size: 15px; font-weight: 600; margin: 12px; cursor: pointer; box-shadow: 0 6px 16px rgba(79, 70, 229, .28); }
.mp-btn:active { transform: scale(.99); }
.mp-btn.ghost { background: #fff; color: var(--danger); border: 1px solid #fecdca; box-shadow: none; }
.mp-input { width: 100%; height: 50px; background: #f4f5f8; border: 1px solid transparent; border-radius: 12px; padding: 0 16px; font-size: 14px; margin-bottom: 14px; outline: none; }
.mp-input:focus { background: #fff; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.mp-row { display: flex; justify-content: space-between; align-items: center; }
.mp-title { font-size: 14.5px; font-weight: 700; margin-bottom: 10px; }
.mp-goods { display: flex; padding: 12px; background: #fff; border-radius: 14px; margin-bottom: 12px; box-shadow: var(--shadow-xs); cursor: pointer; transition: .15s; }
.mp-goods:active { transform: scale(.99); }
.mp-goods .ph { width: 88px; height: 88px; border-radius: 12px; background: linear-gradient(135deg, #e0e7ff, #c7d2fe); flex-shrink: 0; display: grid; place-items: center; font-size: 26px; }
.mp-goods .info { flex: 1; margin-left: 12px; display: flex; flex-direction: column; justify-content: space-between; }
.mp-price { color: var(--danger); font-weight: 800; font-size: 17px; }
.mp-price::before { content: '￥'; font-size: 12px; font-weight: 700; }
.mp-cats { display: flex; gap: 8px; padding: 12px; overflow-x: auto; background: #fff; white-space: nowrap; }
.mp-cats .c { padding: 7px 16px; border-radius: 999px; background: #f4f5f8; font-size: 13px; color: var(--text-2); cursor: pointer; }
.mp-cats .c.active { background: var(--brand); color: #fff; font-weight: 600; }
.mp-sku { display: inline-block; padding: 7px 15px; border-radius: 999px; background: #f4f5f8; font-size: 12.5px; margin: 0 8px 8px 0; cursor: pointer; }
.mp-sku.active { background: var(--brand-soft); color: var(--brand); border: 1px solid var(--brand); font-weight: 600; }
.mp-tabs { display: flex; background: #fff; position: sticky; top: 0; z-index: 5; }
.mp-tabs .t { flex: 1; text-align: center; padding: 13px 0; font-size: 13px; color: var(--text-2); cursor: pointer; }
.mp-tabs .t.active { color: var(--brand); font-weight: 700; position: relative; }
.mp-tabs .t.active::after { content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 22px; height: 3px; border-radius: 3px; background: var(--brand); }
.mp-empty { text-align: center; color: var(--muted); padding: 70px 0; font-size: 13px; }
.mp-stepper { display: flex; align-items: center; gap: 0; }
.mp-stepper .op { width: 34px; height: 34px; line-height: 34px; text-align: center; background: #f4f5f8; border-radius: 9px; font-size: 18px; cursor: pointer; user-select: none; }
.mp-stepper .val { width: 50px; text-align: center; font-weight: 600; }

/* 总览 */
.overview { max-width: 940px; margin: 70px auto; padding: 0 20px; }
.overview h1 { font-size: 28px; font-weight: 800; letter-spacing: -.3px; }
.overview .lead { color: var(--text-2); margin: 8px 0 34px; }
.overview .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
.overview .entry { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 26px; box-shadow: var(--shadow-sm); transition: .2s; }
.overview .entry:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: #d0d5dd; }
.overview .entry .ico { width: 52px; height: 52px; border-radius: 14px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 700; margin-bottom: 16px; box-shadow: 0 8px 18px rgba(79, 70, 229, .3); }
.overview .entry h3 { font-size: 17px; margin-bottom: 6px; }
.overview .entry span { color: var(--text-2); font-size: 13px; }
.overview .note { margin-top: 30px; font-size: 12px; color: var(--muted); }

/* =========================================================
   小程序 · 首页 / 商品 / 购物车 / 个人中心
   ========================================================= */
.home-hero { background: linear-gradient(135deg, var(--brand), var(--brand-2)); padding: 16px 18px 30px; color: #fff; }
.home-hero .greet { font-size: 20px; font-weight: 800; }
.home-hero .sub { font-size: 12.5px; opacity: .88; margin-top: 4px; }
.home-search { margin-top: 14px; height: 40px; background: rgba(255,255,255,.22); border-radius: 999px; display: flex; align-items: center; padding: 0 16px; color: rgba(255,255,255,.9); font-size: 13px; }
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; background: #fff; margin: -18px 12px 0; padding: 16px 6px; border-radius: 16px; box-shadow: var(--shadow-sm); position: relative; z-index: 2; }
.quick-item { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); cursor: pointer; }
.quick-item .qi { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; font-size: 21px; background: var(--brand-soft); }
.notice { display: flex; align-items: center; gap: 8px; background: #fff; margin: 12px; padding: 11px 14px; border-radius: 12px; font-size: 12.5px; color: var(--text-2); box-shadow: var(--shadow-xs); }
.section-title { display: flex; justify-content: space-between; align-items: center; margin: 6px 14px 10px; font-weight: 700; font-size: 15px; }
.section-title a { font-size: 12.5px; color: var(--muted); font-weight: 400; cursor: pointer; }
.pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 12px 16px; }
.pcard { background: #fff; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-xs); cursor: pointer; transition: .15s; }
.pcard:active { transform: scale(.98); }
.pcard .pimg { height: 108px; background: linear-gradient(135deg, #e0e7ff, #c7d2fe); display: grid; place-items: center; font-size: 38px; }
.pcard .pbody { padding: 10px 11px 12px; }
.pcard .pname { font-size: 13px; font-weight: 600; line-height: 1.35; height: 35px; overflow: hidden; }
.pcard .prow { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.pcard .add { width: 27px; height: 27px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 17px; font-weight: 700; box-shadow: 0 4px 10px rgba(79,70,229,.3); }
.cart-item { display: flex; gap: 12px; padding: 13px; background: #fff; border-radius: 14px; margin: 0 12px 10px; box-shadow: var(--shadow-xs); align-items: center; }
.cart-item .cimg { width: 62px; height: 62px; border-radius: 11px; background: linear-gradient(135deg, #e0e7ff, #c7d2fe); display: grid; place-items: center; font-size: 26px; flex-shrink: 0; }
.cart-item .cinfo { flex: 1; min-width: 0; }
.stats { display: flex; background: #fff; margin: -18px 12px 0; border-radius: 16px; padding: 16px 0; box-shadow: var(--shadow-sm); position: relative; z-index: 2; }
.stats .st { flex: 1; text-align: center; cursor: pointer; }
.stats .st b { display: block; font-size: 21px; color: var(--brand); font-weight: 800; }
.stats .st span { font-size: 12px; color: var(--text-2); }
.menu-card { background: #fff; border-radius: 14px; margin: 12px; overflow: hidden; box-shadow: var(--shadow-xs); }
.menu-card .mi { display: flex; justify-content: space-between; align-items: center; padding: 15px 16px; border-bottom: 1px solid var(--line); font-size: 14px; cursor: pointer; }
.menu-card .mi:last-child { border-bottom: none; }
.menu-card .mi .arrow { color: var(--muted); }
/* 配送端 */
.deliv-summary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; padding: 18px; }
.deliv-summary .n { font-size: 15px; font-weight: 700; }
.deliv-summary .g { display: flex; gap: 26px; margin-top: 14px; }
.deliv-summary .g .it b { font-size: 22px; font-weight: 800; display: block; }
.deliv-summary .g .it span { font-size: 12px; opacity: .85; }

/* =========================================================
   小程序 · 商品详情
   ========================================================= */
.dt-gallery { position: relative; background: #fff; }
.dt-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.dt-track::-webkit-scrollbar { display: none; }
.dt-slide { min-width: 100%; height: 280px; scroll-snap-align: start; display: grid; place-items: center; font-size: 76px; }
.dt-dots { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.dt-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(0,0,0,.18); transition: .2s; }
.dt-dots i.on { width: 16px; border-radius: 3px; background: var(--brand); }
.dt-pricebox { background: #fff; padding: 14px 16px 16px; }
.dt-price { color: var(--danger); font-weight: 800; font-size: 27px; }
.dt-price::before { content: '￥'; font-size: 15px; font-weight: 700; }
.dt-note { font-size: 12.5px; color: var(--text-2); margin-top: 4px; }
.dt-tags { display: flex; gap: 8px; margin-top: 12px; }
.dt-tag { font-size: 11.5px; color: var(--brand); background: var(--brand-soft); border-radius: 6px; padding: 3px 9px; }
.dt-params { width: 100%; font-size: 13px; border-collapse: collapse; }
.dt-params td { padding: 9px 0; border-bottom: 1px solid var(--line); }
.dt-params tr:last-child td { border-bottom: none; }
.dt-params td:first-child { color: var(--muted); width: 92px; }
.dt-service { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--text-2); }
.dt-service b { color: var(--success); font-weight: 700; }
.dt-bottom { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 10px 12px; display: flex; gap: 10px; z-index: 6; }

/* =========================================================
   后台 · 打印模板管理
   ========================================================= */
.editor { display: grid; grid-template-columns: 1fr 260px; gap: 22px; }
.chk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.chk input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }
.pt-stage { background: #eef0f4; border-radius: 12px; padding: 16px; display: flex; justify-content: center; }
.pt-paper { width: 240px; background: #fff; border-radius: 4px; padding: 14px 12px; font-family: 'Courier New', Consolas, monospace; font-size: 12px; line-height: 1.75; color: #111; box-shadow: 0 6px 18px rgba(16,24,40,.14); }
.pt-paper .pt-center { text-align: center; }
.pt-paper .pt-bold { font-weight: 700; }
.pt-paper .pt-title { font-size: 15px; letter-spacing: 3px; margin: 4px 0; }
.pt-paper .pt-hr { border-top: 1px dashed #b0b0b0; margin: 7px 0; }
.pt-paper .pt-row { display: flex; justify-content: space-between; }
.pt-paper .pt-qr { font-size: 28px; margin-top: 10px; letter-spacing: 2px; }
.pt-paper .pt-total { font-size: 14px; }
@media (max-width: 780px) {
    .editor { grid-template-columns: 1fr; }
}

/* =========================================================
   后台 · 工作台 / 库存预警
   ========================================================= */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 16px; }
.kpi { position: relative; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 18px; box-shadow: var(--shadow-xs); }
.kpi .ico { position: absolute; right: 16px; top: 16px; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: var(--brand-soft); }
.kpi .label { font-size: 13px; color: var(--text-2); }
.kpi .num { font-size: 30px; font-weight: 800; margin: 12px 0 4px; }
.kpi .delta { font-size: 12px; color: var(--muted); }
.kpi .delta.up { color: var(--success); }
.kpi .delta.down { color: var(--danger); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
.bars { display: flex; align-items: flex-end; gap: 12px; height: 180px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bars .bar .col { width: 56%; border-radius: 8px 8px 0 0; background: linear-gradient(180deg, var(--brand), var(--brand-2)); }
.bars .bar span { font-size: 12px; color: var(--muted); }
.bars .bar b { font-size: 12px; color: var(--text-2); }
.rank { display: flex; flex-direction: column; gap: 14px; }
.rank .it { display: flex; align-items: center; gap: 12px; font-size: 13.5px; }
.rank .it .no { width: 22px; height: 22px; border-radius: 6px; background: var(--line); color: var(--text-2); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.rank .it .no.top { background: var(--brand); color: #fff; }
.rank .it .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank .it .val { color: var(--text-2); }
.bar-line { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar-line i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.todo-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.todo-item:last-child { border-bottom: none; }

/* =========================================================
   小程序 · 分类目录 / 搜索 / 消息
   ========================================================= */
.cat-wrap { display: flex; min-height: 560px; background: #fff; }
.cat-left { width: 100px; background: #f5f6f8; flex-shrink: 0; }
.cat-left .c { padding: 18px 6px; text-align: center; font-size: 13px; color: var(--text-2); cursor: pointer; }
.cat-left .c.active { background: #fff; color: var(--brand); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand); }
.cat-right { flex: 1; padding: 12px; }
.cat-group-title { font-size: 13px; font-weight: 700; color: var(--text-2); margin: 6px 0 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 7px 14px; border-radius: 999px; background: #f4f5f8; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.chip.primary { background: var(--brand-soft); color: var(--brand); }
.msg-item { display: flex; gap: 12px; padding: 14px; background: #fff; border-radius: 14px; margin: 0 12px 10px; box-shadow: var(--shadow-xs); }
.msg-item .mi { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; background: var(--brand-soft); flex-shrink: 0; }
.msg-item .mt { font-size: 14px; font-weight: 600; }
.msg-item .md { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.search-bar-row { display: flex; gap: 10px; align-items: center; padding: 10px 12px; background: #fff; }
.search-bar-row .si { flex: 1; height: 40px; background: #f4f5f8; border-radius: 999px; padding: 0 16px; font-size: 13px; border: none; outline: none; }
