/* assets/app.css —— 用户控制台与管理端共用样式 */

:root {
    --green: #07c160;
    --green-dark: #06ad56;
    --green-soft: #e9f9f0;
    --text: #1f2937;
    --muted: #6b7280;
    --muted-2: #9ca3af;
    --border: #e5e7eb;
    --bg: #f7f8fa;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --warn: #b45309;
    --warn-soft: #fffbeb;
    --info-soft: #eff6ff;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 8px 28px rgba(17, 24, 39, .07), 0 1px 4px rgba(17, 24, 39, .04);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
            "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    background-image: radial-gradient(circle at 50% 0%, #eef4ff 0%, var(--bg) 55%);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }

a { color: var(--green-dark); text-decoration: none; }

/* ================= 顶栏 ================= */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(229, 231, 235, .9);
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 1080px;
    margin: 0 auto;
    padding: 10px 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--text);
    flex-shrink: 0;
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4ade80, var(--green));
    box-shadow: 0 4px 12px rgba(7, 193, 96, .26);
}

.brand-mark svg { width: 17px; height: 17px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; }
.brand-text small { font-size: 10.5px; color: var(--muted-2); }

.nav { display: flex; align-items: center; gap: 4px; }

.nav-item {
    padding: 6px 13px;
    border-radius: 999px;
    font-size: 13px;
    color: #4b5563;
    white-space: nowrap;
    transition: background .15s, color .15s;
}

.nav-item:hover { background: #f3f4f6; }
.nav-item.active { background: var(--green-soft); color: var(--green-dark); font-weight: 600; }

.account {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
    flex-shrink: 0;
}

.account-name { color: var(--text); font-weight: 600; }
a.account-name:hover { color: var(--green-dark); }
.account-meta { color: var(--muted-2); }
.account-logout {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    font-size: 11.5px;
    transition: all .15s;
}
.account-logout:hover { border-color: #fca5a5; color: var(--danger); background: var(--danger-soft); }

/* ================= 页面容器 ================= */
.page {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 22px 16px 36px;
}

.page.wide { max-width: 1080px; }

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding: 0 2px;
}

.page-head h1 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.page-head p { margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.page-head-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ================= 卡片 ================= */
.card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow);
    margin-bottom: 14px;
}

.card.compact { padding: 16px 16px; }
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}
.card-head h2 { font-size: 15px; font-weight: 700; }
.card-head p { font-size: 12px; color: var(--muted); }

/* 可折叠卡片：右上角箭头 + 默认收起的内容区 */
.collapse-toggle {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: color .15s;
}
.collapse-toggle:hover { color: var(--text); }
.collapse-toggle:focus { outline: none; }
.collapse-toggle:focus-visible {
    outline: 2px solid rgba(7, 193, 96, .45);
    outline-offset: 1px;
}
.collapse-toggle svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2.2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .2s;
}
.collapse-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.card-collapse[hidden] { display: none; }

/* ================= 提示 ================= */
.flash, .alert {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 12px;
    border: 1px solid transparent;
}

.flash-success, .alert-success { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.flash-error, .alert-error { background: var(--danger-soft); color: #b91c1c; border-color: #fecaca; }
.flash-info, .alert-info { background: var(--info-soft); color: #1d4ed8; border-color: #bfdbfe; }
.flash-warn, .alert-warn { background: var(--warn-soft); color: var(--warn); border-color: #fde68a; }

.alert ul { margin: 0; padding-left: 16px; }
.alert li + li { margin-top: 2px; }
.alert code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    background: rgba(0, 0, 0, .05);
    padding: 1px 4px;
    border-radius: 4px;
}

/* 合规提示：沿用 alert-warn 配色，用左侧色条强化风险告知的辨识度 */
.compliance-notice {
    font-size: 12.5px;
    line-height: 1.7;
    border-left: 3px solid var(--warn);
}
.compliance-notice strong { margin-right: 2px; }
.compliance-notice b { font-weight: 700; }

/* ================= 表单 ================= */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.field.full { grid-column: 1 / -1; }
.field > label {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 5px;
    font-size: 12.5px;
    font-weight: 600;
    color: #374151;
}

.req { color: var(--danger); }
.opt { font-weight: 400; font-size: 11px; color: var(--muted-2); }

.input, .select, .textarea,
input[type="text"], input[type="password"], input[type="tel"], input[type="email"],
input[type="datetime-local"], select, textarea {
    width: 100%;
    padding: 9px 11px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

input::placeholder, textarea::placeholder { color: #b6bcc6; }

.input:focus, .select:focus, .textarea:focus,
input:focus, select:focus, textarea:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 2px rgba(7, 193, 96, .13);
}

.textarea { resize: vertical; min-height: 64px; line-height: 1.5; }

.hint { margin-top: 4px; font-size: 11px; line-height: 1.45; color: var(--muted-2); }

/* 短信验证码：输入框与按钮保持同一行 */
.code-row { display: flex; align-items: center; gap: 8px; }
.code-row > input { flex: 1; min-width: 0; }
.code-row .btn { flex-shrink: 0; white-space: nowrap; }

/* 字段实时校验 */
input.invalid, input.invalid:focus {
    border-color: var(--danger);
    box-shadow: 0 0 0 2px rgba(220, 38, 38, .12);
}
.field-error {
    display: none;
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.45;
    color: var(--danger);
}
.field-error.show { display: block; }

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #f1f2f4;
}

.form-actions .note { font-size: 12px; color: var(--muted-2); }

/* ================= 按钮 ================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 20px;
    font-size: 13.5px;
    font-weight: 600;
    font-family: inherit;
    border-radius: 9px;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: transform .12s, box-shadow .12s, background .15s, border-color .15s;
}

.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, #22c55e, var(--green));
    box-shadow: 0 4px 12px rgba(7, 193, 96, .26);
}
.btn-primary:hover { box-shadow: 0 6px 16px rgba(7, 193, 96, .32); }

.btn-secondary { color: #374151; background: #fff; border-color: var(--border); }
.btn-secondary:hover { background: #f9fafb; }

.btn-danger { color: #b91c1c; background: var(--danger-soft); border-color: #fecaca; }
.btn-danger:hover { background: #fee2e2; }

.btn-ghost { color: var(--muted); background: transparent; }
.btn-ghost:hover { background: #f3f4f6; }

.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; }

/* ================= 工具条 ================= */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.toolbar .input, .toolbar .select { width: auto; min-width: 130px; max-width: 220px; }
.toolbar .input.grow { flex: 1; min-width: 160px; max-width: 360px; }

.batchbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 12px;
    margin-bottom: 10px;
    background: #fafbfc;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    color: var(--muted);
}

.batchbar .check { display: flex; align-items: center; gap: 6px; user-select: none; }
.batchbar .check input { width: 15px; height: 15px; accent-color: var(--green); }

/* ================= 表格 ================= */
.table-wrap { width: 100%; overflow-x: auto; }

table.list {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

table.list th {
    padding: 8px 10px;
    text-align: left;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
}

table.list td {
    padding: 11px 10px;
    border-bottom: 1px solid #f1f2f4;
    vertical-align: middle;
}

table.list tbody tr:last-child td { border-bottom: none; }
table.list tbody tr:hover { background: #fafdfb; }

.cell-check { width: 34px; }
.cell-check input { width: 15px; height: 15px; accent-color: var(--green); }

.cell-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

.identity { display: flex; align-items: center; gap: 9px; min-width: 0; }
.thumb {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 10px;
    background: var(--green-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: var(--green-dark);
    font-weight: 700;
    font-size: 14px;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.identity-text { min-width: 0; }
.identity-text strong { display: block; font-size: 13px; font-weight: 600; }
.identity-text small {
    display: block;
    font-size: 11px;
    color: var(--muted-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 210px;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
}

.path-text { word-break: break-all; text-align: left; }

.link-url {
    color: #166534;
    text-decoration: none;
    word-break: break-all;
}
.link-url:hover {
    color: #15803d;
    text-decoration: underline;
}

/* 页面路径截断提示 */
.path-tip {
    cursor: help;
    border-bottom: 1px dashed rgba(107, 114, 128, .45);
}
.mp-tooltip {
    position: fixed;
    z-index: 9999;
    max-width: min(90vw, 560px);
    padding: 7px 10px;
    border-radius: 8px;
    background: rgba(17, 24, 39, .94);
    color: #fff;
    font-size: 12px;
    line-height: 1.5;
    word-break: break-all;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
    opacity: 0;
    visibility: hidden;
    transition: opacity .15s;
    pointer-events: none;
}
.mp-tooltip.show {
    opacity: 1;
    visibility: visible;
}

.hint code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    background: rgba(0, 0, 0, .05);
    padding: 1px 4px;
    border-radius: 4px;
}

.cell-actions form { display: inline-flex; margin: 0; }

.code-static { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.sub { display: block; font-size: 11px; color: var(--muted-2); margin-top: 2px; }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}
.pill::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill.on { color: #047857; background: #ecfdf5; }
.pill.off { color: #6b7280; background: #f3f4f6; }
.pill.expired { color: #b45309; background: var(--warn-soft); }
.pill.refunded, .pill.processing { color: #1d4ed8; background: var(--info-soft); }

/* ================= 空状态 ================= */
.empty {
    padding: 34px 16px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}
.empty strong { display: block; font-size: 14px; color: var(--text); margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

/* ================= 统计 ================= */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.stat {
    background: #fff;
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 2px 10px rgba(17, 24, 39, .05);
}
.stat b { display: block; font-size: 20px; font-weight: 700; line-height: 1.2; }
.stat span { font-size: 11.5px; color: var(--muted); }
.stat.green b { color: var(--green-dark); }
.stat.warn b { color: var(--warn); }
.stat-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.money { font-weight: 700; white-space: nowrap; }

/* ================= 短链展示 ================= */
.link-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 11px;
    background: #f6fdf9;
    border: 1px dashed #a7f3c9;
    border-radius: var(--radius-sm);
}

.link-box .link-text {
    flex: 1;
    min-width: 0;
    font-size: 12.5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: #166534;
    word-break: break-all;
    line-height: 1.4;
}

.btn-copy {
    flex-shrink: 0;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background: var(--green);
    border: none;
    border-radius: 7px;
    cursor: pointer;
}
.btn-copy.copied { background: #16a34a; }

.list .btn-copy {
    padding: 3px 8px;
    font-size: 11px;
    border-radius: 6px;
}

/* 列表二维码图标按钮：正方形，高度与复制按钮一致 */
.btn-qr {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 27px;
    aspect-ratio: 1;
    color: #4b5563;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 7px;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}
.btn-qr svg {
    width: 14px;
    height: 14px;
}
.btn-qr:hover {
    border-color: var(--green);
    color: var(--green-dark);
}

.list .btn-qr {
    height: 21px;
    border-color: transparent;
    background: var(--border);
    border-radius: 6px;
}
.list .btn-qr svg { width: 12px; height: 12px; }
.list .btn-qr:hover {
    border-color: transparent;
    background: var(--green);
    color: #fff;
}

/* 管理端表格操作列：高度与 .btn-sm 一致 */
.cell-actions .btn-qr {
    height: 27px;
    aspect-ratio: 1;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 7px;
    color: #4b5563;
}
.cell-actions .btn-qr svg { width: 14px; height: 14px; }
.cell-actions .btn-qr:hover {
    border-color: var(--green);
    background: var(--green-soft);
    color: var(--green-dark);
}

/* ================= 分页 ================= */
.pager {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
    margin: 16px 0 4px;
}

.pager-btn {
    min-width: 30px;
    height: 30px;
    padding: 0 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: #4b5563;
    font-size: 12px;
}
.pager-btn:hover { border-color: var(--green); color: var(--green-dark); }
.pager-btn.current { background: var(--green); border-color: var(--green); color: #fff; }
.pager-btn.disabled { color: #cbd5e1; background: #fafafa; }

/* ================= 登录页 ================= */
.auth-card {
    max-width: 420px;
    margin: 8px auto 0;
    padding: 26px 24px;
}

.auth-title { text-align: center; margin-bottom: 18px; }
.auth-title h2 { font-size: 20px; margin-bottom: 4px; }
.auth-title p { font-size: 12.5px; color: var(--muted); }

.tabs {
    display: flex;
    gap: 3px;
    padding: 3px;
    background: #f3f4f6;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
}
.tab {
    flex: 1;
    text-align: center;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}
.tab.active { background: #fff; color: var(--text); box-shadow: 0 1px 4px rgba(17, 24, 39, .08); }

.divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0;
    font-size: 11.5px;
    color: var(--muted-2);
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.btn-wechat {
    width: 100%;
    color: #fff;
    background: var(--green);
    border: none;
    box-shadow: 0 4px 12px rgba(7, 193, 96, .22);
}
.btn-wechat:hover { background: var(--green-dark); }

.btn-wechat-ghost {
    width: 100%;
    color: var(--green-dark);
    background: var(--green-soft);
    border: 1px solid #b7ebc9;
}

.auth-links {
    margin-top: 16px;
    text-align: center;
    font-size: 12px;
    color: var(--muted);
}
.auth-links a { font-weight: 600; }

.wx-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 14px;
    background: var(--green-soft);
    border: 1px solid #b7ebc9;
    border-radius: var(--radius-sm);
}
.wx-profile img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: #fff; }
.wx-profile b { display: block; font-size: 13px; }
.wx-profile small { font-size: 11px; color: var(--muted); }

/* ================= 管理端 logo 上传槽 ================= */
.logo-slot { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.logo-slot .iu-wrapper { margin: 0; }
.logo-slot .iu-trigger { width: 92px; height: 92px; }
.logo-slot-hint { font-size: 11px; color: var(--muted-2); line-height: 1.5; padding-top: 4px; }

/* ================= 个人中心 ================= */
.profile-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 9px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f1f2f4;
}

.avatar {
    width: 88px;
    height: 88px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--green-soft);
    border: 1px solid #d1fae5;
    color: var(--green-dark);
    font-size: 28px;
    font-weight: 700;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.profile-head-text { min-width: 0; }
.profile-head-text h2 { font-size: 18px; font-weight: 700; margin-bottom: 2px; }
.profile-head-text p { font-size: 12px; color: var(--muted); margin-bottom: 7px; }

.info-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 18px;
    margin: 0;
}
.info-list > div {
    min-width: 0;
    padding: 8px 10px;
    background: #fafbfc;
    border-radius: 9px;
}
.info-list dt { font-size: 11px; color: var(--muted-2); margin-bottom: 2px; }
.info-list dd { margin: 0; font-size: 13px; color: var(--text); word-break: break-all; }

.inline-form { display: flex; align-items: center; gap: 8px; }
.inline-form .input { flex: 1; min-width: 0; }
.inline-form .btn { flex-shrink: 0; white-space: nowrap; }

/* 微信绑定：状态组件与操作按钮保持同一行 */
.wx-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}
.wx-row .wx-profile { flex: 1 1 auto; min-width: 0; margin-bottom: 0; }
.wx-row .wx-profile > div { min-width: 0; }
.wx-row .wx-profile b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wx-row .wx-profile small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.wx-row form { margin: 0; flex-shrink: 0; }
/* 覆盖 .btn-wechat-ghost 的 100% 宽度，避免挤占左侧状态文字 */
.wx-row .btn { width: auto; flex-shrink: 0; }
.wx-status {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.45;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ================= 确认弹窗 ================= */
dialog.modal {
    width: min(92vw, 380px);
    padding: 0;
    border: none;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 20px 60px rgba(17, 24, 39, .24);
}
dialog.modal::backdrop {
    background: rgba(17, 24, 39, .45);
    backdrop-filter: blur(2px);
}
.modal-body { padding: 20px 20px 14px; }
.modal-title { margin: 0 0 8px; font-size: 16px; font-weight: 700; }
.modal-text { font-size: 13px; color: var(--muted); line-height: 1.6; }
.modal-actions { display: flex; gap: 8px; padding: 0 20px 20px; }
.modal-actions .btn { flex: 1; }
.modal-actions .btn[hidden] { display: none; }

/* 表单弹窗（创建 / 编辑短链） */
dialog.modal.form-modal {
    width: min(94vw, 640px);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
}
dialog.modal.form-modal:not([open]) { display: none; }
.form-modal form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
.modal-form-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 20px 10px;
}
.modal-form-head .modal-title { margin: 0; }
.modal-x {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 18px;
    line-height: 1;
    color: var(--muted);
    background: #f3f4f6;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}
.modal-x:hover { color: var(--text); background: #e5e7eb; }
/* 自动聚焦到关闭按钮时去掉浏览器默认描边（部分浏览器为橙色） */
.modal-x:focus,
.modal-x:focus-visible {
    outline: none;
    box-shadow: none;
}
.modal-x:focus-visible { color: var(--text); background: #e5e7eb; }
.modal-form-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 4px 20px 10px;
    -webkit-overflow-scrolling: touch;
}
.modal-form-body .alert[hidden] { display: none; }
.form-modal .modal-actions { padding-top: 6px; }

/* 创建成功弹窗（对齐 success.php 的成功页内容） */
dialog.modal.success-modal {
    width: min(92vw, 420px);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}
dialog.modal.success-modal:not([open]) { display: none; }
.success-body { text-align: center; }
.success-icon {
    width: 56px;
    height: 56px;
    margin: 4px auto 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4ade80, var(--green));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(7, 193, 96, .32);
}
.success-icon svg {
    width: 26px;
    height: 26px;
    stroke: #fff;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}
.success-subtitle {
    margin: 0 0 14px;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--muted);
}
.success-body .link-box { text-align: left; }
.qr-box { margin: 14px 0 2px; }
.qr-box img {
    display: block;
    width: 170px;
    height: 170px;
    margin: 0 auto;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
}
.qr-hint { margin: 8px 0 0; font-size: 11px; color: var(--muted-2); text-align: center; }

/* 短链二维码弹窗（列表图标触发） */
dialog.modal.qr-modal {
    width: min(92vw, 360px);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}
dialog.modal.qr-modal:not([open]) { display: none; }
.qr-modal .qr-box { margin: 14px 0 10px; }
.qr-modal .qr-box img { width: 180px; height: 180px; }
.qr-modal .qr-url-text {
    margin: 0;
    font-size: 11px;
    color: var(--muted-2);
    text-align: center;
    word-break: break-all;
    line-height: 1.5;
}

/* 帮助页联系方式二维码：两列并排，图片缺失时显示占位提示 */
.qr-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.qr-item {
    padding: 12px;
    text-align: center;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
}
.qr-item img {
    display: block;
    width: 100%;
    max-width: 75px;
    height: auto;
    margin: 0 auto 9px;
    border-radius: 10px;
}
.qr-item strong { display: block; font-size: 13px; }
.qr-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 150px;
    height: 150px;
    margin: 0 auto 9px;
    color: var(--muted-2);
    font-size: 11px;
    background: #fafafa;
    border: 1px dashed var(--border);
    border-radius: 10px;
}

/* ================= 协议文档 ================= */
.doc-body { font-size: 13px; line-height: 1.8; }
.doc-body h3 { margin: 18px 0 6px; font-size: 14.5px; }
.doc-body h3:first-child { margin-top: 0; }
.doc-body p { margin: 0 0 8px; color: var(--muted); }
.doc-body ul { margin: 0 0 8px; padding-left: 18px; color: var(--muted); }
.doc-body li { margin-bottom: 3px; }
.doc-meta {
    margin-bottom: 14px;
    text-align: center;
    font-size: 11.5px;
    color: var(--muted-2);
}

/* ================= 其他 ================= */
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.flex { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.text-muted { color: var(--muted); }
.full { grid-column: 1 / -1; }
.nowrap { white-space: nowrap; }

.footer {
    text-align: center;
    padding: 16px 16px calc(18px + env(safe-area-inset-bottom));
    font-size: 11px;
    color: var(--muted-2);
}

/* ================= 套餐中心 ================= */
.plan-brief {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.plan-brief-main { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; min-width: 0; }
.plan-brief-main strong { font-size: 14px; }
.plan-brief .hint { margin-top: 2px; }
.plan-brief-quota {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 11.5px;
    color: var(--muted);
}

.plan-current {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: #f9fafb;
    border-radius: 12px;
    margin-bottom: 14px;
}
.plan-current-text strong { font-size: 16px; }
.plan-current-text .sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

.quota-list { display: flex; flex-direction: column; gap: 6px; }
.quota-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--muted);
}
.quota-row b { color: var(--text); font-size: 12.5px; }
.quota-bar {
    height: 6px;
    margin-bottom: 6px;
    background: #eef1f4;
    border-radius: 999px;
    overflow: hidden;
}
.quota-bar i {
    display: block;
    height: 100%;
    min-width: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, #4ade80, var(--green));
}

.plan-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}
.plan-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 14px 14px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
}
.plan-card.featured { border-color: #a7f3c9; background: linear-gradient(180deg, #f6fdf9, #fff); }
.plan-card.current { border-color: var(--green); box-shadow: 0 0 0 2px rgba(7, 193, 96, .12); }
.plan-tag {
    position: absolute;
    top: -1px;
    right: 10px;
    padding: 2px 7px;
    font-size: 10px;
    color: #fff;
    background: var(--green);
    border-radius: 0 0 6px 6px;
}
.plan-name { font-size: 14px; font-weight: 700; }
.plan-price { display: flex; align-items: baseline; gap: 2px; color: var(--green-dark); }
.plan-price em { font-style: normal; font-size: 12px; }
.plan-price b { font-size: 26px; line-height: 1.1; font-weight: 800; }
.plan-price span { font-size: 11px; color: var(--muted-2); }
.plan-desc { font-size: 11.5px; color: var(--muted); min-height: 32px; }
.plan-features {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 12px;
    color: var(--muted);
}
.plan-features li { display: flex; justify-content: space-between; gap: 6px; }
.plan-features b { color: var(--text); font-weight: 600; }
.plan-card .btn-block { margin-top: 4px; }

.rule-list {
    margin: 0;
    padding-left: 18px;
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--muted);
}

dialog.modal.pay-modal { width: min(92vw, 380px); display: flex; flex-direction: column; }
dialog.modal.pay-modal:not([open]) { display: none; }
.pay-summary { margin: 2px 0 6px; font-size: 15px; font-weight: 700; text-align: center; }
.pay-status { margin: 0 0 8px; font-size: 12.5px; color: var(--muted); text-align: center; }
.pay-modal .qr-box img { width: 200px; height: 200px; }
.pay-modal .alert { margin: 8px 0 4px; }

/* ================= 移动端：更紧凑、字号更小 ================= */
@media (max-width: 760px) {
    body { font-size: 13px; background-image: none; }

    .topbar-inner {
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px 10px;
    }

    .brand-mark { width: 30px; height: 30px; border-radius: 9px; }
    .brand-mark svg { width: 15px; height: 15px; }
    .brand-text strong { font-size: 13.5px; }
    .brand-text small { font-size: 9.5px; }

    .account { gap: 6px; font-size: 11px; }
    .account-name { font-size: 11.5px; }
    .account-logout { padding: 3px 8px; font-size: 10.5px; }

    .nav {
        order: 5;
        width: 100%;
        overflow-x: auto;
        padding-bottom: 1px;
        scrollbar-width: none;
    }
    .nav::-webkit-scrollbar { display: none; }
    .nav-item { padding: 5px 11px; font-size: 12px; }

    .page { padding: 12px 10px 26px; }
    .page-head { margin-bottom: 10px; align-items: center; }
    .page-head h1 { font-size: 17px; }
    .page-head p { font-size: 11px; margin-top: 2px; }
    .page-head-actions .btn { padding: 7px 12px; font-size: 12.5px; }

    .card { padding: 14px 12px; border-radius: 14px; box-shadow: 0 3px 14px rgba(17, 24, 39, .06); }
    .card-head { margin-bottom: 10px; }
    .card-head h2 { font-size: 14px; }

    .form-grid { grid-template-columns: 1fr; gap: 11px; }
    .field > label { font-size: 12px; margin-bottom: 4px; }
    input[type="text"], input[type="password"], input[type="tel"], input[type="email"],
    input[type="datetime-local"], select, textarea, .input, .select, .textarea {
        font-size: 15px;
        padding: 8px 10px;
        min-height: 38px;
        border-radius: 8px;
    }
    input[type="datetime-local"] { -webkit-appearance: none; appearance: none; }
    textarea { min-height: 66px; }
    .hint { font-size: 10.5px; }
    .opt { font-size: 10px; }

    .form-actions {
        position: sticky;
        bottom: 0;
        z-index: 5;
        margin: 14px -12px 0;
        padding: 9px 12px calc(9px + env(safe-area-inset-bottom));
        background: #fff;
        border-top: 1px solid #f1f2f4;
        border-radius: 0 0 14px 14px;
        box-shadow: 0 -6px 18px rgba(17, 24, 39, .05);
    }
    .form-actions .btn { flex: 1; padding: 10px 12px; font-size: 14px; }
    .form-actions .btn + .btn { flex: 0 0 auto; }
    .form-actions .note { display: none; }

    .flash, .alert { font-size: 12px; padding: 9px 10px; margin-bottom: 10px; }

    .stat-grid { gap: 7px; margin-bottom: 10px; }
    .stat-grid.cols-4 { grid-template-columns: 1fr 1fr; }
    .stat { padding: 9px 10px; border-radius: 10px; }
    .stat b { font-size: 17px; }
    .stat span { font-size: 10.5px; }

    /* 套餐简报在移动端保持单行：缩小按钮并禁止换行 */
    .plan-brief { align-items: center; gap: 6px; flex-wrap: nowrap; }
    .plan-brief-main { gap: 8px; }
    .plan-brief-quota { font-size: 10px; flex: 0 0 auto; }
    .plan-brief > .btn { flex: 0 0 auto; padding: 4px 7px; font-size: 10.5px; border-radius: 6px; white-space: nowrap; }
    .plan-current { padding: 10px 12px; gap: 8px; }
    .plan-current-text strong { font-size: 14px; }
    .quota-row, .quota-row b { font-size: 11.5px; }
    .plan-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .plan-card { padding: 12px 10px 10px; gap: 6px; }
    .plan-name { font-size: 13px; }
    .plan-price b { font-size: 22px; }
    .plan-desc { display: none; }
    .plan-features { font-size: 11px; gap: 4px; }
    .plan-card .btn-block { font-size: 12px; padding: 7px 8px; }
    .rule-list { font-size: 11.5px; padding-left: 16px; }
    .pay-modal .qr-box img { width: 170px; height: 170px; }

    /* 工具栏：移动端整体缩小字号与控件尺寸 */
    .toolbar { gap: 5px; margin-bottom: 9px; }
    .toolbar .input, .toolbar .select {
        flex: 1;
        min-width: 96px;
        max-width: none;
        padding: 6px 8px;
        font-size: 11.5px;
        border-radius: 7px;
    }
    .toolbar .btn { padding: 6px 10px; font-size: 11.5px; border-radius: 7px; }

    .batchbar { padding: 7px 10px; font-size: 11.5px; }
    .batchbar .btn { padding: 5px 10px; font-size: 11.5px; }

    /* 表格转卡片 */
    .table-wrap { overflow: visible; }
    table.list thead { display: none; }
    table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
    table.list tbody tr {
        padding: 10px 2px 9px;
        border-bottom: 1px solid #f1f2f4;
    }
    table.list tbody tr:last-child { border-bottom: none; }
    table.list tbody tr:hover { background: transparent; }
    table.list td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 3px 2px;
        border: none;
        font-size: 12.5px;
        text-align: right;
    }
    table.list td::before {
        content: attr(data-label);
        flex-shrink: 0;
        text-align: left;
        font-size: 11px;
        color: var(--muted-2);
    }
    table.list td.cell-check {
        display: block;
        text-align: left;
        padding: 0 2px 6px;
    }
    table.list td.cell-check::before { content: none; }
    table.list td.cell-actions-td { padding-top: 6px; }
    table.list td.cell-actions-td::before { content: none; }
    .cell-actions { justify-content: flex-start; }
    .cell-actions .btn-sm { padding: 4px 8px; font-size: 11px; border-radius: 6px; }

    /* 短链列表：编辑按钮与复选框同一行并靠右，小程序信息右对齐 */
    table.list.link-table tbody tr { position: relative; }
    table.list.link-table td.cell-check { padding-bottom: 14px; }
    table.list.link-table td.cell-actions-td {
        position: absolute;
        top: 10px;
        right: 2px;
        width: auto;
        padding: 0;
    }
    table.list.link-table .cell-actions { justify-content: flex-end; }
    table.list.link-table td.app-cell .identity-text { text-align: right; }
    table.list td .identity { justify-content: flex-end; text-align: left; }
    .identity-text small { max-width: 170px; }

    .thumb { width: 34px; height: 34px; border-radius: 9px; }

    .profile-head { gap: 7px; margin-bottom: 12px; padding-bottom: 12px; }
    .avatar { width: 76px; height: 76px; font-size: 24px; }
    .profile-head-text h2 { font-size: 16px; }
    .profile-head-text p { font-size: 11px; }
    .info-list { grid-template-columns: 1fr; gap: 6px; }
    .info-list > div {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 8px 10px;
    }
    .info-list dt { margin-bottom: 0; }
    .info-list dd { text-align: right; }

    .modal-body { padding: 16px 16px 12px; }
    .modal-title { font-size: 15px; }
    .modal-actions { padding: 0 16px 16px; }

    /* 表单弹窗在窄屏改为单列，避免字段被挤压 */
    dialog.modal.form-modal { width: 94vw; max-height: 90vh; }
    .modal-form-head { padding: 14px 16px 8px; }
    .modal-form-body { padding: 2px 16px 8px; }
    .form-modal .form-grid { grid-template-columns: 1fr; }

    dialog.modal.success-modal { width: 92vw; }
    .success-icon { width: 50px; height: 50px; margin-bottom: 10px; }
    .success-icon svg { width: 24px; height: 24px; }
    .qr-box img { width: 150px; height: 150px; }

    dialog.modal.qr-modal { width: 92vw; }
    .qr-modal .qr-box img { width: 150px; height: 150px; }

    .code-row .btn { padding: 8px 10px; font-size: 12px; }
    .field-error { font-size: 10.5px; }
    .mp-tooltip { font-size: 11.5px; max-width: 88vw; }

    .auth-card { margin-top: 2px; padding: 18px 14px; border-radius: 14px; }
    .auth-card .form-actions {
        position: static;
        margin: 16px 0 0;
        padding: 14px 0 0;
        border-radius: 0;
        box-shadow: none;
    }
    .auth-title { margin-bottom: 14px; }
    .auth-title h2 { font-size: 18px; }
    .auth-title p { font-size: 11.5px; }
    .tabs { margin-bottom: 14px; }
    .tab { padding: 7px 8px; font-size: 12.5px; }
    .btn { padding: 9px 16px; font-size: 13px; }
    .btn-wechat, .btn-wechat-ghost { padding: 10px; font-size: 14px; }

    .link-box { padding: 8px 9px; }
    .link-box .link-text { font-size: 11.5px; }
    .btn-copy { padding: 5px 10px; font-size: 11px; }
    .list .btn-copy { padding: 2px 6px; font-size: 10.5px; border-radius: 5px; }
    .list .btn-qr { height: 19px; border-radius: 5px; }
    .list .btn-qr svg { width: 11px; height: 11px; }
    .cell-actions .btn-qr { height: 23px; border-radius: 6px; }
    .cell-actions .btn-qr svg { width: 12px; height: 12px; }

    .pager { margin: 12px 0 2px; gap: 4px; }
    .pager-btn { min-width: 27px; height: 27px; font-size: 11px; border-radius: 7px; }

    .collapse-toggle { width: 26px; height: 26px; border-radius: 7px; }
    .collapse-toggle svg { width: 14px; height: 14px; }

    .footer { font-size: 10.5px; padding: 12px 10px calc(14px + env(safe-area-inset-bottom)); }

    .logo-slot .iu-trigger { width: 84px; height: 84px; }
    .logo-slot-hint { font-size: 10.5px; }
}

@media (max-width: 360px) {
    .page-head p { display: none; }
    .brand-text small { display: none; }
    .stat b { font-size: 15px; }
}
