/* ==========================================================================
   抖音钻石担保交易平台 - 前台/卖家中心 H5 样式
   移动端优先，PC 自适应
   ========================================================================== */

:root {
    --primary: #1677ff;
    --primary-dark: #0f5fd6;
    --primary-light: #e8f2ff;
    --price: #f5641e;
    --success: #1aa46b;
    --success-light: #e6f7f0;
    --warning: #e5a100;
    --warning-light: #fff8e6;
    --danger: #e34d4d;
    --danger-light: #fdeeee;
    --gray: #8a93a0;
    --gray-light: #f5f7fa;
    --border: #e8ecf2;
    --text: #1f2733;
    --text-sub: #5c6775;
    --radius: 10px;
    --shadow: 0 2px 10px rgba(24, 40, 72, .06);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: var(--gray-light);
    padding-bottom: 60px;
}

a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; vertical-align: middle; }
input, textarea, select, button { font-family: inherit; font-size: 14px; outline: none; }

/* ---------- 顶部栏 ---------- */
.topbar {
    height: 48px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar .brand { font-size: 16px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 6px; }
.topbar .brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.topbar .brand .logo { height: 22px; width: auto; display: block; }
.topbar .nav-links { display: flex; gap: 14px; font-size: 13px; }
.topbar .nav-links a { color: var(--text-sub); }
.topbar .badge {
    display: inline-block; min-width: 16px; height: 16px; line-height: 16px;
    padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff;
    font-size: 11px; text-align: center; margin-left: 2px;
}

.page { max-width: 720px; margin: 0 auto; padding: 12px; }
.page-wide { max-width: 1100px; margin: 0 auto; padding: 12px; }

/* ---------- 卡片 ---------- */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px;
    margin-bottom: 12px;
}
.card-title {
    font-size: 15px; font-weight: 600; margin-bottom: 12px;
    display: flex; align-items: center; justify-content: space-between;
}
.card-title .more { font-size: 12px; color: var(--gray); font-weight: 400; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-block; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--border);
    background: #fff; color: var(--text); cursor: pointer; text-align: center;
    font-size: 14px; transition: .15s; line-height: 1.4;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #cf3f3f; color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { color: #fff; }
.btn-warning { background: var(--warning); border-color: var(--warning); color: #fff; }
.btn-warning:hover { color: #fff; }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 6px; }
.btn-lg { padding: 13px 20px; font-size: 16px; }
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; }
.btn-group { display: flex; gap: 10px; }
.btn-group .btn { flex: 1; }

/* ---------- 状态标签 ---------- */
.st { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.st-wait { background: var(--primary-light); color: var(--primary-dark); }
.st-warn { background: var(--warning-light); color: #a86f00; }
.st-info { background: #eef4ff; color: #2b5fd9; }
.st-ok { background: var(--success-light); color: var(--success); }
.st-gray { background: var(--gray-light); color: var(--gray); }
.st-danger { background: var(--danger-light); color: var(--danger); }

.lv { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 11px; }
.lv-gold { background: #fff4d6; color: #a87a00; }
.lv-good { background: var(--success-light); color: var(--success); }
.lv-normal { background: var(--gray-light); color: var(--gray); }
.lv-low { background: var(--warning-light); color: #a86f00; }
.lv-risk { background: var(--danger-light); color: var(--danger); }

/* ---------- 价格 ---------- */
.price { color: var(--price); font-weight: 600; }
.price .unit { font-size: 12px; font-weight: 400; }
.money-lg { font-size: 22px; font-weight: 600; }

/* ---------- 表单 ---------- */
.form-item { margin-bottom: 14px; }
.form-item label { display: block; font-size: 13px; color: var(--text-sub); margin-bottom: 6px; }
.form-item label .req { color: var(--danger); }
.input, .textarea, .select {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
    background: #fff; color: var(--text);
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--primary); }
.textarea { min-height: 90px; resize: vertical; }
.form-tip { font-size: 12px; color: var(--gray); margin-top: 4px; }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }

/* ---------- 列表 ---------- */
.list-item {
    display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item .thumb {
    width: 64px; height: 64px; border-radius: 8px; background: var(--primary-light);
    display: flex; align-items: center; justify-content: center; color: var(--primary);
    font-size: 12px; flex-shrink: 0; font-weight: 600;
}
.list-item .info { flex: 1; min-width: 0; }
.list-item .info .name { font-weight: 500; margin-bottom: 4px; }
.list-item .info .meta { font-size: 12px; color: var(--gray); }
.list-item .right { text-align: right; flex-shrink: 0; }

/* ---------- 商品卡片 ---------- */
.goods-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .goods-grid { grid-template-columns: repeat(3, 1fr); } }
.goods-card {
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 12px; display: flex; flex-direction: column; gap: 6px;
}
.goods-card .g-title { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goods-card .g-amount { font-size: 18px; font-weight: 600; color: var(--text); }
.goods-card .g-amount small { font-size: 12px; color: var(--gray); font-weight: 400; }
.goods-card .g-seller { font-size: 12px; color: var(--gray); display: flex; justify-content: space-between; }
.goods-card .g-price { display: flex; justify-content: space-between; align-items: baseline; }
.goods-card .g-price .t { font-size: 15px; }

/* ---------- 步骤条 ---------- */
.steps { display: flex; margin: 4px 0 16px; }
.steps .step { flex: 1; text-align: center; position: relative; font-size: 12px; color: var(--gray); }
.steps .step .n {
    width: 22px; height: 22px; line-height: 22px; border-radius: 50%; background: #e6eaf0;
    color: #fff; margin: 0 auto 4px; font-size: 12px;
}
.steps .step.active .n { background: var(--primary); }
.steps .step.done .n { background: var(--success); }
.steps .step.active, .steps .step.done { color: var(--text); }
.steps .step::after {
    content: ''; position: absolute; top: 11px; left: 50%; width: 100%; height: 2px;
    background: #e6eaf0; z-index: -1;
}
.steps .step:last-child::after { display: none; }
.steps .step.done::after { background: var(--success); }

/* ---------- 提示条 ---------- */
.alert { padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.alert-info { background: var(--primary-light); color: var(--primary-dark); }
.alert-warn { background: var(--warning-light); color: #a86f00; }
.alert-danger { background: var(--danger-light); color: var(--danger); }
.alert-success { background: var(--success-light); color: var(--success); }

/* ---------- 数据行 ---------- */
.kv { display: flex; justify-content: space-between; padding: 7px 0; font-size: 13px; border-bottom: 1px dashed var(--border); }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text-sub); }
.kv .v { color: var(--text); font-weight: 500; text-align: right; word-break: break-all; }

/* ---------- 底部导航 ---------- */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; height: 56px; background: #fff;
    border-top: 1px solid var(--border); display: flex; z-index: 200;
}
.tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: var(--gray); font-size: 11px; gap: 2px;
}
.tabbar a.on { color: var(--primary); }
.tabbar a .ico { font-size: 18px; line-height: 1; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 50px 20px; color: var(--gray); font-size: 13px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
    position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 900;
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box {
    background: #fff; border-radius: 12px; width: 100%; max-width: 420px;
    max-height: 86vh; overflow-y: auto; padding: 18px;
}
.modal-box h3 { font-size: 16px; margin-bottom: 12px; }
.hide { display: none !important; }

/* ---------- 上传框 ---------- */
.upload-box {
    width: 100px; height: 100px; border: 1px dashed var(--border); border-radius: 8px;
    display: flex; align-items: center; justify-content: center; color: var(--gray);
    font-size: 12px; cursor: pointer; background: var(--gray-light); overflow: hidden; position: relative;
}
.upload-box img { width: 100%; height: 100%; object-fit: cover; }
.upload-box input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; }
.table th, .table td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.table th { background: var(--gray-light); color: var(--text-sub); font-weight: 500; }
.table td { color: var(--text); }

/* ---------- 标签页 ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; background: #fff; border-radius: var(--radius); padding: 6px; margin-bottom: 12px; box-shadow: var(--shadow); }
.tabs a { padding: 6px 12px; border-radius: 6px; color: var(--text-sub); font-size: 13px; white-space: nowrap; }
.tabs a.on { background: var(--primary); color: #fff; }

/* ---------- 分页 ---------- */
.pager { display: flex; justify-content: center; gap: 6px; padding: 16px 0; flex-wrap: wrap; }
.pager a, .pager span {
    min-width: 32px; height: 32px; line-height: 32px; text-align: center; padding: 0 8px;
    border-radius: 6px; background: #fff; border: 1px solid var(--border); font-size: 13px; color: var(--text-sub);
}
.pager .active { background: var(--primary); border-color: var(--primary); color: #fff; }

ul.pagination { display: flex; justify-content: center; gap: 6px; padding: 16px 0; flex-wrap: wrap; list-style: none; }
ul.pagination > li > a, ul.pagination > li > span {
    display: block; min-width: 32px; height: 32px; line-height: 30px; text-align: center; padding: 0 8px;
    border-radius: 6px; background: #fff; border: 1px solid var(--border); font-size: 13px; color: var(--text-sub);
}
ul.pagination > li.active > a, ul.pagination > li.active > span {
    background: var(--primary); border-color: var(--primary); color: #fff;
}
ul.pagination > li.disabled > span { opacity: .45; }

/* ---------- 收银台 ---------- */
.pay-box { text-align: center; }
.pay-box .qr { width: 220px; height: 220px; object-fit: contain; border: 1px solid var(--border); border-radius: 8px; margin: 10px auto; display: block; }
.pay-amount { font-size: 26px; font-weight: 600; color: var(--price); margin: 6px 0; }
.countdown { color: var(--danger); font-weight: 600; }

/* ---------- 时间线 ---------- */
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ''; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 1px; background: var(--border); }
.timeline .tl-item { position: relative; padding-bottom: 14px; font-size: 13px; }
.timeline .tl-item::before {
    content: ''; position: absolute; left: -17px; top: 6px; width: 7px; height: 7px;
    border-radius: 50%; background: var(--primary); border: 2px solid #fff;
}
.timeline .tl-item .tl-time { font-size: 12px; color: var(--gray); }

.toast {
    position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, .8); color: #fff; padding: 10px 18px; border-radius: 8px;
    font-size: 13px; z-index: 1000; max-width: 80%; text-align: center;
}

/* ==========================================================================
   管理后台样式
   ========================================================================== */
body.admin-body { padding-bottom: 0; background: var(--gray-light); }
.admin-wrap { display: flex; min-height: 100vh; }

.admin-side {
    width: 190px; flex-shrink: 0; background: #1f2733; color: #c5cedb;
    display: flex; flex-direction: column;
}
.admin-side .side-logo {
    height: 54px; display: flex; align-items: center; padding: 0 16px;
    font-size: 15px; font-weight: 600; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08);
}
.admin-side .side-menu { padding: 10px 0; flex: 1; overflow-y: auto; }
.admin-side .side-menu .group {
    padding: 10px 16px 4px; font-size: 11px; color: #6b7688; letter-spacing: .5px;
}
.admin-side .side-menu a {
    display: block; padding: 9px 16px; font-size: 13px; color: #c5cedb; border-left: 3px solid transparent;
}
.admin-side .side-menu a:hover { background: rgba(255,255,255,.05); color: #fff; }
.admin-side .side-menu a.on { background: rgba(22,119,255,.16); color: #fff; border-left-color: var(--primary); }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-top {
    height: 54px; background: #fff; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; padding: 0 18px;
}
.admin-top .title { font-size: 15px; font-weight: 600; }
.admin-top .info { font-size: 13px; color: var(--text-sub); display: flex; gap: 14px; align-items: center; }
.admin-content { padding: 16px; flex: 1; }

.panel { background: #fff; border-radius: 10px; box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.panel-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.stat-card { background: #fff; border-radius: 10px; box-shadow: var(--shadow); padding: 14px; }
.stat-card .n { font-size: 22px; font-weight: 600; color: var(--text); }
.stat-card .t { font-size: 12px; color: var(--gray); margin-top: 2px; }
.stat-card.primary .n { color: var(--primary); }
.stat-card.danger .n { color: var(--danger); }
.stat-card.success .n { color: var(--success); }
.stat-card.warn .n { color: var(--warning); }

.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filter-bar .input, .filter-bar .select { width: auto; min-width: 130px; padding: 7px 10px; }
.filter-bar .btn { padding: 7px 14px; }

.table-wrap { overflow-x: auto; }
.table td .op { display: flex; gap: 6px; flex-wrap: wrap; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr:hover { background: #fafbfc; }

.modal-box textarea.textarea { min-height: 80px; }
.modal-box .form-item label { color: var(--text-sub); }

.badge-warn { background: var(--warning-light); color: #a86f00; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.badge-danger { background: var(--danger-light); color: var(--danger); padding: 2px 8px; border-radius: 4px; font-size: 12px; }

@media (max-width: 820px) {
    .admin-wrap { flex-direction: column; }
    .admin-side { width: 100%; }
    .admin-side .side-menu { display: flex; overflow-x: auto; padding: 6px; }
    .admin-side .side-menu .group { display: none; }
    .admin-side .side-menu a { white-space: nowrap; border-left: none; border-bottom: 2px solid transparent; }
    .admin-side .side-menu a.on { border-left: none; border-bottom-color: var(--primary); }
}
