/* ===== 移动端 H5 基础 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    background: #f2f3f5;
    color: #333;
    -webkit-tap-highlight-color: transparent;
}
a { text-decoration: none; color: inherit; }
code {
    background: #e8eefc; color: #1d72e8;
    padding: 1px 6px; border-radius: 4px;
    font-family: Consolas, monospace; font-size: 13px;
}

/* ===== 顶部栏 ===== */
.m-topbar {
    position: fixed; top: 0; left: 0; right: 0;
    height: 56px;
    background: #1d72e8;
    color: #fff;
    display: flex; align-items: center;
    padding: 0 14px;
    z-index: 20;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.menu-btn {
    font-size: 22px; background: none; border: none; color: #fff;
    width: 40px; height: 40px; border-radius: 8px; cursor: pointer;
}
.menu-btn:active { background: rgba(255,255,255,.15); }
.m-title { flex: 1; text-align: center; font-size: 17px; font-weight: 600; }
.m-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(255,255,255,.25);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
}

/* ===== 抽屉菜单 + 遮罩 ===== */
.drawer-mask {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    opacity: 0; visibility: hidden;
    transition: opacity .25s;
    z-index: 30;
}
.drawer {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 78%; max-width: 300px;
    background: #fff;
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 40;
    display: flex; flex-direction: column;
    box-shadow: 2px 0 12px rgba(0,0,0,.15);
}
body.drawer-open .drawer { transform: translateX(0); }
body.drawer-open .drawer-mask { opacity: 1; visibility: visible; }

.drawer-head {
    padding: 28px 20px;
    background: linear-gradient(135deg, #1d72e8, #4a90e8);
    color: #fff;
    display: flex; align-items: center; gap: 12px;
}
.drawer-avatar {
    width: 46px; height: 46px; border-radius: 50%;
    background: rgba(255,255,255,.3);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}
.drawer-name { font-size: 16px; font-weight: 600; }

.drawer-nav { padding: 10px 0; flex: 1; }
.d-item {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 20px;
    font-size: 15px; color: #444;
    border-left: 3px solid transparent;
}
.d-item .d-icon { width: 24px; text-align: center; font-size: 18px; }
.d-item:active { background: #f2f3f5; }
.d-item.active {
    color: #1d72e8; background: #eaf2ff;
    border-left-color: #1d72e8; font-weight: 600;
}

/* ===== 内容区（避开固定顶栏） ===== */
.m-body {
    padding: 70px 14px 24px;
}

.m-welcome {
    background: #fff; border-radius: 12px;
    padding: 20px 18px; margin-bottom: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.m-welcome h2 { font-size: 19px; margin-bottom: 8px; }
.m-welcome p { color: #666; font-size: 14px; line-height: 1.7; }

/* 统计：两列 */
.m-stat-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 12px; margin-bottom: 14px;
}
.m-stat-card {
    background: #fff; border-radius: 12px;
    padding: 18px 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.m-stat-label { color: #999; font-size: 13px; margin-bottom: 8px; }
.m-stat-value { font-size: 24px; font-weight: 700; color: #263445; }
.m-stat-value.ok { color: #22a06b; }

.m-panel {
    background: #fff; border-radius: 12px;
    padding: 18px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.m-panel h3 { font-size: 16px; margin-bottom: 10px; }
.m-panel p { color: #666; font-size: 14px; line-height: 1.8; }

/* ===== 顶栏新增按钮 ===== */
.add-btn {
    font-size: 22px; background: none; border: none; color: #fff;
    width: 40px; height: 40px; border-radius: 8px; cursor: pointer; line-height: 1;
}
.add-btn:active { background: rgba(255,255,255,.15); }

/* ===== 搜索框 ===== */
.search-box {
    display: flex; align-items: center; gap: 8px;
    background: #fff; border-radius: 10px;
    padding: 10px 14px; margin-bottom: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.search-icon { font-size: 15px; }
.search-input {
    flex: 1; border: none; outline: none;
    font-size: 14px; background: transparent; color: #333;
}
.search-input::placeholder { color: #aaa; }

/* ===== 用户列表 ===== */
.user-list { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.user-item {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f1f3;
}
.user-item:last-child { border-bottom: none; }
.user-item:active { background: #f7f8fa; }
.user-avatar {
    width: 44px; height: 44px; border-radius: 50%;
    background: #1d72e8; color: #fff; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 600;
}
.user-info { flex: 1; min-width: 0; }
.user-name-row { display: flex; align-items: center; gap: 8px; }
.user-name { font-size: 16px; font-weight: 600; color: #263445; }
.user-meta { font-size: 13px; color: #999; margin-top: 4px; }
.status-tag {
    font-size: 12px; padding: 2px 8px; border-radius: 10px;
}
.status-tag.on { color: #22a06b; background: #e6f6ef; }
.status-tag.off { color: #999; background: #f0f1f3; }
.user-arrow { color: #ccc; font-size: 20px; }
.list-tip { text-align: center; color: #aaa; font-size: 13px; margin-top: 14px; }
.empty-tip { padding: 30px; text-align: center; color: #aaa; font-size: 14px; }

/* ===== 二级下拉菜单 ===== */
.d-group-title {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 20px; font-size: 15px; color: #444; cursor: pointer;
    border-left: 3px solid transparent;
}
.d-group-title .d-icon { width: 24px; text-align: center; font-size: 18px; }
.group-arrow { margin-left: auto; font-size: 12px; color: #999; transition: transform .2s; }
.d-group.open .group-arrow { transform: rotate(180deg); }
.d-sub { display: none; }
.d-group.open .d-sub { display: block; }
.d-sub-item {
    display: block; padding: 11px 20px 11px 58px;
    font-size: 14px; color: #666;
}
.d-sub-item:active { background: #f2f3f5; }
.d-sub-item.active { color: #1d72e8; font-weight: 600; background: #eaf2ff; }
.drawer-footer { padding: 16px 20px; border-top: 1px solid #f0f1f3; }
.logout-link { color: #d9534f; font-size: 15px; }

/* ===== flash 消息 ===== */
.flash { padding: 10px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 12px; }
.flash-error { background: #fdecec; color: #d9534f; }
.flash-ok { background: #e6f6ef; color: #22a06b; }

/* ===== 登录 / 注册卡片 ===== */
.auth-body { display: flex; align-items: center; min-height: 100vh; }
.auth-wrap { width: 100%; padding: 24px; }
.auth-card {
    background: #fff; border-radius: 16px; padding: 32px 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
}
.auth-logo {
    width: 56px; height: 56px; border-radius: 14px;
    background: #1d72e8; color: #fff; font-size: 28px;
    display: flex; align-items: center; justify-content: center; margin: 0 auto 14px;
}
.auth-title { text-align: center; font-size: 20px; margin-bottom: 18px; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; color: #666; margin-bottom: 6px; }
.field input {
    width: 100%; padding: 12px 14px; border: 1px solid #e2e5ea;
    border-radius: 10px; font-size: 15px; outline: none;
}
.field input:focus { border-color: #1d72e8; }
.auth-btn {
    width: 100%; padding: 13px; border: none; border-radius: 10px;
    background: #1d72e8; color: #fff; font-size: 16px; cursor: pointer; margin-top: 6px;
}
.auth-btn:active { background: #1663d6; }
.auth-alt { text-align: center; font-size: 14px; color: #888; margin-top: 16px; }
.auth-alt a { color: #1d72e8; }

/* ===== 角色管理 ===== */
.role-item { padding: 14px 16px; border-bottom: 1px solid #f0f1f3; }
.role-item:last-child { border-bottom: none; }
.role-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.role-badge {
    font-size: 12px; color: #1d72e8; background: #eaf2ff;
    padding: 2px 8px; border-radius: 10px;
}
.mini-btn {
    display: inline-block; font-size: 13px; color: #1d72e8;
    border: 1px solid #1d72e8; border-radius: 8px; padding: 5px 12px;
    background: #fff; cursor: pointer;
}
.mini-btn:active { background: #eaf2ff; }
.perm-tags { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.perm-tag {
    font-size: 12px; color: #555; background: #f0f2f5;
    padding: 3px 10px; border-radius: 10px;
}
.perm-tag.none { color: #aaa; background: #f5f5f5; }

/* ===== 复选框列表（授权页 / 分配角色） ===== */
.panel-form { margin-top: 0; }
.check-list { background: #fff; border-radius: 12px; overflow: hidden; margin: 14px 0; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.check-row {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; border-bottom: 1px solid #f0f1f3; cursor: pointer;
}
.check-row:last-child { border-bottom: none; }
.check-row input { width: 18px; height: 18px; accent-color: #1d72e8; }
.check-text { display: flex; flex-direction: column; gap: 2px; font-size: 15px; }
.check-text .user-meta { font-size: 12px; }
.back-link { display: block; text-align: center; margin-top: 14px; color: #888; font-size: 14px; }

/* 用户卡片内分配角色 */
.assign-form { margin-top: 10px; }
.check-inline { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 8px; }
.mini-check { font-size: 14px; color: #555; display: flex; align-items: center; gap: 6px; }
.mini-check input { accent-color: #1d72e8; }

/* ===== 新增折叠框 / 操作按钮组 ===== */
.add-box { margin-bottom: 14px; }
.add-box summary { cursor: pointer; font-size: 16px; font-weight: 600; }
.add-box form { margin-top: 14px; }
.role-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.mini-btn.danger { color: #d9534f; border-color: #ecc2c2; }
.mini-btn.danger:active { background: #fdecec; }

/* ===== 授权状态角标 / 授权按钮 ===== */
.status-tag.warn { color: #d98a00; background: #fdf3e2; }
.approve-form { margin-top: 10px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ===== 弹窗（无权限登录提示） ===== */
.modal-mask {
    position: fixed; inset: 0; z-index: 60;
    background: rgba(0, 0, 0, .45);
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    opacity: 0; visibility: hidden;
    transition: opacity .2s;
}
.modal-mask.show { opacity: 1; visibility: visible; }
.modal-card {
    width: 100%; max-width: 340px;
    background: #fff; border-radius: 16px;
    padding: 26px 22px; text-align: center;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .18);
    transform: scale(.94);
    transition: transform .2s;
}
.modal-mask.show .modal-card { transform: scale(1); }
.modal-icon {
    width: 52px; height: 52px; border-radius: 50%;
    background: #fdecec; color: #d9534f;
    font-size: 26px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 14px;
}
.modal-title { font-size: 18px; color: #263445; margin-bottom: 10px; }
.modal-text { color: #666; font-size: 14px; line-height: 1.7; }
.modal-sub { color: #aaa; font-size: 13px; margin-top: 8px; }
.modal-btn {
    width: 100%; padding: 12px; border: none; border-radius: 10px;
    background: #1d72e8; color: #fff; font-size: 15px;
    margin-top: 18px; cursor: pointer;
}
.modal-btn:active { background: #1663d6; }

/* ===== 商品模块 ===== */
.prod-list {
    background: #fff; border-radius: 12px; overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
}
.prod-item {
    display: flex; gap: 12px; padding: 14px 16px;
    border-bottom: 1px solid #f0f1f3;
}
.prod-item:last-child { border-bottom: none; }
.prod-thumb {
    width: 64px; height: 64px; border-radius: 10px; flex-shrink: 0;
    background: linear-gradient(135deg, #eaf2ff, #dbe8fc);
    color: #1d72e8; font-size: 22px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.prod-thumb.big { width: 72px; height: 72px; font-size: 24px; }
.prod-thumb img { width: 100%; height: 100%; object-fit: cover; }
.prod-body { flex: 1; min-width: 0; }
.prod-hero { display: flex; gap: 12px; align-items: flex-start; }
.prod-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prod-name { font-size: 16px; font-weight: 600; color: #263445; }
.prod-sub { font-size: 12px; color: #999; margin-top: 3px; }
.prod-summary { font-size: 13px; color: #666; line-height: 1.7; margin-top: 10px; }
.prod-price-line {
    margin-top: 6px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
.price { color: #e04b2a; font-weight: 700; font-size: 16px; }
.price-unit { font-size: 12px; color: #999; }
.best-line { font-size: 12px; color: #22a06b; margin-top: 5px; line-height: 1.6; }
.best-text { color: #22a06b; }
.prod-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.prod-actions form { margin: 0; }

.tag { font-size: 12px; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.tag.on { color: #22a06b; background: #e6f6ef; }
.tag.off { color: #999; background: #f0f1f3; }
.tag.info { color: #1d72e8; background: #eaf2ff; }

.stats-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 8px; margin-top: 14px;
}
.stat-box {
    background: #f7f9fc; border-radius: 10px; padding: 10px 8px; text-align: center;
}
.stat-box .v { font-size: 16px; font-weight: 700; color: #263445; }
.stat-box .k { font-size: 11px; color: #999; margin-top: 3px; }

.sec-title { font-size: 15px; color: #263445; margin: 16px 2px 10px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini-input {
    width: 100%; padding: 9px 11px; border: 1px solid #e2e5ea;
    border-radius: 8px; font-size: 14px; color: #333;
    outline: none; background: #fff;
}
.mini-input:focus { border-color: #1d72e8; }
select.mini-input { appearance: none; }
.form-hint { font-size: 12px; color: #999; line-height: 1.7; margin-top: 8px; }
.form-hint a { color: #1d72e8; }

.spec-edit-row {
    border: 1px solid #eef0f4; border-radius: 10px;
    padding: 12px; margin-bottom: 10px; background: #fafbfd;
}
.spec-edit-row .field { margin-bottom: 10px; }
.spec-edit-row .field:last-child { margin-bottom: 0; }
.spec-del {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; color: #d9534f; padding-bottom: 6px;
}

.spec-card {
    background: #fff; border-radius: 12px; padding: 14px 16px;
    margin-bottom: 12px; box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
}
.spec-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.spec-name { font-size: 15px; font-weight: 600; color: #263445; }
.spec-meta { font-size: 12px; color: #999; margin-top: 4px; line-height: 1.6; }
.spec-best { text-align: right; color: #22a06b; font-size: 14px; font-weight: 600; white-space: nowrap; }

.quote-list { margin-top: 10px; }
.quote-row {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 0; border-bottom: 1px dashed #f0f1f3;
    font-size: 13px;
}
.quote-row:last-child { border-bottom: none; }
.quote-row.best {
    background: #e6f6ef; border-radius: 8px;
    padding: 9px 10px; margin: 4px 0; border-bottom: none;
}
.quote-name { flex: 1; color: #333; min-width: 0; }
.quote-price { font-weight: 700; color: #1f2d3d; }
.quote-price.best { color: #22a06b; }
.quote-meta { font-size: 12px; color: #999; white-space: nowrap; }
.quote-row form { margin: 0; }
.link-danger {
    border: none; background: none; color: #d9534f;
    font-size: 12px; cursor: pointer; padding: 0 2px;
}

.quote-form {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px;
}
.quote-form .mini-input { font-size: 13px; padding: 8px 9px; }
.quote-form .mini-btn { grid-column: span 2; }


/* ===== 商品图片上传 ===== */
.img-uploader { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.img-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.img-item { position: relative; width: 92px; height: 92px; border-radius: 10px; overflow: hidden; background: #f4f5f7; }
.img-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-del {
    position: absolute; top: 3px; right: 3px; width: 20px; height: 20px;
    border: none; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff;
    font-size: 13px; line-height: 20px; padding: 0; cursor: pointer;
}
.img-add {
    width: 92px; height: 92px; border: 1px dashed #cfd4dc; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #9aa4b2; font-size: 12px; text-align: center; cursor: pointer; background: #fafbfc;
}
.img-add:hover { border-color: #22a06b; color: #22a06b; }
.prod-gallery { display: flex; gap: 8px; overflow-x: auto; margin-top: 12px; }
.gallery-item { flex: 0 0 auto; width: 96px; height: 96px; border-radius: 10px; overflow: hidden; background: #f4f5f7; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ===== 规格行：删除按钮 ===== */
.spec-row-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 6px;
}
.spec-row-idx { font-size: 12px; color: #8a94a6; }
.spec-remove {
    border: none; background: none; color: #d9534f;
    font-size: 12px; cursor: pointer; padding: 0;
}
.spec-remove:hover { text-decoration: underline; }

/* ===== 进货单导入 ===== */
.import-textarea {
    width: 100%; box-sizing: border-box; min-height: 180px;
    font-family: inherit; font-size: 13px; line-height: 1.7; resize: vertical;
}
.import-result { margin-top: 14px; padding: 12px; background: #f6fbf8; border-radius: 10px; }
.import-result h4 { margin: 0 0 8px; font-size: 14px; color: #22a06b; }
.import-result ul { margin: 0; padding-left: 18px; font-size: 13px; color: #445; line-height: 1.9; }

/* ===== 进货单照片 ===== */
.receipt-upload { margin-top: 12px; }
.receipt-pick { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.receipt-pick input[type="file"] {
    flex: 1; min-width: 0; font-size: 13px; color: #666;
}
.receipt-list { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.receipt-item {
    display: flex; gap: 12px; padding: 12px;
    border: 1px solid #eef0f4; border-radius: 12px; background: #fafbfd;
}
.receipt-thumb {
    width: 84px; height: 84px; border-radius: 10px; overflow: hidden;
    background: #f4f5f7; flex-shrink: 0; display: block;
}
.receipt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.receipt-meta { flex: 1; min-width: 0; }
.receipt-name {
    font-size: 14px; font-weight: 600; color: #263445;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.receipt-sub { font-size: 12px; color: #999; margin-top: 4px; display: flex; align-items: center; gap: 8px; }
.receipt-actions { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }