*, *::before, *::after { box-sizing: border-box; }

:root {
    --ink: #101c26;
    --ink-2: #46617a;
    --ink-3: #7c93a6;
    --line: #e2e8f0;
    --bg: #f2f5f8;
    --card: #ffffff;
    --nav: #0e2231;
    --nav-hover: #17313f;
    --accent: #0f8a7e;
    --accent-dark: #0b6b61;
    --accent-soft: #e6f5f2;
    --income: #15803d;
    --income-soft: #e8f7ee;
    --expense: #c2410c;
    --expense-soft: #fdeee7;
    --warn: #b45309;
    --danger: #b91c1c;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(16, 28, 38, .04), 0 12px 28px -18px rgba(16, 28, 38, .35);
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

body { display: flex; min-height: 100vh; }

/* hidden 属性统一生效（.field 等自带 display 的元素会盖掉浏览器默认的 [hidden]） */
[hidden] { display: none !important; }

/* ------------------------------------------------------------- 侧边栏 */
.sidebar {
    width: 208px;
    flex: 0 0 208px;
    background: var(--nav);
    color: #93a9ba;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px 16px;
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, #14b8a6, #0f766e);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    letter-spacing: .5px;
    flex: 0 0 34px;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { color: #eaf2f7; font-size: 15px; font-weight: 600; }
.brand-text span { color: #6f8b9e; font-size: 12px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav { padding: 8px 10px; flex: 1; overflow-y: auto; }
.nav-item {
    display: block;
    padding: 9px 14px;
    margin-bottom: 2px;
    border-radius: 9px;
    color: #93a9ba;
    text-decoration: none;
    font-size: 13.5px;
    transition: all .15s ease;
}
.nav-item:hover { background: var(--nav-hover); color: #dbe7ef; }
.nav-item.active { background: #123a44; color: #5eead4; font-weight: 600; }

.sidebar-foot {
    padding: 12px 18px 18px;
    border-top: 1px solid rgba(255, 255, 255, .07);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.who { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.who-name { color: #e3edf4; font-size: 13px; }
.who-role { color: #648293; font-size: 11px; }
.logout { color: #7f97a8; text-decoration: none; font-size: 12px; }
.logout:hover { color: #f87171; }

/* ------------------------------------------------------------- 主区域 */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 28px;
    background: rgba(255, 255, 255, .86);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
    flex-wrap: wrap;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 600; letter-spacing: .3px; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.period-form { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tilde { color: var(--ink-3); }

.content { padding: 22px 28px 48px; }

input[type="date"], input[type="text"], input[type="tel"], input[type="number"], input[type="password"],
input[type="search"], select, textarea {
    font-family: inherit;
    font-size: 13.5px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 7px 10px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    max-width: 100%;
}
input:focus, select:focus, textarea:focus {
    border-color: #7fd1c7;
    box-shadow: 0 0 0 3px rgba(15, 138, 126, .12);
}
textarea { resize: vertical; min-height: 62px; }

/* ------------------------------------------------------------- 卡片 */
.card {
    background: var(--card);
    border: 1px solid #e8eef4;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 18px;
    overflow: hidden;
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid #eef2f7;
    flex-wrap: wrap;
}
.card-head h2 { font-size: 14.5px; margin: 0; font-weight: 600; color: #1b2b3a; }
.card-head .sub { color: var(--ink-3); font-size: 12px; font-weight: 400; margin-left: 8px; }
.card-body { padding: 18px 20px; }
.card-body.flush { padding: 0; }

/* ------------------------------------------------------------- KPI */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.kpi {
    background: #fff;
    border: 1px solid #e8eef4;
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}
.kpi::after {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--accent);
    opacity: .8;
}
.kpi.income::after { background: var(--income); }
.kpi.expense::after { background: var(--expense); }
.kpi.warn::after { background: var(--warn); }
.kpi-label { font-size: 12.5px; color: var(--ink-3); margin-bottom: 6px; }
.kpi-value {
    font-size: 24px;
    font-weight: 650;
    letter-spacing: -.3px;
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
}
.kpi-value small { font-size: 12px; font-weight: 400; color: var(--ink-3); margin-left: 4px; }
.kpi-foot { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.kpi-value.pos { color: var(--income); }
.kpi-value.neg { color: var(--expense); }

/* ------------------------------------------------------------- 表格 */
.table-wrap { width: 100%; overflow-x: auto; }
table.tb { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tb th, table.tb td { padding: 10px 14px; text-align: left; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
table.tb th {
    font-weight: 500;
    color: var(--ink-3);
    font-size: 12px;
    background: #fbfcfe;
    letter-spacing: .4px;
    white-space: nowrap;
}
table.tb tbody tr:hover { background: #fafcfd; }
table.tb td.num, table.tb th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.tb tfoot td { background: #fbfcfe; font-weight: 600; border-top: 2px solid #eef2f7; }
table.tb .muted { color: var(--ink-3); }
.amt-in { color: var(--income); font-weight: 600; }
.amt-out { color: var(--expense); font-weight: 600; }
.row-tight td { padding: 7px 14px; }

/* ------------------------------------------------------------- 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 15px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all .15s ease;
    white-space: nowrap;
    background: #fff;
    color: var(--ink);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 4px 12px -6px rgba(15, 138, 126, .9); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-ghost { background: #fff; color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover { border-color: #cbd5e1; color: var(--ink); }
.btn-danger { background: #fff; color: var(--danger); border-color: #fbd5d5; }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 7px; }
.btn-link { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0 4px; font-size: 13px; font-family: inherit; }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--danger); }

/* ------------------------------------------------------------- 表单 */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px 18px;
}
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.field .hint { font-size: 11.5px; color: var(--ink-3); }
.field input, .field select, .field textarea { width: 100%; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 20px; padding-top: 16px; border-top: 1px solid #eef2f7; flex-wrap: wrap; }

.seg { display: flex; gap: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg input { display: none; }
.seg label {
    flex: 1;
    text-align: center;
    padding: 7px 12px;
    font-size: 13px;
    cursor: pointer;
    color: var(--ink-2);
    border-right: 1px solid var(--line);
    transition: all .15s;
    margin: 0;
    white-space: nowrap;
}
.seg label:last-child { border-right: none; }
.seg input:checked + label { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }

/* ------------------------------------------------------------- 提示 */
.flash {
    padding: 10px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 13.5px;
    border: 1px solid;
}
.flash.success { background: var(--income-soft); border-color: #bfe6ce; color: #14652f; }
.flash.error { background: #fef2f2; border-color: #fbd5d5; color: #991b1b; }
.flash.warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }

.empty {
    text-align: center;
    color: var(--ink-3);
    padding: 44px 20px;
    font-size: 13.5px;
}
.empty a { color: var(--accent); }

.tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    line-height: 18px;
    background: #eef2f7;
    color: var(--ink-2);
    white-space: nowrap;
}
.tag.income { background: var(--income-soft); color: var(--income); }
.tag.expense { background: var(--expense-soft); color: var(--expense); }
.tag.accent { background: var(--accent-soft); color: var(--accent-dark); }
.tag.warn { background: #fffbeb; color: var(--warn); }

/* ------------------------------------------------------------- 图表 */
.bars { display: flex; align-items: flex-end; gap: 18px; height: 180px; padding: 10px 4px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.bar-pair { display: flex; align-items: flex-end; gap: 3px; height: 140px; width: 100%; justify-content: center; }
.bar { width: 12px; border-radius: 4px 4px 2px 2px; min-height: 2px; position: relative; }
.bar.in { background: linear-gradient(180deg, #34d399, #10b981); }
.bar.out { background: linear-gradient(180deg, #fb923c, #f97316); }
.bar-label { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }
.legend .in { background: #10b981; }
.legend .out { background: #f97316; }

.progress-list { display: flex; flex-direction: column; gap: 12px; }
.progress-row { display: grid; grid-template-columns: 110px 1fr 90px; gap: 12px; align-items: center; font-size: 13px; }
.progress-row .name { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-row .amt { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }
.progress-track { height: 8px; background: #eef2f7; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #2dd4bf, #0f8a7e); }
.progress-fill.out { background: linear-gradient(90deg, #fdba74, #ea580c); }

/* ------------------------------------------------------------- 杂项 */
.page-actions { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.page-actions .spacer { flex: 1; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters .grow { flex: 1; min-width: 140px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 12px 20px; color: var(--ink-3); font-size: 12.5px; }
.pager a { color: var(--ink-2); text-decoration: none; padding: 4px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.pager a:hover { border-color: #cbd5e1; }
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }
.split-note { font-size: 12.5px; color: var(--ink-3); margin-top: 8px; }
.hr { height: 1px; background: #eef2f7; margin: 18px 0; border: 0; }
.text-right { text-align: right; }
.text-muted { color: var(--ink-3); }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }

/* 登录页 */
.auth-wrap { min-height: 100vh; width: 100%; display: flex; align-items: center; justify-content: center; padding: 30px 18px;
    background: radial-gradient(1200px 600px at 20% 0%, #0f766e 0%, #0b2537 48%, #0a1c29 100%); }
.auth-card { width: 100%; max-width: 380px; background: #fff; border-radius: 18px; padding: 32px 30px 28px;
    box-shadow: 0 30px 70px -30px rgba(0, 0, 0, .6); }
.auth-card h1 { font-size: 20px; margin: 0 0 4px; }
.auth-card .sub { color: var(--ink-3); font-size: 13px; margin-bottom: 22px; }
.auth-card .field { margin-bottom: 14px; }
.auth-card .btn { width: 100%; padding: 10px; margin-top: 8px; }
.auth-foot { margin-top: 18px; font-size: 12px; color: var(--ink-3); text-align: center; }
.auth-foot a { color: var(--ink-3); text-decoration: none; border-bottom: 1px dashed currentColor; }

/* 打印（对账单） */
@media print {
    .sidebar, .topbar, .page-actions, .no-print, .pager, .tabbar, .fab { display: none !important; }
    body { background: #fff; }
    .content { padding: 0; }
    .card { box-shadow: none; border-color: #ddd; break-inside: avoid; }
    table.tb th { background: #f5f5f5; }
}

/* 合伙人记账：付款方锁定提示 */
.payer-fixed {
    display: inline-block;
    padding: 9px 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f4f8fb;
    font-size: 14px;
    color: var(--ink);
}

/* 开卡佣金预估卡片 */.est-box {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid #cfe9e3;
    background: linear-gradient(135deg, #effaf7, #f5fbfd);
}
.est-line { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.est-line span { font-size: 13px; color: var(--ink-3); }
.est-line strong { font-size: 22px; color: var(--accent-dark); letter-spacing: .5px; }
.est-note { margin-top: 6px; font-size: 12px; color: var(--ink-3); line-height: 1.5; }

/* 「更多」功能菜单（手机端入口页） */
.m-menu {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.m-menu a {
    display: block;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    text-decoration: none;
    color: var(--ink);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.m-menu a:hover {
    border-color: var(--accent);
    box-shadow: 0 6px 16px -10px rgba(15, 138, 126, .6);
}
.m-menu a strong { display: block; font-size: 14.5px; margin-bottom: 4px; }
.m-menu a span { font-size: 12px; color: var(--ink-3); }
.m-menu a.wide { grid-column: 1 / -1; }
.m-menu a.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.m-menu a.accent span { color: rgba(255, 255, 255, .82); }

/* ------------------------------------------------------------ 记账凭证 */
.vch-list, .vch-preview { display: flex; gap: 10px; flex-wrap: wrap; }
.vch-list { margin-bottom: 10px; }
.vch-preview { margin-top: 10px; }
.vch-item { width: 82px; text-align: center; }
.vch-thumb {
    width: 82px; height: 82px; object-fit: cover; border-radius: 9px;
    border: 1px solid var(--line); background: #fff; display: block; margin: 0 auto;
}
.vch-file {
    display: flex; width: 82px; height: 82px; margin: 0 auto; align-items: center; justify-content: center;
    border: 1px dashed #c7d7e4; border-radius: 9px; background: #f4fafc;
    color: var(--ink-2); font-weight: 700; font-size: 13px; text-decoration: none;
}
.vch-del { display: block; margin-top: 4px; font-size: 12px; color: var(--ink-3); }
.vch-del input { vertical-align: -2px; }
.vch-name { display: block; margin-top: 3px; font-size: 11px; color: var(--ink-3); line-height: 1.35; word-break: break-all; }
.vch-badge {
    display: inline-block; margin-top: 5px; padding: 2px 9px; font-size: 11.5px;
    border-radius: 99px; background: var(--accent-soft); border: 1px solid #cfe8e4;
    color: var(--accent-dark); text-decoration: none;
}

/* 凭证页内预览弹层 */
.vch-open { cursor: zoom-in; text-decoration: none; }
.vch-modal {
    position: fixed; inset: 0; z-index: 90; padding: 18px;
    background: rgba(8, 20, 28, .86);
    display: flex; align-items: center; justify-content: center;
}
.vch-modal[hidden] { display: none; }
.vch-modal-box {
    position: relative; max-width: min(94vw, 900px); max-height: 90vh;
    padding: 10px; background: #fff; border-radius: 12px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}
.vch-modal-box img {
    display: block; max-width: 100%; max-height: 82vh; margin: 0 auto;
    border-radius: 6px;
}
.vch-modal-box iframe {
    display: block; width: min(88vw, 860px); height: 80vh;
    border: 0; border-radius: 6px; background: #f4f7fa;
}
.vch-modal-close {
    position: absolute; top: -14px; right: -10px; width: 34px; height: 34px;
    border: 0; border-radius: 50%; background: #fff; color: var(--ink);
    font-size: 22px; line-height: 1; cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
}
body.vch-lock { overflow: hidden; }
@media (max-width: 640px) {
    .vch-modal { padding: 10px; }
    .vch-modal-close { top: -10px; right: -4px; }
    .vch-modal-box iframe { width: 92vw; height: 78vh; }
}

/* ============================================================ H5 适配 */
/* 底部导航 + 悬浮记账按钮（仅手机端显示） */
.tabbar { display: none; }

@media (max-width: 820px) {
    /* 登录 / 免登录登记：取消整屏垂直居中，避免表单较短时底部出现大片空白 */
    .auth-wrap {
        min-height: 100vh;
        align-items: center;
        padding: 18px 12px calc(18px + env(safe-area-inset-bottom));
    }
    .auth-card { padding: 24px 18px 22px; border-radius: 14px; margin: auto; }
    .auth-card h1 { font-size: 19px; }

    body {
        display: block;
        padding-bottom: 0;
        -webkit-tap-highlight-color: transparent;
    }

    .sidebar { display: none; }

    .topbar {
        padding: 10px 14px;
        position: sticky;
        top: 0;
        gap: 8px;
        flex-wrap: wrap;
    }
    .topbar h1 { font-size: 16px; }
    .topbar-right { flex: 1 1 100%; width: 100%; min-width: 0; }
    .period-form { width: 100%; }
    .period-form input[type="date"] { flex: 1; min-width: 0; padding: 7px 8px; font-size: 15px; }
    .period-form .tilde { display: none; }
    .period-form .btn { flex: 0 0 auto; }

    .content { padding: 12px 14px calc(58px + env(safe-area-inset-bottom)); }

    .kpi-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
    .kpi { padding: 10px 12px; border-radius: 12px; }
    .kpi-label { font-size: 11.5px; margin-bottom: 3px; line-height: 1.35; }
    .kpi-value { font-size: 18px; }
    .table-wrap .tb th, .table-wrap .tb td { padding: 8px 6px; font-size: 12.5px; }
    .kpi-value small { font-size: 11px; }
    .kpi-foot { font-size: 11px; line-height: 1.4; margin-top: 4px; }

    .card { margin-bottom: 12px; border-radius: 12px; }
    .card-head { padding: 11px 14px; }
    .card-head h2 { font-size: 14px; }
    .card-body { padding: 13px; }

    .two-col { grid-template-columns: 1fr; gap: 12px; }

    /* 表单：单列 + 大点击区 + 16px 字号（防 iOS 自动缩放） */
    .form-grid { grid-template-columns: 1fr !important; gap: 12px; }
    input[type="date"], input[type="text"], input[type="tel"], input[type="number"], input[type="password"],
    input[type="search"], select, textarea { font-size: 16px; padding: 9px 11px; }
    .btn { padding: 10px 15px; font-size: 14px; }
    .btn-sm { padding: 7px 12px; font-size: 13px; }
    .form-actions { flex-direction: column; align-items: stretch; gap: 8px; }
    .form-actions .btn { width: 100%; }
    .form-actions .hint { text-align: center; }

    .seg { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .seg label { flex: 1 0 auto; padding: 9px 12px; font-size: 13px; white-space: nowrap; }

    /* 自定义分摊输入框在手机上占满整格 */
    input[name^="split_custom"] { width: 100% !important; max-width: 100%; }

    .filters { gap: 8px; }
    .filters select, .filters input { flex: 1 1 46%; min-width: 0; }
    .filters .btn { flex: 1 1 46%; }
    .filters .grow { flex: 1 1 100%; }

    .page-actions { gap: 8px; }
    .page-actions .btn { flex: 1 1 auto; }
    .page-actions .spacer { display: none; }

    .progress-row { grid-template-columns: 76px 1fr 74px; gap: 8px; font-size: 12.5px; }
    .bars { gap: 10px; height: 150px; }
    .bar-pair { height: 110px; }
    .bar { width: 10px; }

    .pager { justify-content: center; padding: 12px; }

    /* 表格 → 卡片列表（给 .tb-m 的表格使用） */
    .tb-m thead { display: none; }
    .tb-m tbody tr {
        display: block;
        margin: 10px;
        padding: 11px 13px;
        border: 1px solid #e8eef4;
        border-radius: 12px;
        background: #fff;
    }
    .tb-m tbody tr:hover { background: #fff; }
    .tb-m tbody td {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 12px;
        border: none;
        padding: 3px 0;
        text-align: right;
    }
    .tb-m tbody td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        color: var(--ink-3);
        font-size: 12px;
        text-align: left;
    }
    .tb-m tbody td.num { text-align: right; }
    .tb-m tbody td:first-child { font-size: 14.5px; }
    .tb-m tbody td:first-child::before { display: none; }
    .tb-m tbody td:first-child { justify-content: flex-start; }
    /* 合计行保留，做成汇总卡片 */
    .tb-m tfoot tr {
        display: block;
        margin: 4px 10px 12px;
        padding: 10px 13px;
        border: 1px solid #dbe6ef;
        border-radius: 12px;
        background: #f6fafc;
        font-weight: 600;
    }
    .tb-m tfoot td {
        display: flex;
        justify-content: space-between;
        border: none;
        padding: 3px 0;
        text-align: right;
    }
    .tb-m tfoot td::before {
        content: attr(data-label);
        color: var(--ink-3);
        font-size: 12px;
        font-weight: 400;
    }
    .tb-m tfoot td:first-child { font-weight: 700; }
    .tb-m + .table-wrap, .tb-m .table-wrap { overflow: visible; }

    /* 宽表仍可横向滑动，但给出边界提示 */
    .table-wrap { -webkit-overflow-scrolling: touch; }
    table.tb { font-size: 13px; }

    /* 底部导航 */
    .tabbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 60;
        display: flex;
        background: rgba(255, 255, 255, .97);
        backdrop-filter: blur(10px);
        border-top: 1px solid var(--line);
        padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
    }
    .tabbar a {
        flex: 1;
        text-align: center;
        text-decoration: none;
        color: #7c93a6;
        font-size: 13px;
        padding: 7px 2px 5px;
        border-radius: 9px;
        line-height: 1.2;
    }
    .tabbar a.active { color: var(--accent-dark); font-weight: 600; }
    .tabbar a.active::after {
        content: "";
        display: block;
        width: 18px;
        height: 2px;
        margin: 5px auto 0;
        border-radius: 2px;
        background: var(--accent);
    }

    /* 悬浮记账按钮 */
    .fab {
        position: fixed;
        right: 16px;
        bottom: calc(78px + env(safe-area-inset-bottom));
        z-index: 61;
        width: 54px;
        height: 54px;
        border-radius: 50%;
        background: var(--accent);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 26px;
        line-height: 1;
        text-decoration: none;
        box-shadow: 0 10px 24px -8px rgba(15, 138, 126, .95);
    }
    .fab:active { transform: scale(.94); }

    .auth-card { padding: 26px 20px 22px; border-radius: 16px; }

    .m-menu { grid-template-columns: 1fr 1fr; gap: 9px; }
    .m-menu a { padding: 13px 12px; }
    .m-menu a strong { font-size: 14px; }
}

@media (max-width: 340px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .kpi-value { font-size: 18px; }
    .tabbar a { font-size: 12px; }
}

/* 身份证拍照识别 */
.idcap { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.idcap input[type="file"] {
    flex: 1 1 220px;
    padding: 9px 10px;
    border: 1px dashed #c5d3da;
    border-radius: 10px;
    background: #fbfdfe;
    font-size: 14px;
    max-width: 100%;
}
.idcap-preview img { max-height: 96px; border-radius: 8px; border: 1px solid var(--line); display: block; }
.mask-note { font-size: 12px; color: var(--ink-3); }

/* -------------------------------------------- 开卡：办理业务（宽带 / 终端） */
.subbox {
    margin-top: 10px;
    padding: 12px 14px 4px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg);
}
.subbox .form-grid { gap: 12px; }
.seg.seg-yes { max-width: 190px; }
.seg.seg-two { max-width: 320px; }
.seg.seg-three { max-width: 520px; }
.chk-row { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 6px; }
.chk {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13.5px;
    color: var(--ink-2);
    cursor: pointer;
}
.chk input { width: 16px; height: 16px; accent-color: var(--accent); }
@media (max-width: 820px) {
    .seg.seg-yes, .seg.seg-two, .seg.seg-three { max-width: none; }
    .subbox { padding: 12px 12px 2px; }
}

/* 套餐页工具行 */
.tool-row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 6px; }
.tool-inline { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tool-inline select { width: auto; min-width: 88px; }
.hint { font-size: 11.5px; color: var(--ink-3); }
@media (max-width: 820px) {
    .tool-inline { width: 100%; }
}

/* 必填标记 */
.req { color: #d93a3a; font-style: normal; font-weight: 700; margin-left: 3px; }

/* 分组标题 + 可折叠的高级设置 */
.section-title { margin: 26px 2px 10px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.section-title small { margin-left: 8px; font-weight: 400; color: var(--ink-3); }
details.adv { background: var(--card); border: 1px solid #e8eef4; border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
details.adv > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 14px 16px; cursor: pointer; font-weight: 600; color: var(--ink); }
details.adv > summary::-webkit-details-marker { display: none; }
details.adv > summary::after { content: '展开'; margin-left: auto; font-size: 12px; font-weight: 500; color: var(--accent); }
details.adv[open] > summary::after { content: '收起'; }
details.adv[open] > summary { border-bottom: 1px solid var(--line); }
details.adv .card-body { padding: 14px 16px 4px; }

/* 长列表限高滚动，避免条目一多把下面的功能挤下去 */
.list-scroll { max-height: 340px; overflow: auto; }
.list-scroll thead th { position: sticky; top: 0; background: var(--card); z-index: 2; }

/* 锚点跳转时留出顶部条的高度 */
#shop, #ocr, #acc, #cat, #user,
#acc-form, #cat-form, #user-form { scroll-margin-top: 76px; }

/* 操作提示改成浮动气泡，保存后跳到原处也能看到结果 */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 26px; z-index: 60; display: flex; flex-direction: column; gap: 8px; width: max-content; max-width: 92vw; }
.toasts .flash { margin: 0; box-shadow: 0 10px 26px -16px rgba(16, 28, 38, .45); }
@media (max-width: 860px) {
    .toasts { bottom: 78px; max-width: calc(100vw - 28px); width: auto; }
    .list-scroll { max-height: 300px; }
}

/* ==== 装成 APP（PWA）相关 ==== */
.pwa-tip {
    margin-top: 10px;
    font-size: 12.5px;
    line-height: 1.7;
    color: #47657a;
    background: #f2f8fb;
    border: 1px solid #dfeef6;
    border-radius: 10px;
    padding: 9px 11px;
}
@media (display-mode: standalone) {
    /* 全屏 APP 模式：底部留白只由内容区控制，避免双重空白 */
    body { padding-bottom: 0; }
}
html { overscroll-behavior-y: contain; }
@media (max-width: 820px) {
    .btn, .seg label, .tabbar a { min-height: 44px; }
    .btn-sm { min-height: 36px; }
    .btn-link { min-height: 36px; padding: 8px 6px; }
    .nav-item { -webkit-tap-highlight-color: transparent; }
    /* iOS 输入框圆角与内阴影统一 */
    input[type="text"], input[type="tel"], input[type="number"], input[type="password"], input[type="search"],
    input[type="date"], select, textarea, .tl { -webkit-appearance: none; border-radius: 10px; }
}

/* 选择门店（老板多店登录后） */
.shop-pick { display: flex; flex-direction: column; gap: 10px; }
.shop-pick-item { display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left;
    padding: 14px 16px; border: 1px solid var(--line, #d8e2ea); border-radius: 12px; background: #f7fafc;
    cursor: pointer; font: inherit; color: inherit; }
.shop-pick-item strong { font-size: 15px; }
.shop-pick-item span { font-size: 12px; color: var(--ink-3, #6f8b9e); }
.shop-pick-item.on { border-color: var(--accent, #0f7c8c); background: #eef8fa; }
.brand-shop { color: inherit; text-decoration: none; }
.brand-shop:hover { color: #cfe6ee; text-decoration: underline; }

/* 记账流水：顶部汇总小条 */
.sum-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.sum-chip { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 4px 9px;
    font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.sum-chip b { margin-left: 5px; color: var(--ink-2); font-weight: 600; }
.sum-chip b.amt-in { color: var(--income); }
.sum-chip b.amt-out { color: var(--expense); }
.tx-cards { display: none; }

@media (max-width: 820px) {
    /* 流水：桌面表格隐藏，换成两行卡片 */
    .tx-desk { display: none !important; }
    .tx-cards { display: flex; flex-direction: column; gap: 8px; padding: 10px 10px 4px; }
    .tx { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px 7px; }
    .tx-head { display: flex; align-items: baseline; gap: 7px; }
    .tx-head .tag { flex: 0 0 auto; font-size: 11px; padding: 1px 6px; }
    .tx-cat { flex: 1 1 auto; min-width: 0; font-size: 14.5px; font-weight: 600; color: var(--ink);
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .tx-amt { flex: 0 0 auto; font-size: 16px; font-weight: 700; letter-spacing: -.2px; }
    .tx-meta { display: flex; align-items: center; gap: 8px; margin-top: 2px; font-size: 12px; color: var(--ink-3); }
    .tx-info { display: flex; flex-wrap: wrap; gap: 2px 5px; flex: 1 1 auto; min-width: 0; }
    .tx-info .dot { opacity: .6; }
    .tx-act { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; }
    .tx-act a, .tx-act button { min-height: 30px; padding: 5px 0; font-size: 12.5px; }
    .tx-memo { margin-top: 3px; font-size: 12.5px; color: var(--ink-2); line-height: 1.45; word-break: break-word; }
    .tx-qty { margin-left: 6px; color: var(--ink-3); }
    .sum-chip { flex: 1 1 44%; justify-content: space-between; display: flex; padding: 6px 10px; }
}

/* 筛选折叠（手机端默认收起，桌面端隐藏 summary 一直展开） */
.filter-box > summary { display: none; }
@media (max-width: 820px) {
    .filter-box > summary { display: flex; align-items: center; justify-content: space-between;
        padding: 11px 13px; font-size: 13.5px; color: var(--ink-2); font-weight: 600; cursor: pointer; }
    .filter-box > summary span { font-size: 12px; color: var(--ink-3); font-weight: 400; }
    .filter-box > summary::-webkit-details-marker { display: none; }
    .filter-box > summary::after { content: "展开"; font-size: 12px; color: var(--accent); font-weight: 400; }
    .filter-box[open] > summary::after { content: "收起"; }
    .filter-box[open] > summary { border-bottom: 1px solid #eef2f7; }
    .filter-box .filters { padding: 12px 13px; margin-bottom: 0; }
    .filter-box .filters input[type="date"] { display: none; }
    .filter-box .card-body { padding: 0; }
    /* 卡片防溢出 */
    .tx, .tx-head { max-width: 100%; overflow: hidden; }
    .tx-amt { max-width: 52%; overflow: hidden; text-overflow: ellipsis; }
}

/* ============================================================ 库存 / 收银 */
.text-green { color: var(--income); }
.text-danger { color: var(--danger); }
.badge {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 2px 7px; border-radius: 999px; font-size: 11px; line-height: 1.5;
    background: #f1f5f9; color: #475569; white-space: nowrap;
}
.badge-green { background: var(--income-soft); color: var(--income); }
.badge-red { background: #fef2f2; color: var(--danger); }
.badge-orange { background: var(--expense-soft); color: var(--expense); }
.badge-blue { background: #eff6ff; color: #1d4ed8; }
.badge-gray { background: #f1f5f9; color: #64748b; }
.badge-purple { background: #f5f3ff; color: #6d28d9; }
.badge-soft { background: var(--accent-soft); color: var(--accent-dark); }
.row-off { opacity: .62; }
.actions-cell { white-space: nowrap; }
.actions-cell .btn { margin-left: 2px; }
.inline-form { display: inline-block; margin: 0; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.check-line {
    display: flex; align-items: center; gap: 8px; margin: 12px 14px 0;
    font-size: 12.5px; color: var(--ink-2); cursor: pointer; user-select: none;
}
.check-line input { width: auto; }
.btn-block { display: block; width: calc(100% - 28px); margin: 12px 14px 0; text-align: center; }
.inv-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.inv-kpis .kpi-value { font-size: 22px; }
.seg-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.seg-tabs .seg {
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line);
    background: #fff; color: var(--ink-2); font-size: 13px; text-decoration: none;
}
.seg-tabs .seg.active { background: var(--accent-soft); border-color: #bfe6df; color: var(--accent-dark); font-weight: 600; }
.hint-box {
    margin-top: 14px; padding: 12px 16px; border-radius: 10px;
    background: #f8fafc; border: 1px solid #e8eef4; color: var(--ink-3); font-size: 12.5px; line-height: 1.7;
}

/* 收银台 */
.pos-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 16px; align-items: start; }
.pos-main { overflow: hidden; }
.pos-searchbar { padding: 14px 18px; border-bottom: 1px solid #eef2f7; }
.pos-searchbar input {
    width: 100%; padding: 10px 13px; border: 1px solid var(--line); border-radius: 9px;
    font-size: 14px; outline: none; background: #fff;
}
.pos-searchbar input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 138, 126, .12); }
.pos-cats { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.pos-cats .seg {
    display: inline-flex; align-items: center; gap: 4px; padding: 5px 11px;
    border: 1px solid var(--line); border-radius: 999px; background: #fff;
    color: var(--ink-2); font-size: 12.5px; cursor: pointer;
}
.pos-cats .seg.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pos-cats .seg small { opacity: .7; }
.pos-products {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px; padding: 16px 18px;
}
.pos-product {
    display: flex; flex-direction: column; gap: 4px; text-align: left;
    min-height: 104px; padding: 12px 12px 10px; border: 1px solid #e3ebf2;
    border-radius: 10px; background: #fff; cursor: pointer; color: var(--ink);
    font-family: inherit; transition: all .15s ease;
}
.pos-product:hover { border-color: #9dd9d0; box-shadow: 0 6px 18px -10px rgba(15, 138, 126, .45); transform: translateY(-1px); }
.pos-product.sold-out { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.pos-p-name { font-weight: 600; font-size: 14px; line-height: 1.35; word-break: break-all; }
.pos-p-spec { font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos-p-foot { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; margin-top: auto; }
.pos-p-price { color: var(--expense); font-weight: 700; font-size: 15px; }
.pos-p-price::before { content: '¥'; font-size: 11px; margin-right: 1px; }
.pos-p-stock { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.pos-p-cat { font-size: 10.5px; color: var(--accent-dark); background: var(--accent-soft); border-radius: 4px; padding: 1px 5px; align-self: flex-start; margin-top: 2px; }

.pos-side { position: sticky; top: 78px; padding: 0; overflow: hidden; }
.pos-cart-head { display: flex; align-items: center; gap: 8px; padding: 13px 14px; border-bottom: 1px solid #eef2f7; }
.pos-cart-head h2 { font-size: 15px; margin: 0; }
.pos-cart-head .sub { color: var(--ink-3); font-size: 12px; }
.pos-cart-head .btn { margin-left: auto; }
.pos-cart { max-height: 38vh; overflow-y: auto; padding: 6px 14px; }
.pos-cart-empty { padding: 26px 0; text-align: center; color: var(--ink-3); font-size: 12.5px; }
.pos-cart-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 9px 0; border-bottom: 1px dashed #edf2f7; align-items: center; }
.pos-cart-row:last-child { border-bottom: 0; }
.pos-ci-main { min-width: 0; }
.pos-ci-main strong { display: block; font-size: 13px; line-height: 1.3; word-break: break-all; }
.pos-ci-price { font-size: 11px; color: var(--ink-3); }
.pos-ci-qty { display: inline-flex; align-items: center; gap: 2px; }
.pos-ci-qty button {
    width: 26px; height: 26px; border: 1px solid var(--line); background: #fff;
    border-radius: 6px; cursor: pointer; color: var(--ink-2); font-size: 15px; line-height: 1;
}
.pos-ci-qty input { width: 48px; height: 26px; text-align: center; padding: 0 2px; font-size: 12.5px; border: 1px solid var(--line); border-radius: 6px; }
.pos-ci-sub { font-size: 12.5px; font-weight: 600; color: var(--income); }
.pos-ci-del { grid-row: 1 / span 2; grid-column: 2; align-self: start; border: 0; background: none; color: var(--ink-3); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px; }
.pos-ci-del:hover { color: var(--danger); }
.pos-total { padding: 12px 14px; border-top: 1px solid #eef2f7; background: #fbfdfe; }
.pos-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: 12.5px; color: var(--ink-2); }
.pos-line strong { font-size: 14px; color: var(--ink); }
.pos-discount input { width: 92px; height: 30px; text-align: right; padding: 0 6px; font-size: 13px; border: 1px solid var(--line); border-radius: 6px; }
.pos-pay strong { font-size: 20px; }
.pos-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 10px 14px 0; }
.pos-fields .field span { font-size: 11.5px; }
.pos-fields .field input, .pos-fields .field select { padding: 7px 8px; font-size: 12.5px; }
.pos-fields .field:nth-child(3), .pos-fields .field:nth-child(4) { grid-column: 1 / -1; }
.pos-submit { padding: 11px; font-size: 15px; font-weight: 600; border-radius: 9px; }
.pos-submit:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.pos-hint { padding: 8px 14px 13px; color: var(--ink-3); font-size: 11.5px; line-height: 1.6; }
.pos-today { font-size: 13px; color: var(--ink-2); }
.pos-today strong { color: var(--expense); font-size: 17px; }

/* 小票 */
.receipt-wrap { max-width: 520px; margin: 0 auto; }
.receipt { padding: 22px 24px 18px; }
.receipt-head { text-align: center; border-bottom: 1px dashed #dbe5ee; padding-bottom: 12px; position: relative; }
.receipt-shop { font-size: 16px; font-weight: 700; }
.receipt-title { font-size: 12px; color: var(--ink-3); letter-spacing: 2px; margin-top: 2px; }
.receipt-void { position: absolute; right: 0; top: 6px; color: var(--danger); border: 1px solid #fecaca; background: #fef2f2; border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 700; }
.receipt-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--ink-3); padding: 8px 0; border-bottom: 1px dashed #dbe5ee; }
.receipt-items { padding: 8px 0; }
.receipt-row { display: grid; grid-template-columns: minmax(0, 1fr) 52px 92px; gap: 8px; padding: 6px 0; font-size: 12.5px; align-items: center; }
.receipt-row span:nth-child(2), .receipt-row span:nth-child(3) { text-align: right; }
.receipt-row small { display: block; color: var(--ink-3); font-size: 10.5px; margin-top: 1px; }
.receipt-row-head { color: var(--ink-3); font-size: 11px; border-bottom: 1px solid #eef2f7; }
.receipt-total { border-top: 1px dashed #dbe5ee; padding-top: 8px; font-size: 12.5px; }
.receipt-total > div { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.receipt-pay { font-size: 15px; font-weight: 700; color: var(--income); margin-top: 4px; }
.receipt-pay strong { font-size: 22px; }
.receipt-profit { color: var(--ink-3); }
.receipt-foot { border-top: 1px dashed #dbe5ee; margin-top: 10px; padding-top: 9px; font-size: 11px; color: var(--ink-3); line-height: 1.7; }
.receipt-foot a { color: var(--accent); }

@media (max-width: 960px) {
    .pos-wrap { grid-template-columns: 1fr; }
    .pos-side { position: static; }
    .pos-cart { max-height: none; }
    .inv-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .pos-products { grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px; }
    .pos-product { min-height: 96px; padding: 10px; }
    .pos-p-name { font-size: 13px; }
    .pos-p-price { font-size: 14px; }
    .inv-kpis { grid-template-columns: 1fr 1fr; }
    .inv-kpis .kpi:last-child { grid-column: 1 / -1; }
    .pos-fields { grid-template-columns: 1fr; }
    .pos-fields .field:nth-child(3), .pos-fields .field:nth-child(4) { grid-column: auto; }
    .receipt-wrap { max-width: none; }
    .receipt { padding: 18px 14px 14px; }
    .receipt-row { grid-template-columns: minmax(0, 1fr) 42px 80px; gap: 6px; }
    .receipt-void { position: static; display: inline-block; margin-top: 6px; }
}

/* ============================================================ 会员 */
.pos-member { padding: 10px 14px 0; }
.pos-member-label { display: block; margin-bottom: 5px; font-size: 11.5px; color: var(--ink-3); }
.pos-member-search input {
    width: 100%; padding: 7px 9px; font-size: 12.5px; border: 1px solid var(--line);
    border-radius: 8px; outline: none; background: #fff;
}
.pos-member-search input:focus { border-color: #c4b5fd; box-shadow: 0 0 0 3px rgba(139, 92, 246, .10); }
.pos-member-picked {
    display: flex; flex-direction: column; gap: 3px; padding: 8px 10px;
    background: #faf5ff; border: 1px solid #e9d5ff; border-radius: 9px;
}
.pos-member-picked[hidden], .pos-member-search[hidden], .member-results[hidden] { display: none !important; }
.member-picked-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.member-picked-line strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-clear { margin-left: auto; border: 0; background: none; color: #7c3aed; font-size: 12px; cursor: pointer; padding: 2px 0; }
.member-picked-meta { display: flex; gap: 12px; color: var(--ink-3); font-size: 11.5px; }
.member-hint { min-height: 17px; margin-top: 5px; color: #7c3aed; font-size: 11.5px; line-height: 1.5; }
.member-results { margin-top: 5px; border: 1px solid #e9d5ff; border-radius: 9px; background: #fff; max-height: 230px; overflow-y: auto; }
.member-result {
    display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 8px 10px;
    border: 0; border-bottom: 1px dashed #f1e8ff; background: #fff; text-align: left;
    font-family: inherit; cursor: pointer;
}
.member-result:last-child { border-bottom: 0; }
.member-result:hover { background: #faf5ff; }
.member-result-main { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); }
.member-result-meta { font-size: 11.5px; color: var(--ink-3); }
.member-result-empty { padding: 12px; text-align: center; font-size: 12px; color: var(--ink-3); }

.member-profile { margin-bottom: 16px; }
.member-profile-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.member-profile-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 20px; font-weight: 650; }
.member-profile-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; font-size: 12px; color: var(--ink-3); }
.member-profile-points { text-align: right; white-space: nowrap; }
.member-profile-points span { display: block; font-size: 11.5px; color: var(--ink-3); }
.member-profile-points strong { font-size: 28px; color: #7c3aed; line-height: 1.2; }
.member-profile-note { margin-top: 12px; padding: 8px 11px; border-radius: 8px; background: #faf5ff; color: #6b21a8; font-size: 12.5px; line-height: 1.6; }
.receipt-member { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px dashed #dbe5ee; font-size: 11.5px; color: #6d28d9; }

@media (max-width: 640px) {
    .member-profile-head { align-items: flex-start; }
    .member-profile-points strong { font-size: 24px; }
    .member-picked-meta { gap: 8px; }
}

/* 会员次卡 */
.pos-cards { margin-top: 8px; }
.pos-cards-label { margin-bottom: 5px; font-size: 11.5px; color: var(--ink-3); }
.pos-card-list { display: flex; flex-direction: column; gap: 6px; max-height: 150px; overflow-y: auto; }
.pos-card-item {
    display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 7px 9px;
    border: 1px solid #dbeafe; border-radius: 8px; background: #f8fbff; text-align: left;
    font-family: inherit; cursor: pointer; color: var(--ink);
}
.pos-card-item:hover { border-color: #93c5fd; background: #eff6ff; }
.pos-card-item.active { border-color: #2563eb; background: #eff6ff; box-shadow: 0 0 0 2px rgba(37, 99, 235, .12); }
.pos-card-item:disabled { opacity: .55; cursor: not-allowed; }
.pos-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pos-card-top strong { font-size: 12.5px; }
.pos-card-rem { color: #1d4ed8; font-size: 11.5px; white-space: nowrap; }
.pos-card-sub { color: var(--ink-3); font-size: 11px; line-height: 1.45; }
.pos-card-empty { padding: 8px 10px; border: 1px dashed #dbeafe; border-radius: 8px; color: var(--ink-3); font-size: 11.5px; background: #fbfdff; }
.pos-card-cover { color: #1d4ed8; }
.pos-card-cover strong { color: #1d4ed8; }

.m-card-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; padding: 14px 16px; }
.m-card-item { border: 1px solid #e2e8f0; border-radius: 10px; padding: 11px 12px; background: #fff; }
.m-card-item.m-card-off { background: #f8fafc; opacity: .8; }
.m-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.m-card-top strong { font-size: 14px; }
.m-card-sub { margin-top: 4px; color: var(--ink-3); font-size: 11.5px; line-height: 1.5; }
.m-card-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; color: var(--ink-2); font-size: 12px; }
.m-card-foot strong { color: #1d4ed8; font-size: 16px; }
.m-card-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }

.receipt-card {
    display: flex; justify-content: space-between; gap: 8px; padding: 7px 0;
    border-bottom: 1px dashed #dbe5ee; font-size: 11.5px; color: #1d4ed8;
}
.receipt-note { color: var(--ink-3); font-size: 10.5px; line-height: 1.5; }

@media (max-width: 640px) {
    .m-card-list { grid-template-columns: 1fr; padding: 12px; }
    .pos-card-list { max-height: 180px; }
}

/* 手机摄像头扫码 */
.pos-search-row { display: flex; gap: 8px; align-items: stretch; }
.pos-search-row input { flex: 1 1 auto; min-width: 0; width: auto; }
.pos-scan-btn {
    flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    min-width: 78px; padding: 0 13px; border: 1px solid var(--accent); border-radius: 9px;
    background: var(--accent); color: #fff; font-family: inherit; font-size: 13px; font-weight: 600;
    cursor: pointer; transition: background .15s, box-shadow .15s;
}
.pos-scan-btn:hover { background: var(--accent-dark); }
.pos-scan-btn:active { transform: translateY(1px); }
.pos-scan-btn svg { width: 18px; height: 18px; flex: 0 0 18px; }
body.scan-open { overflow: hidden; }
.scan-modal {
    position: fixed; inset: 0; z-index: 10050; display: flex; align-items: center; justify-content: center;
    padding: 18px; background: rgba(7, 17, 25, .78); backdrop-filter: blur(3px);
}
.scan-panel {
    width: min(560px, 100%); max-height: calc(100vh - 36px); display: flex; flex-direction: column;
    overflow: hidden; border-radius: 16px; background: #0b1620; color: #e8f1f7;
    box-shadow: 0 24px 70px -20px rgba(0, 0, 0, .8);
}
.scan-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 10px; }
.scan-head strong { display: block; font-size: 16px; }
.scan-sub { display: block; margin-top: 2px; color: #93a9ba; font-size: 11.5px; }
.scan-close {
    width: 34px; height: 34px; flex: 0 0 34px; border: 0; border-radius: 50%;
    background: rgba(255, 255, 255, .1); color: #fff; font-size: 22px; line-height: 1; cursor: pointer;
}
.scan-stage { position: relative; margin: 0 12px; border-radius: 12px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.scan-stage video { display: block; width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; inset: 13% 8%; border: 2px solid rgba(255, 255, 255, .9); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .28); pointer-events: none; }
.scan-frame::before, .scan-frame::after { content: ''; position: absolute; left: 16%; right: 16%; height: 2px; background: rgba(239, 68, 68, .85); animation: scanline 1.5s ease-in-out infinite; }
.scan-frame::before { top: 28%; }
.scan-frame::after { top: 72%; animation-delay: -.75s; }
.scan-frame span { position: absolute; left: 50%; top: 50%; width: 46%; height: 2px; background: #34d399; box-shadow: 0 0 12px #34d399; transform: translate(-50%, -50%); }
@keyframes scanline { 0%, 100% { opacity: .25; transform: translateY(-7px); } 50% { opacity: 1; transform: translateY(7px); } }
.scan-status { position: absolute; left: 50%; bottom: 12px; max-width: calc(100% - 24px); padding: 6px 12px; border-radius: 999px; background: rgba(3, 12, 19, .72); color: #dbeafe; font-size: 11.5px; text-align: center; transform: translateX(-50%); }
.scan-foot { display: flex; align-items: center; gap: 8px; padding: 10px 14px 4px; }
.scan-tip { flex: 1 1 auto; color: #93a9ba; font-size: 11px; line-height: 1.5; }
.scan-error { margin: 0 14px 14px; padding: 9px 12px; border: 1px solid rgba(248, 113, 113, .45); border-radius: 9px; background: rgba(127, 29, 29, .35); color: #fecaca; font-size: 12px; line-height: 1.6; }
@media (max-width: 640px) {
    .scan-modal { padding: 0; align-items: flex-end; }
    .scan-panel { width: 100%; max-height: 100vh; height: 100vh; border-radius: 0; }
    .scan-stage { flex: 1 1 auto; aspect-ratio: auto; min-height: 0; margin: 0 10px; }
    .scan-head { padding-top: max(14px, env(safe-area-inset-top)); }
    .scan-foot { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
    .pos-scan-btn { min-width: 70px; padding: 0 10px; }
}

/* 会员等级设置 */
.member-level-tip {
    margin-top: 12px; padding: 9px 12px; border: 1px solid #e0e7ff; border-radius: 9px;
    background: #f5f8ff; color: #46617a; font-size: 12px; line-height: 1.65;
}

/* 操作记录 */
.badge-red { background: #fee2e2; color: #b91c1c; }
.audit-who { font-size: 13px; font-weight: 600; color: var(--ink); }
.audit-role { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.audit-details summary { cursor: pointer; color: var(--accent-dark); font-size: 12px; }
.audit-detail {
    margin: 8px 0 0; padding: 10px 12px; background: #f8fafc; border: 1px solid #e2e8f0;
    border-radius: 8px; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px;
    font-size: 12px; line-height: 1.6; min-width: 220px;
}
.audit-detail dt { color: var(--ink-3); white-space: nowrap; }
.audit-detail dd { margin: 0; color: var(--ink); word-break: break-all; }
