/* 售后服务系统 - 全站样式 v2（视觉升级 + 移动端 App 化 + 保修卡打印版式） */
* { box-sizing: border-box; }
:root {
    --brand: #1a73e8;
    --brand-weak: #eaf2fe;
    --brand-weak: color-mix(in srgb, var(--brand) 10%, #fff);
    --brand-ink: #124a9e;
    --brand-ink: color-mix(in srgb, var(--brand) 72%, #1b2430);
    --ink: #1f2328;
    --ink-2: #3c434d;
    --muted: #6b7280;
    --line: #e6e9ee;
    --line-soft: #f0f2f5;
    --bg: #f4f6fa;
    --surface: #ffffff;
    --ok: #0f9d58;
    --warn: #e5940a;
    --bad: #d93025;
    --radius: 12px;
    --radius-sm: 9px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(24, 39, 75, .04), 0 2px 8px rgba(24, 39, 75, .04);
    --shadow-md: 0 4px 14px rgba(24, 39, 75, .07), 0 14px 34px rgba(24, 39, 75, .05);
    --tabbar-h: 62px;
}
html, body { margin: 0; padding: 0; }
body {
    font: 15px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    color: var(--ink); background: var(--bg); -webkit-text-size-adjust: 100%;
    background-image: radial-gradient(1200px 420px at 50% -180px, color-mix(in srgb, var(--brand) 7%, #fff), transparent 70%);
    background-repeat: no-repeat;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 12px; font-weight: 650; letter-spacing: -.01em; }
p { margin: 8px 0; }
code, .mono { font-family: "SFMono-Regular", Consolas, "Courier New", monospace; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pre { white-space: pre-wrap; }
.hidden { display: none !important; }
.mt { margin-top: 18px; }
::selection { background: color-mix(in srgb, var(--brand) 24%, #fff); }

/* ---------- 框架 ---------- */
.topbar {
    background: rgba(255, 255, 255, .92); border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 20; backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
}
.tb-inner { max-width: 1180px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; color: var(--ink); font-size: 16px; line-height: 1.3; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand::before {
    content: ""; width: 30px; height: 30px; border-radius: 9px; flex: 0 0 auto;
    background: var(--brand);
    background-image: linear-gradient(135deg, rgba(255, 255, 255, .32), rgba(255, 255, 255, 0));
    box-shadow: 0 3px 9px color-mix(in srgb, var(--brand) 34%, transparent);
    position: relative;
}
.brand::after {
    content: "售"; position: absolute; left: 0; top: 0; width: 30px; height: 30px;
    color: #fff; font-size: 14px; font-weight: 700; text-align: center; line-height: 30px;
    border-radius: 9px; pointer-events: none;
}
/* ::after 是相对 .brand 定位的，配合下面的 flex 布局用 transform 对齐左侧徽标 */
.brand { position: relative; padding-left: 0; }
.brand .sub { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 2px; }
.mainnav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.mainnav a { padding: 6px 12px; border-radius: 20px; color: var(--ink-2); font-size: 14px; transition: background .18s, color .18s; }
.mainnav a:hover { background: var(--brand-weak); color: var(--brand-ink); text-decoration: none; }
.mainnav a.on { background: var(--brand); color: #fff; box-shadow: 0 3px 10px color-mix(in srgb, var(--brand) 32%, transparent); }
.tb-user { font-size: 13px; color: var(--muted); white-space: nowrap; }
.tb-user a { color: var(--muted); }
.tb-user a:hover { color: var(--brand); }
.tb-user .tb-me { color: var(--ink); font-weight: 600; }
.tb-user .tb-me:hover { color: var(--brand); }

/* 导航图标：桌面隐藏，移动端底部栏显示 */
.ni { width: 21px; height: 21px; display: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar, .more-mask, .more-sheet { display: none; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 20px 16px 44px; }
.wrap.narrow { max-width: 720px; }
.page-title { font-size: 22px; margin: 4px 0 18px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-title small { font-size: 14px; font-weight: 400; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 0 0 24px; }

.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 18px 20px; margin: 0 0 16px; box-shadow: var(--shadow-sm);
}
.card h2 {
    font-size: 16px; border-bottom: 1px solid var(--line-soft); padding-bottom: 10px; margin-bottom: 14px;
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.card h2 .more { font-size: 13px; font-weight: 400; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* 空状态 */
.card.muted, .empty {
    text-align: center; color: var(--muted); padding: 26px 18px;
    border: 1px dashed var(--line); background: #fbfcfe;
}
.empty b { display: block; color: var(--ink-2); font-weight: 600; margin-bottom: 4px; }

/* ---------- 统计 ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
    position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 15px 17px 14px; color: var(--ink); box-shadow: var(--shadow-sm);
    transition: transform .18s, box-shadow .18s, border-color .18s;
}
.stat::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    background: var(--brand); opacity: .85;
}
.stat.warn::before { background: var(--warn); }
.stat.bad::before { background: var(--bad); }
.stat:hover { text-decoration: none; border-color: color-mix(in srgb, var(--brand) 45%, #fff); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat b { display: block; font-size: 28px; line-height: 1.2; font-weight: 700; color: var(--brand-ink); letter-spacing: -.02em; }
.stat.warn b { color: #b26c00; }
.stat.bad b { color: var(--bad); }
.stat span { font-size: 13px; color: var(--muted); }

/* ---------- 表格 ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 10px 11px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
.tbl thead th { background: #fafbfd; font-weight: 600; color: var(--muted); white-space: nowrap; font-size: 13px; }
.tbl thead th:first-child { border-top-left-radius: 8px; }
.tbl thead th:last-child { border-top-right-radius: 8px; }
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr:hover { background: color-mix(in srgb, var(--brand) 3.5%, #fff); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl.list { display: block; overflow-x: auto; white-space: nowrap; }
.tbl.list td { white-space: normal; min-width: 90px; }
.tbl td small { color: var(--muted); }
.row-ops { display: flex; gap: 10px; align-items: center; white-space: nowrap; flex-wrap: wrap; }
.row-ops a.pri { font-weight: 600; }
.kv { width: 100%; border-collapse: collapse; font-size: 14px; }
.kv th { width: 92px; text-align: left; color: var(--muted); font-weight: 500; padding: 6px 8px 6px 0; vertical-align: top; }
.kv td { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.kv.plain th { width: 80px; }
.status-line { display: flex; align-items: center; gap: 10px; }

/* 标签 */
.tag { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; background: #eef0f3; color: var(--muted); line-height: 1.6; }
.tag.in, .tag.ok { background: #e6f4ea; color: #0b7a43; }
.tag.out, .tag.bad { background: #fde7e9; color: #b3261e; }
.tag.warn { background: #fef3dc; color: #9a6500; }
.tag.unknown { background: #eef0f3; color: var(--muted); }
.tag.big { font-size: 15px; padding: 4px 14px; }

/* ---------- 按钮 / 表单 ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 16px; border-radius: var(--radius-sm); background: var(--brand); color: #fff;
    border: 1px solid var(--brand); font-size: 14px; font-weight: 500; cursor: pointer; font-family: inherit;
    box-shadow: 0 2px 6px color-mix(in srgb, var(--brand) 24%, transparent);
    transition: transform .16s, box-shadow .16s, filter .16s, background .16s;
}
.btn:hover { filter: brightness(1.07); text-decoration: none; color: #fff; transform: translateY(-1px); box-shadow: 0 5px 14px color-mix(in srgb, var(--brand) 30%, transparent); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn:disabled, .btn[disabled] { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.ghost { background: #fff; color: var(--ink-2); border-color: var(--line); box-shadow: none; }
.btn.ghost:hover { background: var(--brand-weak); color: var(--brand-ink); border-color: color-mix(in srgb, var(--brand) 35%, #fff); }
.btn.bad { background: var(--bad); border-color: var(--bad); box-shadow: 0 2px 6px rgba(217, 48, 37, .22); }
.btn.bad:hover { color: #fff; }
.btn.lg { padding: 11px 24px; font-size: 15px; }
.btn.sm { padding: 5px 11px; font-size: 13px; }
.link { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; font: inherit; }
a.link { text-decoration: none; }
.link.bad { color: var(--bad); }
.inl { display: inline; }

form.card { display: block; }
label { display: block; margin: 0 0 13px; font-size: 14px; color: var(--ink-2); font-weight: 500; }
label > input, label > textarea, label > select { display: block; margin-top: 5px; font-weight: 400; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=url],
input:not([type]), textarea, select {
    width: 100%; padding: 9px 11px; border: 1px solid #d8dde4; border-radius: var(--radius-sm);
    font: inherit; color: var(--ink); background: #fff; transition: border-color .16s, box-shadow .16s;
}
input::placeholder, textarea::placeholder { color: #a5acb6; }
input[type=color] { width: 64px; height: 38px; padding: 3px; border: 1px solid #d8dde4; border-radius: var(--radius-sm); background: #fff; }
input[type=file] { font-size: 13px; margin: 5px 0; }
input:focus, textarea:focus, select:focus {
    outline: none; border-color: var(--brand);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent);
}
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px 4px; margin: 0 0 16px; }
legend { font-size: 14px; font-weight: 600; padding: 0 6px; color: var(--ink); }
.grid2, .grid3 { display: grid; gap: 12px; }
.grid2 { grid-template-columns: 1fr 1fr; }
.grid3 { grid-template-columns: repeat(3, 1fr); }
.kv { padding: 8px 0; min-width: 0; }
.kv > span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.kv > div { font-size: 14.5px; color: var(--ink); word-break: break-all; }
.grid-span { grid-column: 1 / -1; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
label.check input { width: auto; margin: 0; }
form.filter { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
form.filter .search { flex: 2; min-width: 220px; }
form.filter select { flex: 1; min-width: 140px; width: auto; }
form.filter button, form.filter a { flex: 0 0 auto; }
.calc { background: var(--brand-weak); border-radius: var(--radius-sm); padding: 9px 13px; font-size: 14px; }
.calc b { color: var(--brand-ink); font-size: 16px; }
form.danger { display: flex; align-items: center; gap: 12px; }
.imgrow { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.cur-img { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.cur-img img { width: 96px; height: 96px; object-fit: contain; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }

/* 提示 */
.alert { border-radius: var(--radius-sm); padding: 11px 14px 11px 16px; margin: 0 0 14px; font-size: 14px; border: 1px solid transparent; border-left-width: 3px; }
.alert-ok { background: #e9f6ee; color: #14502f; border-color: #b7dfc4; border-left-color: var(--ok); }
.alert-err { background: #fdecee; color: #7a1b14; border-color: #f3c2c6; border-left-color: var(--bad); }
.alert-warn { background: #fef6e2; color: #6b4b00; border-color: #f6e2b3; border-left-color: var(--warn); }

.pager { margin: 14px 0; font-size: 14px; color: var(--muted); }
.pager .pg { display: inline-block; min-width: 32px; text-align: center; padding: 5px 8px; margin-right: 4px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink-2); }
.pager .pg:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.pager .pg.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* 图片 */
.thumbs, .gallery { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.thumbs figure, .gallery figure { margin: 0; width: 150px; }
.thumbs img, .gallery img { width: 150px; height: 110px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); display: block; background: #fff; }
.gallery img { width: 190px; height: 140px; }
.thumbs figcaption, .gallery figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; justify-content: space-between; gap: 6px; }
.thumbs .del { color: var(--bad); cursor: pointer; }
.thumbs .del:hover { text-decoration: underline; }

/* ---------- 登录 ---------- */
body.bare { background: linear-gradient(160deg, #eef3fa, #f7f8fa 60%); }
.login-box { max-width: 390px; margin: 9vh auto 0; padding: 0 14px; }
.login-brand { text-align: center; margin-bottom: 20px; }
.login-brand h1 { margin: 0; font-size: 23px; }
.login-brand p { color: var(--muted); font-size: 13px; margin: 5px 0 0; }
.login-brand::before {
    content: "售"; display: block; width: 54px; height: 54px; margin: 0 auto 14px;
    border-radius: 15px; background: var(--brand); color: #fff; font-size: 24px; font-weight: 700;
    line-height: 54px; box-shadow: 0 8px 22px color-mix(in srgb, var(--brand) 34%, transparent);
    background-image: linear-gradient(135deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, 0));
}
.login-form { box-shadow: var(--shadow-md); border-radius: var(--radius-lg); padding: 22px 22px 20px; }
.login-form .btn { width: 100%; }

/* ---------- 对外查询页 ---------- */
.q-head { text-align: center; margin: 7vh auto 20px; max-width: 560px; padding: 0 14px; }
.q-head h1 { font-size: 23px; margin-bottom: 6px; }
.q-head p { color: var(--muted); font-size: 14px; }
.q-form { max-width: 540px; margin: 0 auto 22px; display: flex; gap: 10px; padding: 0 14px; }
.q-form input { flex: 1; padding: 12px 15px; border: 1px solid #d8dde4; border-radius: 11px; font-size: 16px; box-shadow: var(--shadow-sm); }
.q-card { max-width: 640px; margin: 0 14px 24px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; padding: 0 20px 20px; box-shadow: var(--shadow-md); }
.q-title { display: flex; justify-content: space-between; align-items: center; margin: 0 -20px 16px; padding: 15px 20px; color: #fff; font-size: 17px; }
.q-state { background: rgba(255, 255, 255, .92); color: var(--ink); padding: 3px 13px; border-radius: 20px; font-size: 13px; font-weight: 600; }
.q-state.in { color: var(--ok); }
.q-state.out { color: var(--bad); }
.q-side { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.q-wx { width: 130px; height: 130px; object-fit: contain; border: 1px solid var(--line); border-radius: var(--radius-sm); float: right; margin-left: 14px; }
.q-hot { font-weight: 600; color: var(--brand-ink); font-size: 17px; }
.q-foot { text-align: center; font-size: 12px; }

/* ---------- 保修卡（固定版式，勿随屏幕收缩） ---------- */
body.bare { padding-bottom: 40px; }
.toolbar { max-width: 820px; margin: 0 auto 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
/* 保修卡是固定版式（一张 A4 / 一张图片），窄屏用 zoom 等比缩小，
   不能让它随屏幕收缩，否则右侧二维码栏会被挤出卡片、导出时被裁掉 */
.wcard {
    width: 820px; min-width: 820px; max-width: 820px; margin: 0 auto 22px; background: #fff; border: 1px solid var(--line);
    border-radius: 12px; overflow: hidden; box-shadow: 0 8px 24px rgba(31, 35, 40, .07);
}
.wcard-head { color: #fff; padding: 14px 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.wcard-head.sub { background: #2b3038; }
.wcard-head .wc-brand { display: flex; align-items: center; gap: 12px; }
.wc-logo { width: 46px; height: 46px; object-fit: contain; background: #fff; border-radius: 8px; padding: 3px; }
.wcard-head b { display: block; font-size: 18px; }
.wcard-head span { font-size: 13px; opacity: .9; }
.wc-no { text-align: right; font-size: 12px; }
.wc-no em { display: block; font-style: normal; opacity: .8; }
.wc-no b { font-size: 15px; }
.wcard-body { padding: 16px 20px; display: grid; grid-template-columns: 1fr 200px; gap: 14px 18px; }
.wc-tbl { grid-column: 1; width: 100%; border-collapse: collapse; font-size: 14px; }
.wc-tbl th, .wc-tbl td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; }
.wc-tbl th { width: 78px; background: #f7f9fc; color: var(--muted); font-weight: 500; white-space: nowrap; }
.wc-tbl tr.hl td { background: #f2f7ff; }
.wc-tbl tr.wc-techrow td { background: #fbfcfe; color: var(--muted); font-size: 12px; }
.wc-part { white-space: nowrap; }
.wc-state { float: right; font-size: 12px; padding: 1px 9px; border-radius: 20px; background: #eef0f3; }
.wc-state.in { background: #e6f4ea; color: var(--ok); }
.wc-state.out { background: #fde7e9; color: var(--bad); }
.wc-side { grid-column: 2; text-align: center; font-size: 13px; }
.wc-wximg {
    width: 108px; height: 108px; margin: 0 auto; border: 1px solid var(--line); border-radius: 8px;
    background-repeat: no-repeat; background-position: center; background-size: contain; background-color: #fff;
    display: block; object-fit: contain;
}
.wc-wx-empty { width: 108px; height: 108px; line-height: 108px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: 12px; margin: 0 auto; }
.wc-qr .qrbox { margin: 10px auto 2px; width: 108px; height: 108px; }
.wc-qr .qrbox img, .wc-qr .qrbox canvas { display: block; margin: 0 auto; }
.wc-qr .qrbox .qr-img { width: 108px; height: 108px; }
.qr-fallback { display: block; font-size: 12px; line-height: 108px; text-align: center; }
.wc-cap { font-size: 11px; color: var(--muted); margin: 2px 0 8px; }
.wc-hot { font-weight: 600; }
.wc-wxid { color: var(--muted); }
.wc-notice { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 8px; background: #fafbfc; padding: 10px 12px; }
.wc-notice h4 { margin: 0 0 6px; font-size: 13px; color: var(--brand); }
.wc-notice p { margin: 0; font-size: 12.5px; line-height: 1.75; color: #3c4043; }
.wc-photos-inline { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.wc-photobox {
    height: 92px; border: 1px solid var(--line); border-radius: 6px;
    background-repeat: no-repeat; background-position: center; background-size: cover;
    width: 100%; display: block; object-fit: cover;
}
.wc-remark { grid-column: 1 / -1; border-top: 1px dashed var(--line); padding-top: 10px; font-size: 13px; }
.wcard-foot { display: flex; gap: 16px; justify-content: space-between; padding: 12px 20px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.sig { display: flex; align-items: flex-end; gap: 6px; flex: 1; min-width: 150px; }
.sig i { flex: 1; border-bottom: 1px solid #999; height: 20px; font-style: normal; padding-left: 6px; }
.wc-make { flex-basis: 100%; font-size: 12px; color: var(--muted); }

/* 保修卡图片预览层（长按可保存） */
.img-view {
    position: fixed; inset: 0; z-index: 90; background: rgba(15, 18, 25, .84);
    display: flex; align-items: center; justify-content: center; padding: 14px;
    backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.img-view[hidden] { display: none; }
.img-view-in { background: #fff; border-radius: var(--radius); max-width: 96vw; max-height: 94vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-md); }
.img-view-bar { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; flex-wrap: wrap; }
.img-view-body { overflow: auto; padding: 12px; text-align: center; }
.img-view-body img { width: 420px; max-width: 88vw; height: auto; border: 1px solid var(--line); border-radius: 6px; }

/* ---------- 打印（单页 A4） ---------- */
@page { size: A4 portrait; margin: 6mm; }
@media print {
    body { background: #fff; font-size: 12px; }
    .no-print, .toolbar, .alert, .foot, .topbar, .img-view, .tabbar, .more-mask, .more-sheet { display: none !important; }
    .wrap, main { max-width: none; margin: 0; padding: 0; }
    body.bare { padding-bottom: 0; }
    .wcard { max-width: none; width: 100%; min-width: 0; margin: 0; border: 1px solid #999; border-radius: 0; box-shadow: none; zoom: 1 !important; }
    .wcard-body { grid-template-columns: 1fr 175px; gap: 10px 12px; padding: 10px 12px; }
    .wc-tbl { font-size: 11.5px; }
    .wc-tbl th, .wc-tbl td { padding: 5px 7px; }
    .wc-notice p { font-size: 11px; line-height: 1.65; }
    .wc-photobox { height: 78px; }
    .wcard-head { padding: 9px 12px; }
    .wcard-foot { padding: 7px 12px 10px; }
    a[href]:after { content: none !important; }
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ============================================================
   移动端 App 化（仅屏幕，不影响打印 / 保修卡固定版式）
   ============================================================ */
@media screen and (max-width: 880px) {
    .cols, .imgrow, .grid2, .grid3 { grid-template-columns: 1fr; }
    body.bare { overflow-x: auto; }
}

@media screen and (max-width: 760px) {
    .wrap { padding: 14px 12px calc(var(--tabbar-h) + 34px); }
    .foot { display: none; }
    .page-title { font-size: 19px; margin: 2px 0 14px; gap: 8px; }
    .page-title .btn { font-size: 13px; padding: 7px 12px; }

    /* 顶栏精简：品牌 + 用户，导航移到底部标签栏 */
    .topbar { position: sticky; }
    .tb-inner { padding: 9px 13px; gap: 8px; flex-wrap: nowrap; }
    .brand { font-size: 15px; }
    .brand .sub { display: none; }
    .brand::before { width: 28px; height: 28px; border-radius: 8px; }
    .brand::after { width: 28px; height: 28px; line-height: 28px; border-radius: 8px; font-size: 13px; }
    .tb-user { margin-left: auto; font-size: 12px; }
    .mainnav { display: none; }

    /* 底部标签栏：5 个主入口 + 更多 */
    .tabbar {
        display: grid; grid-template-columns: repeat(5, 1fr);
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
        height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line);
        box-shadow: 0 -4px 18px rgba(24, 39, 75, .07);
        backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    }
    .tabbar a, .tabbar button {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
        color: var(--muted); font-size: 11px; line-height: 1.25; text-align: center;
        background: none; border: 0; padding: 6px 2px; font-family: inherit; cursor: pointer;
        text-decoration: none; -webkit-tap-highlight-color: transparent;
    }
    .tabbar .ni { display: block; width: 22px; height: 22px; }
    .tabbar a.on, .tabbar button.on { color: var(--brand); font-weight: 600; }
    .tabbar a.on .ni { stroke-width: 2.2; }
    .tabbar a:active, .tabbar button:active { background: var(--brand-weak); }

    /* “更多”抽屉 */
    .more-mask {
        display: none; position: fixed; inset: 0; z-index: 70;
        background: rgba(15, 18, 25, .4);
    }
    .more-mask.show { display: block; }
    .more-sheet {
        display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 71;
        background: #fff; border-radius: 18px 18px 0 0; padding: 8px 12px calc(20px + env(safe-area-inset-bottom, 0px));
        box-shadow: 0 -10px 36px rgba(15, 18, 25, .18);
    }
    .more-sheet.show { display: block; animation: sheetIn .2s ease-out; }
    .more-sheet::before {
        content: ""; display: block; width: 38px; height: 4px; border-radius: 4px;
        background: #d9dde4; margin: 4px auto 14px;
    }
    .more-sheet h3 { font-size: 13px; color: var(--muted); font-weight: 500; margin: 0 0 8px 6px; }
    .more-sheet a {
        display: flex; align-items: center; gap: 12px; padding: 12px 10px;
        border-radius: 10px; color: var(--ink); font-size: 15px; text-decoration: none;
    }
    .more-sheet a:active { background: var(--brand-weak); }
    .more-sheet a.on { color: var(--brand); font-weight: 600; background: var(--brand-weak); }
    .more-sheet .ni { display: block; width: 20px; height: 20px; color: var(--brand); }
    @keyframes sheetIn { from { transform: translateY(24px); opacity: .4; } to { transform: translateY(0); opacity: 1; } }

    /* 表格 → 卡片列表（data-label 由 app.js 自动从表头注入） */
    .tbl.auto-cards { display: block; overflow-x: visible; white-space: normal; }
    .tbl.auto-cards thead { display: none; }
    .tbl.auto-cards tbody, .tbl.auto-cards tr { display: block; width: 100%; }
    .tbl.auto-cards tr {
        background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
        padding: 8px 13px; margin-bottom: 10px; box-shadow: var(--shadow-sm);
    }
    .tbl.auto-cards tr:hover { background: #fff; }
    /* td 保持 block + 绝对定位字段名：无需改动 DOM，单元格内 <br>/<small>/链接都原样保留 */
    .tbl.auto-cards td {
        display: block; position: relative; min-width: 0; white-space: normal;
        border: 0; border-bottom: 1px dashed var(--line-soft);
        padding: 7px 0 7px 104px; text-align: left;
    }
    .tbl.auto-cards td:last-child { border-bottom: 0; }
    .tbl.auto-cards td::before {
        content: attr(data-label); position: absolute; left: 0; top: 7px; width: 96px;
        color: var(--muted); font-size: 12px; text-align: left; line-height: 1.7;
    }
    .tbl.auto-cards td[data-label=""]::before { display: none; }
    .tbl.auto-cards td[data-label=""] { padding-left: 0; }
    .tbl.auto-cards td[data-label=""] .row-ops { justify-content: flex-start; }

    /* 表单 / 筛选 / 按钮：触控友好 */
    .card { padding: 15px 14px; border-radius: var(--radius); }
    .card h2 { font-size: 15px; }
    .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat { padding: 12px 13px; }
    .stat b { font-size: 24px; }
    .btn { min-height: 42px; padding: 9px 15px; }
    .btn.sm { min-height: 34px; }
    .btn.lg { min-height: 48px; }
    input[type=text], input[type=password], input[type=number], input[type=date], input[type=url],
    input:not([type]), textarea, select { padding: 10px 12px; font-size: 16px; }
    form.filter { gap: 8px; }
    form.filter .search { flex: 1 1 100%; min-width: 0; }
    form.filter select { flex: 1 1 calc(50% - 8px); min-width: 0; }
    form.filter button, form.filter a { flex: 1 1 auto; }
    .grid2, .grid3 { gap: 10px; }
    .thumbs figure, .gallery figure, .thumbs img { width: calc(50% - 6px); }
    .gallery img { width: calc(50% - 6px); }
    .q-card { margin: 0 12px 22px; padding: 0 14px 16px; }
    .q-title { margin: 0 -14px 14px; padding: 13px 14px; }
    .q-form { flex-wrap: wrap; }
    .q-form input { flex: 1 1 100%; }
    .q-form .btn { flex: 1 1 100%; }
    .q-head { margin-top: 5vh; }
    .q-wx { width: 108px; height: 108px; }
    .login-box { margin-top: 7vh; }
    .img-view-body img { width: 88vw; }
}

@media screen and (max-width: 380px) {
    .tabbar a, .tabbar button { font-size: 10px; }
    .tabbar .ni { width: 20px; height: 20px; }
    .stats { gap: 8px; }
    .stat { padding: 10px 11px; }
    .stat b { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
