/* ============================================================
   防红系统 · 后台 UI 设计系统
   自包含样式（无 CDN 依赖）· 侧边栏布局 · 移动端抽屉
   ============================================================ */

/* ---------- 1. Tokens ---------- */
:root {
    --brand: #2f6bff;
    --brand-700: #1d51d8;
    --brand-800: #1741ae;
    --brand-soft: #ecf1ff;
    --brand-soft-2: #dfe8ff;

    --ok: #12b76a;
    --ok-soft: #e7f8f0;
    --warn: #f79009;
    --warn-soft: #fff6e5;
    --danger: #f04438;
    --danger-soft: #feeceb;
    --purple: #7a5af8;
    --purple-soft: #f1edff;
    --teal: #0ea5a5;
    --teal-soft: #e4f7f7;

    --bg: #f4f6fb;
    --panel: #ffffff;
    --panel-2: #fafbff;
    --line: #e8ecf4;
    --line-2: #d9e0ec;

    --text: #0f172a;
    --text-2: #475569;
    --text-3: #64748b;
    --muted: #8b95a7;

    --radius: 16px;
    --radius-md: 12px;
    --radius-sm: 9px;

    --shadow-xs: 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05), 0 2px 6px -2px rgba(16, 24, 40, .06);
    --shadow-md: 0 12px 28px -18px rgba(15, 23, 42, .35), 0 4px 10px -6px rgba(15, 23, 42, .08);
    --shadow-lg: 0 32px 64px -24px rgba(15, 23, 42, .35);

    --sidebar-w: 254px;
    --rail-w: 78px;
    --topbar-h: 62px;

    --ease: cubic-bezier(.4, 0, .2, 1);
}

/* ---------- 2. Reset & base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

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

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, p, figure { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-700); }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
code {
    font-family: "SFMono-Regular", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: .92em;
    background: var(--brand-soft);
    color: var(--brand-800);
    padding: 1px 6px;
    border-radius: 6px;
    word-break: break-all;
}
::selection { background: var(--brand-soft-2); color: var(--brand-800); }

.btn:focus-visible,
.icon-btn:focus-visible,
.nav-item:focus-visible,
.nav-group-head:focus-visible,
.quick-card:focus-visible,
.modal-close:focus-visible,
.alert-x:focus-visible,
.user-out:focus-visible,
.rail-toggle:focus-visible,
.nav-toggle:focus-visible,
.collapse-head:focus-visible,
.tabs button:focus-visible,
.user-out:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: #cfd7e6; border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #b6c1d4; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

.ico { width: 18px; height: 18px; flex: none; }
.ico-sm { width: 15px; height: 15px; flex: none; }
.ico-lg { width: 22px; height: 22px; flex: none; }

/* ---------- 3. App shell ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 70;
    width: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border-right: 1px solid var(--line);
    transition: width .2s var(--ease), transform .28s var(--ease);
}

.sidebar-brand {
    height: 66px;
    flex: none;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 16px;
    border-bottom: 1px solid var(--line);
}

.brand-mark {
    width: 36px;
    height: 36px;
    flex: none;
    border-radius: 11px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, #3d78ff, #1f4fd8);
    box-shadow: 0 6px 14px -8px rgba(47, 107, 255, .9);
}

.brand-text { min-width: 0; }
.brand-name { font-size: 15px; font-weight: 700; letter-spacing: .2px; line-height: 1.2; white-space: nowrap; }
.brand-sub { font-size: 11px; color: var(--muted); line-height: 1.3; white-space: nowrap; }

.rail-toggle {
    margin-left: auto;
    width: 30px;
    height: 30px;
    flex: none;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    color: var(--text-3);
    cursor: pointer;
    transition: all .16s var(--ease);
}
.rail-toggle:hover { color: var(--brand); border-color: var(--brand-soft-2); background: var(--brand-soft); }

.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px 12px 18px;
}

.nav-label {
    padding: 14px 10px 6px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}

.nav-item,
.nav-group-head {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 11px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-2);
    font-size: 13.5px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background .16s var(--ease), color .16s var(--ease);
    -webkit-tap-highlight-color: transparent;
}
.nav-item + .nav-item { margin-top: 2px; }
.nav-item:hover,
.nav-group-head:hover { background: #f4f6fb; color: var(--text); }

.nav-item.active {
    background: var(--brand);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 8px 18px -12px rgba(47, 107, 255, .95);
}
.nav-item.active .ico { color: #fff; }
.nav-item.active:hover { background: var(--brand); color: #fff; }

.nav-item .ico { color: var(--text-3); }
.nav-item:hover .ico { color: var(--brand); }

.nav-group { margin-top: 3px; }
.nav-group-head .ico { color: var(--text-3); }
.nav-group-head .nav-text { flex: 1; min-width: 0; }
.nav-chevron {
    width: 14px;
    height: 14px;
    flex: none;
    color: var(--muted);
    transition: transform .2s var(--ease);
}
.nav-group.open > .nav-group-head { color: var(--text); }
.nav-group.open > .nav-group-head .nav-chevron { transform: rotate(180deg); }

.nav-sub {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .24s var(--ease);
}
.nav-group.open > .nav-sub { grid-template-rows: 1fr; }
.nav-sub-inner { overflow: hidden; min-height: 0; }
.nav-sub-pad { padding: 4px 0 6px 10px; border-left: 1px dashed var(--line-2); margin-left: 20px; }
.nav-sub .nav-item { font-size: 13px; padding: 8px 10px; }
.nav-sub .nav-item + .nav-item { margin-top: 1px; }

.nav-badge {
    margin-left: auto;
    font-size: 10.5px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 99px;
    background: var(--brand-soft);
    color: var(--brand-700);
}
.nav-item.active .nav-badge { background: rgba(255, 255, 255, .22); color: #fff; }

.sidebar-foot {
    flex: none;
    border-top: 1px solid var(--line);
    padding: 10px;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 12px;
    background: var(--panel-2);
    border: 1px solid var(--line);
}
.avatar {
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    background: linear-gradient(135deg, #6a93ff, #2f6bff);
    text-transform: uppercase;
    box-shadow: 0 4px 10px -6px rgba(47, 107, 255, .9);
}
.user-meta { min-width: 0; flex: 1; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--muted); }
.user-out {
    width: 30px;
    height: 30px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: var(--text-3);
    transition: all .16s var(--ease);
}
.user-out:hover { background: var(--danger-soft); color: var(--danger); }

/* rail（桌面收起） */
.app.rail .sidebar { width: var(--rail-w); }
.app.rail .main { margin-left: var(--rail-w); }
.app.rail .brand-text,
.app.rail .rail-toggle svg,
.app.rail .nav-text,
.app.rail .nav-chevron,
.app.rail .nav-badge,
.app.rail .user-meta,
.app.rail .nav-label { display: none; }
.app.rail .sidebar-brand { padding: 0; justify-content: center; }
.app.rail .rail-toggle { display: none; }
.app.rail .sidebar-scroll { padding: 12px 10px; }
.app.rail .nav-item,
.app.rail .nav-group-head { justify-content: center; padding: 11px 0; }
.app.rail .nav-sub-pad { margin-left: 0; padding-left: 0; border-left: 0; }
.app.rail .nav-group-head { margin-top: 6px; }
.app.rail .user-card { justify-content: center; padding: 7px; flex-direction: column; gap: 6px; }
.app.rail .user-out { display: grid; width: 28px; height: 28px; }
.app.rail .sidebar-foot { padding: 8px; }
.drawer-close { display: none; }

/* 主区域 */
.main {
    margin-left: var(--sidebar-w);
    width: calc(100% - var(--sidebar-w));
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left .2s var(--ease), width .2s var(--ease);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--topbar-h);
    flex: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 22px;
    background: rgba(255, 255, 255, .84);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--line);
}

.topbar-title { min-width: 0; }
.topbar-title h1 {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar-title p { font-size: 12px; color: var(--muted); line-height: 1.3; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.nav-toggle {
    width: 38px;
    height: 38px;
    flex: none;
    display: none;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fff;
    color: var(--text-2);
    cursor: pointer;
}
.nav-toggle:active { background: var(--brand-soft); }

.content {
    flex: 1;
    width: 100%;
    max-width: 1220px;
    margin: 0 auto;
    padding: 22px 22px 56px;
}

.scrim {
    position: fixed;
    inset: 0;
    z-index: 65;
    background: rgba(15, 23, 42, .45);
    opacity: 0;
    pointer-events: none;
    transition: opacity .24s var(--ease);
    backdrop-filter: blur(2px);
}
body.nav-open .scrim { opacity: 1; pointer-events: auto; }
body.nav-locked { overflow: hidden; }

/* ---------- 4. Page header / hero ---------- */
.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 18px;
}
.page-head h2 { font-size: 21px; font-weight: 750; letter-spacing: -.01em; }
.page-head p { color: var(--text-3); font-size: 13px; margin-top: 3px; }
.page-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.hero {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 18px;
    color: #fff;
    background: linear-gradient(120deg, #2f6bff 0%, #2b57e0 48%, #3d3ad6 100%);
    box-shadow: 0 20px 40px -28px rgba(47, 107, 255, .95);
}
.hero::after {
    content: "";
    position: absolute;
    right: -70px;
    top: -90px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, .26), transparent 62%);
    pointer-events: none;
}
.hero-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero h2 { font-size: 20px; font-weight: 750; letter-spacing: -.01em; }
.hero p { font-size: 13px; color: rgba(255, 255, 255, .82); margin-top: 4px; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; position: relative; z-index: 1; }
.hero-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 10px;
    border-radius: 99px;
    font-size: 11.5px;
    font-weight: 600;
    background: rgba(255, 255, 255, .18);
    border: 1px solid rgba(255, 255, 255, .28);
    color: #fff;
}
.hero .btn-ghost {
    background: rgba(255, 255, 255, .14);
    border-color: rgba(255, 255, 255, .34);
    color: #fff;
}
.hero .btn-ghost:hover { background: rgba(255, 255, 255, .24); color: #fff; }
.hero .btn-white { background: #fff; color: var(--brand-700); border-color: #fff; }
.hero .btn-white:hover { background: #fff; color: var(--brand-800); }

/* ---------- 5. Cards ---------- */
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card + .card { margin-top: 16px; }
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, #fff, #fdfdff);
}
.card-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.card-title h3 { font-size: 15px; font-weight: 700; }
.card-title p { font-size: 12px; color: var(--muted); margin-top: 1px; }
.card-title .chip-ico {
    width: 30px;
    height: 30px;
    flex: none;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: var(--brand-soft);
    color: var(--brand-700);
}
.chip-ico.ok { background: var(--ok-soft); color: var(--ok); }
.chip-ico.warn { background: var(--warn-soft); color: var(--warn); }
.chip-ico.teal { background: var(--teal-soft); color: var(--teal); }
.chip-ico.purple { background: var(--purple-soft); color: var(--purple); }
.chip-ico.danger { background: var(--danger-soft); color: var(--danger); }

.card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; flex: 1 1 auto; }
.card-actions .search-wrap { flex: 1 1 180px; }
.card-body { padding: 18px; }
.card-body.tight { padding: 12px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--panel-2); display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.section { scroll-margin-top: calc(var(--topbar-h) + 14px); }
.section + .section { margin-top: 18px; }

/* ---------- 6. Stat cards ---------- */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
    gap: 12px;
}
.stat {
    position: relative;
    padding: 15px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--panel);
    box-shadow: var(--shadow-xs);
    transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--brand-soft-2); }
.stat-label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); font-weight: 500; }
.stat-value { font-size: 25px; font-weight: 750; line-height: 1.25; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat-foot { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.stat .chip-ico { position: absolute; right: 12px; top: 12px; width: 30px; height: 30px; }

/* ---------- 7. Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 38px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-2);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
    transition: background .16s var(--ease), color .16s var(--ease), border-color .16s var(--ease), box-shadow .16s var(--ease), transform .1s var(--ease);
    -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .62; cursor: not-allowed; transform: none; }
.btn .ico { width: 16px; height: 16px; }

.btn-primary {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 10px 20px -14px rgba(47, 107, 255, 1);
}
.btn-primary:hover { background: var(--brand-700); color: #fff; }
.btn-primary:focus-visible { outline: 3px solid var(--brand-soft-2); outline-offset: 1px; }

.btn-soft { background: var(--brand-soft); color: var(--brand-700); }
.btn-soft:hover { background: var(--brand-soft-2); color: var(--brand-800); }

.btn-ghost { background: #fff; border-color: var(--line-2); color: var(--text-2); }
.btn-ghost:hover { border-color: var(--brand-soft-2); background: var(--brand-soft); color: var(--brand-700); }

.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 10px 20px -14px rgba(240, 68, 56, 1); }
.btn-danger:hover { background: #d92d20; color: #fff; }

.btn-danger-soft { background: var(--danger-soft); color: #b42318; }
.btn-danger-soft:hover { background: #fddcd8; color: #912018; }

.btn-ok { background: var(--ok); color: #fff; }
.btn-ok:hover { background: #0f9d5c; color: #fff; }

.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; }
.btn-sm .ico { width: 14px; height: 14px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 14.5px; border-radius: 12px; }

.btn-block { width: 100%; }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: none;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    color: var(--text-3);
    cursor: pointer;
    transition: all .16s var(--ease);
    -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { color: var(--brand); border-color: var(--brand-soft-2); background: var(--brand-soft); }
.icon-btn.danger:hover { color: var(--danger); border-color: #fbd5d1; background: var(--danger-soft); }
.icon-btn.ok:hover { color: var(--ok); border-color: #c7f0dc; background: var(--ok-soft); }
.icon-btn .ico { width: 16px; height: 16px; }
.icon-btn.copied { color: var(--ok); border-color: #c7f0dc; background: var(--ok-soft); }

/* ---------- 8. Forms ---------- */
.form-grid { display: grid; gap: 13px; }
.form-grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.field { min-width: 0; }
.field > label,
.field-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-3);
    margin-bottom: 5px;
}
.field-hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.5; }

.input,
.textarea,
.select {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    font-size: 13.5px;
    outline: none;
    transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: #a6afbf; }
.input:hover, .textarea:hover, .select:hover { border-color: #c3ccdb; }
.input:focus, .textarea:focus, .select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(47, 107, 255, .13);
}
.textarea {
    height: auto;
    min-height: 148px;
    padding: 11px 12px;
    line-height: 1.65;
    resize: vertical;
    font-family: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
    font-size: 12.5px;
}
.select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 34px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b95a7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    cursor: pointer;
}
.input.mono { font-family: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }

.form-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-stack { display: grid; gap: 14px; }
.form-row .field { flex: 1 1 180px; }

.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; }
.checkbox input[type="checkbox"],
.checkbox input[type="radio"] {
    width: 17px;
    height: 17px;
    accent-color: var(--brand);
    cursor: pointer;
    margin: 0;
}
.radio-group { display: flex; gap: 16px; flex-wrap: wrap; }

.hint-inline { font-size: 12.5px; color: var(--text-3); }
.hint-banner {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 11px 13px;
    border-radius: var(--radius-md);
    background: var(--brand-soft);
    color: #1a49c4;
    font-size: 12.5px;
    line-height: 1.65;
}
.hint-banner .ico { margin-top: 2px; color: var(--brand); }
.hint-banner.warn { background: var(--warn-soft); color: #8a5300; }
.hint-banner.warn .ico { color: var(--warn); }
.hint-banner code { background: rgba(255, 255, 255, .72); color: inherit; }

/* ---------- 9. Rows / tables ---------- */
.list { display: flex; flex-direction: column; }
.list-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-top: 1px solid var(--line);
    transition: background .14s var(--ease);
}
.list-row:first-child { border-top: 0; }
.list-row:hover { background: var(--panel-2); }
.list-main { min-width: 0; flex: 1; }
.list-title { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    word-break: break-all;
}
.list-sub > span { display: inline-flex; align-items: center; gap: 5px; }
.list-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--panel-2);
    white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--panel-2); }
.table .num { font-variant-numeric: tabular-nums; }

/* ---------- 10. Badges & chips ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 21px;
    padding: 0 8px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 600;
    background: #f1f4f9;
    color: var(--text-3);
    white-space: nowrap;
}
.badge .ico { width: 12px; height: 12px; }
.badge.brand { background: var(--brand-soft); color: var(--brand-700); }
.badge.ok { background: var(--ok-soft); color: #067647; }
.badge.warn { background: var(--warn-soft); color: #b54708; }
.badge.danger { background: var(--danger-soft); color: #b42318; }
.badge.purple { background: var(--purple-soft); color: #5a36d6; }
.badge.teal { background: var(--teal-soft); color: #0b7c7c; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border-radius: 99px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    font-size: 11.5px;
    color: var(--text-3);
}

.mono { font-family: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.break { word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }

/* ---------- 11. Empty state ---------- */
.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 34px 18px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}
.empty-ico {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--panel-2);
    border: 1px dashed var(--line-2);
    color: var(--muted);
}
.empty b { color: var(--text-2); font-size: 13.5px; }

/* ---------- 12. Modal ---------- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, .5);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
.modal.open { display: flex; }
.modal-card {
    width: 100%;
    max-width: 520px;
    max-height: min(86vh, 760px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: modalIn .22s var(--ease);
}
.modal-card.wide { max-width: 620px; }
.modal-card.slim { max-width: 420px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 15.5px; font-weight: 700; flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.modal-head h3 .ico { flex: none; color: var(--brand); }
.modal-close {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}
.modal-close:hover { background: #f1f4f9; color: var(--text); }
.modal-body { padding: 18px; overflow-y: auto; min-height: 0; flex: 1 1 auto; }
.modal-foot {
    display: flex;
    gap: 10px;
    padding: 14px 18px;
    border-top: 1px solid var(--line);
    background: var(--panel-2);
}
.modal-foot .btn { flex: 1; }

.tabs { display: flex; gap: 4px; padding: 4px; background: #f1f4f9; border-radius: 11px; }
.tabs button {
    flex: 1;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-3);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all .16s var(--ease);
}
.tabs button.active { background: #fff; color: var(--brand-700); box-shadow: var(--shadow-xs); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- 13. Toast ---------- */
.toast-wrap {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: min(360px, calc(100vw - 36px));
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 11px 14px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-left: 3px solid var(--brand);
    box-shadow: var(--shadow-md);
    font-size: 13px;
    color: var(--text-2);
    animation: toastIn .22s var(--ease);
    pointer-events: auto;
}
.toast.out { animation: toastOut .2s var(--ease) forwards; }
.toast.ok { border-left-color: var(--ok); }
.toast.ok .ico { color: var(--ok); }
.toast.err { border-left-color: var(--danger); }
.toast.err .ico { color: var(--danger); }
.toast.info { border-left-color: var(--brand); }
.toast.info .ico { color: var(--brand); }
.toast .ico { margin-top: 2px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

/* ---------- 14. Alerts / flash ---------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    line-height: 1.6;
    border: 1px solid transparent;
}
.alert .ico { margin-top: 1px; }
.alert code { background: rgba(255, 255, 255, .78); color: inherit; }
.alert-x {
    margin-left: auto;
    flex: none;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    opacity: .55;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: opacity .16s var(--ease), background .16s var(--ease);
}
.alert-x:hover { opacity: 1; background: rgba(255, 255, 255, .6); }
.alert-ok { background: var(--ok-soft); border-color: #c7f0dc; color: #05603a; }
.alert-ok .ico { color: var(--ok); }
.alert-err { background: var(--danger-soft); border-color: #fbd5d1; color: #912018; }
.alert-err .ico { color: var(--danger); }
.alert-warn { background: var(--warn-soft); border-color: #fde4b9; color: #93370d; }
.alert-warn .ico { color: var(--warn); }
.alert-info { background: var(--brand-soft); border-color: var(--brand-soft-2); color: #1a49c4; }
.alert-info .ico { color: var(--brand); }
.flash { margin-bottom: 16px; animation: fadeIn .2s var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

#dataDirWarn { margin: 0 0 16px; padding: 0; max-width: none !important; }

/* ---------- 15. Link cards ---------- */
.link-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: #fff;
    overflow: hidden;
    transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.link-card:hover { border-color: var(--brand-soft-2); box-shadow: var(--shadow-sm); }
.link-card + .link-card { margin-top: 12px; }
.link-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--panel-2);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
.link-url {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.link-url .url-text {
    font-family: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
    font-size: 12.5px;
    color: var(--brand-700);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.link-card-body { padding: 14px; display: grid; gap: 12px; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kv { min-width: 0; }
.kv > span { display: block; font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .03em; }
.kv > b { font-size: 13px; font-weight: 600; word-break: break-all; }
.kv .num { font-variant-numeric: tabular-nums; font-size: 15px; }
.link-forms { display: grid; gap: 9px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form .input { height: 36px; font-size: 12.5px; }
.link-card-foot {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 11px 14px;
    border-top: 1px solid var(--line);
    background: var(--panel-2);
}

/* ---------- 16. Toolbar / search ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .input { height: 36px; max-width: 320px; }
.search-wrap { position: relative; flex: 1 1 220px; max-width: 340px; }
.search-wrap .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 15px; height: 15px; }
.search-wrap .input { padding-left: 33px; }

/* ---------- 17. Collapse ---------- */
.collapse-head {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 13px 16px;
    background: var(--panel-2);
    border: 0;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
}
.collapse-head:hover { background: #f6f8fd; }
.collapse-head .chev { margin-left: auto; transition: transform .2s var(--ease); color: var(--muted); }
.collapse-head[aria-expanded="false"] .chev { transform: rotate(-90deg); }
.collapse-body { overflow: hidden; }
.collapse-body[hidden] { display: none; }

/* ---------- 18. Hero grid layouts ---------- */
.grid-2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.quick-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.quick-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 13px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: #fff;
    color: var(--text-2);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all .16s var(--ease);
    text-decoration: none;
}
.quick-card:hover { border-color: var(--brand-soft-2); background: var(--brand-soft); color: var(--brand-700); transform: translateY(-1px); }
.quick-card .chip-ico { width: 30px; height: 30px; border-radius: 9px; }
.quick-card small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }

.dl { margin: 0; display: grid; gap: 8px; }
.dl > div { display: flex; gap: 10px; align-items: baseline; }
.dl dt { font-size: 12px; color: var(--muted); min-width: 76px; }
.dl dd { margin: 0; font-size: 13px; word-break: break-all; }

/* ---------- 19. Login ---------- */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 18px;
    background:
        radial-gradient(900px 500px at 12% -10%, #e3ecff 0%, rgba(227, 236, 255, 0) 60%),
        radial-gradient(800px 480px at 90% 110%, #e9e5ff 0%, rgba(233, 229, 255, 0) 62%),
        #f5f7fc;
}
.login-card {
    width: 100%;
    max-width: 396px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 30px 28px;
    box-shadow: 0 30px 60px -34px rgba(15, 23, 42, .4);
    animation: fadeIn .3s var(--ease);
}
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 22px; text-align: center; }
.login-brand .brand-mark { width: 52px; height: 52px; border-radius: 16px; }
.login-brand h1 { font-size: 19px; font-weight: 750; letter-spacing: -.01em; }
.login-brand p { font-size: 12.5px; color: var(--muted); }
.login-foot { margin-top: 18px; text-align: center; font-size: 11.5px; color: var(--muted); line-height: 1.8; }
.login-card .alert { margin-bottom: 14px; }
.login-card .field + .field { margin-top: 13px; }
.login-card .btn { margin-top: 18px; }
.pwd-wrap { position: relative; }
.pwd-wrap .input { padding-right: 42px; }
.pwd-toggle {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: 0;
    background: transparent;
    color: var(--muted);
    border-radius: 8px;
    cursor: pointer;
}
.pwd-toggle:hover { color: var(--text-2); background: #f1f4f9; }

/* ---------- 20. Responsive ---------- */
@media (max-width: 1023px) {
    .sidebar {
        width: 282px;
        transform: translateX(-101%);
        box-shadow: var(--shadow-lg);
        border-right: 0;
    }
    body.nav-open .sidebar { transform: none; }
    .main { margin-left: 0; width: 100%; }
    .app.rail .sidebar { width: 282px; }
    .app.rail .main { margin-left: 0; }
    .app.rail .brand-text,
    .app.rail .nav-text,
    .app.rail .nav-chevron,
    .app.rail .nav-badge,
    .app.rail .user-meta,
    .app.rail .nav-label { display: revert; }
    .app.rail .nav-label { display: block; }
    .app.rail .sidebar-brand { padding: 0 16px; justify-content: flex-start; }
    .app.rail .nav-item,
    .app.rail .nav-group-head { justify-content: flex-start; padding: 10px 11px; }
    .app.rail .nav-sub-pad { margin-left: 20px; padding-left: 10px; border-left: 1px dashed var(--line-2); }
    .app.rail .user-card { justify-content: flex-start; padding: 9px 10px; flex-direction: row; }
    .app.rail .user-out { display: grid; }
    .app.rail .sidebar-scroll { padding: 12px 12px 18px; }
    .app.rail .sidebar-foot { padding: 10px; }
    .rail-toggle { display: none; }
    .drawer-close { display: grid; }
    .nav-toggle { display: grid; }
    .topbar { padding: 0 14px; gap: 10px; }
    .topbar-actions .btn span { display: none; }
    .topbar-actions .btn { width: 38px; padding: 0; }
    .content { padding: 16px 14px 48px; }
    .hero { padding: 18px; }
}

@media (max-width: 640px) {
    .topbar { height: 58px; }
    .topbar-title h1 { font-size: 15px; }
    .topbar-title p { display: none; }
    .page-head h2 { font-size: 19px; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stat { padding: 12px; }
    .stat-value { font-size: 21px; }
    .stat .chip-ico { width: 26px; height: 26px; right: 10px; top: 10px; border-radius: 8px; }
    .stat .chip-ico .ico { width: 15px; height: 15px; }
    .card-body { padding: 14px; }
    .card-head { padding: 13px 14px; }
    .list-row { padding: 12px 14px; flex-wrap: wrap; }
    .list-row.stack .list-actions { width: 100%; justify-content: flex-start; }
    .modal { align-items: flex-end; padding: 0; }
    .modal-card {
        max-width: none;
        border-radius: 20px 20px 0 0;
        max-height: 92vh;
        animation: sheetIn .24s var(--ease);
    }
    @keyframes sheetIn { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
    .toast-wrap { right: 12px; left: 12px; bottom: 12px; max-width: none; }
    .hero h2 { font-size: 18px; }
    .hero-actions { gap: 8px; }
    .hero-actions .btn { flex: 1 1 0; min-width: 116px; }
    .link-card-head { padding: 10px 12px; }
    .link-card-body { padding: 12px; }
    .inline-form { flex-wrap: nowrap; }
    .table th, .table td { padding: 10px 12px; }
}

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

/* ---------- 22. 生成链接页（sc.php） ---------- */
.gen-body {
    min-height: 100vh;
    padding: 26px 16px 56px;
    background:
        radial-gradient(900px 500px at 10% -10%, #e3ecff 0%, rgba(227, 236, 255, 0) 60%),
        radial-gradient(800px 480px at 90% 110%, #e9e5ff 0%, rgba(233, 229, 255, 0) 62%),
        #f5f7fc;
}
.gen-wrap { width: 100%; max-width: 520px; margin: 0 auto; }
.gen-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: 0 30px 60px -40px rgba(15, 23, 42, .45);
    overflow: hidden;
}
.gen-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, #fff, #fbfcff);
}
.gen-head .brand-mark { width: 40px; height: 40px; border-radius: 12px; }
.gen-title { font-size: 16px; font-weight: 750; letter-spacing: -.01em; }
.gen-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.gen-head .badge { margin-left: auto; }
.gen-in { padding: 18px; display: grid; gap: 14px; }
.gen-result {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--panel-2);
    padding: 14px;
    display: grid;
    gap: 10px;
    animation: fadeIn .25s var(--ease);
}
.gen-url {
    font-family: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--brand-700);
    word-break: break-all;
    background: #fff;
    border: 1px dashed var(--brand-soft-2);
    border-radius: 10px;
    padding: 10px 12px;
    user-select: all;
}
.gen-qr { display: grid; place-items: center; gap: 6px; padding-top: 6px; }
.gen-qr img, .gen-qr canvas { border-radius: 10px; background: #fff; }
.gen-foot {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 13px 18px;
    border-top: 1px solid var(--line);
    background: var(--panel-2);
    font-size: 12.5px;
}
.gen-foot a { display: inline-flex; align-items: center; gap: 5px; color: var(--text-3); }
.gen-foot a:hover { color: var(--brand); }
.gen-foot a.danger:hover { color: var(--danger); }

/* ---------- 23. 数据中心 ---------- */
.dc-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 11px;
    border-radius: 99px;
    border: 1px solid var(--line-2);
    background: #fff;
    color: var(--text-3);
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: all .16s var(--ease);
    -webkit-tap-highlight-color: transparent;
}
.filter-chip:hover { border-color: var(--brand-soft-2); color: var(--brand-700); background: var(--brand-soft); }
.filter-chip.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    box-shadow: 0 8px 16px -12px rgba(47, 107, 255, .95);
}

.spark { display: flex; align-items: flex-end; gap: 8px; height: 104px; padding-top: 6px; }
.spark-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; }
.spark-track { width: 100%; max-width: 46px; height: 60px; display: flex; align-items: flex-end; }
.spark-bar {
    width: 100%;
    max-width: 46px;
    border-radius: 8px 8px 4px 4px;
    background: linear-gradient(180deg, #9db9ff, #2f6bff);
    transition: height .4s var(--ease);
}
.spark-bar.is-empty { background: var(--line); }
.spark-val { font-size: 11px; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.spark-label { font-size: 10.5px; color: var(--muted); white-space: nowrap; }

.dist { display: grid; gap: 11px; }
.dist-row { display: grid; grid-template-columns: 96px 1fr 46px; gap: 10px; align-items: center; font-size: 12.5px; }
.dist-name { min-width: 0; display: flex; align-items: center; }
.dist-track { height: 9px; border-radius: 99px; background: #eef2f9; overflow: hidden; }
.dist-fill { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #6f97ff, #2f6bff); }
.dist-num { text-align: right; color: var(--text-3); font-variant-numeric: tabular-nums; }

.badge.c-wx { background: #e7f8ee; color: #0a7d3f; }
.badge.c-qq { background: #e8f0ff; color: #1a49c4; }
.badge.c-dy { background: #f1eaff; color: #5b21b6; }
.badge.c-br { background: #f1f4f9; color: #475569; }
.badge.c-alipay { background: #e6f4ff; color: #0b63b8; }
.badge.c-weibo { background: #feeceb; color: #b42318; }
.badge.c-other { background: #f3f4f6; color: #6b7280; }

.dev { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.dev .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.dev-ios .dot { background: #0f172a; }
.dev-android .dot { background: #12b76a; }
.dev-pc .dot { background: #2f6bff; }
.dev-pad .dot { background: #7a5af8; }

.table td.cell-mono { font-family: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.table.table-wide { min-width: 980px; }
.geo-cell .geo { color: var(--text-3); font-size: 12px; }
.geo-cell .geo-done { color: var(--text-2); }
.geo-cell .geo-fail { color: var(--muted); }
.text-ok { color: var(--ok); }
.text-danger { color: var(--danger); }
.dc-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

/* 手机端把明细表变成卡片，避免横向挤压 */
@media (max-width: 767px) {
    .table.table-wide { min-width: 0; }
    .table-cards thead { display: none; }
    .table-cards,
    .table-cards tbody,
    .table-cards tr,
    .table-cards td { display: block; width: auto; }
    .table-cards tr {
        padding: 8px 0;
        border-bottom: 8px solid var(--bg);
        background: #fff;
    }
    .table-cards tr:last-child { border-bottom: 0; }
    .table-cards tbody tr:hover { background: #fff; }
    .table-cards td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 4px 14px;
        border: 0;
        font-size: 12.5px;
        text-align: right;
    }
    .table-cards td::before {
        content: attr(data-label);
        flex: none;
        color: var(--muted);
        font-size: 11.5px;
        font-weight: 600;
        text-align: left;
    }
    .table-cards td > * { min-width: 0; }
    .table-cards td .truncate { max-width: 62vw !important; margin-left: auto; }
    .table-cards td.cell-mono { font-size: 12px; }
    .table-wrap { overflow-x: visible; }
}

/* ---------- 24. 视图切换 & 生成链接弹窗 ---------- */
[data-view-panel][hidden] { display: none !important; }
[data-view-panel] { animation: viewIn .18s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.gen-modal-body { display: grid; gap: 13px; }
.gen-hint { font-size: 12px; color: var(--muted); margin-top: -4px; }
.gen-out {
    border: 1px solid var(--brand-soft-2);
    background: var(--brand-soft);
    border-radius: var(--radius-md);
    padding: 12px;
    display: grid;
    gap: 8px;
}
.gen-out-link {
    font-family: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
    font-size: 12.5px;
    color: var(--brand-800);
    word-break: break-all;
    background: #fff;
    border: 1px dashed var(--brand-soft-2);
    border-radius: 9px;
    padding: 9px 11px;
    user-select: all;
}

/* ---------- 25. 生成链接页 ---------- */
.gen-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 16px; align-items: start; }
.gen-form { display: grid; gap: 14px; }
.gen-form .checkbox { align-items: flex-start; }
@media (max-width: 980px) {
    .gen-grid { grid-template-columns: 1fr; }
}

/* ---------- 25.5 拦截检测 ---------- */
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.seg-btn {
    display: inline-flex; align-items: center; gap: 6px;
    border: 0; background: transparent; cursor: pointer;
    padding: 6px 12px; border-radius: 8px; font-size: 12.5px; color: var(--text-2);
    transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}
.seg-btn em { font-style: normal; font-size: 11px; color: var(--muted); }
.seg-btn.is-on { background: #fff; color: var(--brand-700); box-shadow: var(--shadow-sm); }
.check-toolbar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-bottom: 14px; }
.check-plat { margin: 0; }
.check-list { display: grid; gap: 14px; }
.check-group { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.check-group-head {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px; border-bottom: 1px solid var(--line);
    background: var(--panel-2); font-size: 13px; font-weight: 650;
}
.check-group-head em { margin-left: auto; font-style: normal; color: var(--muted); font-size: 12px; font-weight: 400; }
.check-row {
    display: grid; grid-template-columns: 24px minmax(0, 1fr) 96px;
    gap: 10px; align-items: center;
    padding: 11px 14px; border-bottom: 1px solid var(--line);
}
.check-head {
    display: grid; grid-template-columns: 24px minmax(0, 1fr) 96px;
    gap: 10px; padding: 0 14px 8px; font-size: 11.5px; color: var(--muted);
}
.check-head span:last-child { text-align: center; }
.check-row:last-child { border-bottom: 0; }
.check-row:hover { background: #fbfcff; }
.check-main { min-width: 0; display: grid; gap: 2px; }
.check-name { font-size: 13.5px; font-weight: 600; }
.check-url {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11.5px; color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.check-cell { text-align: center; }
.check-status {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 54px; padding: 3px 8px; border-radius: 999px;
    border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
    font-size: 11.5px; white-space: nowrap;
}
.check-status.is-ok { color: #0f8a54; background: #e9f9f0; border-color: #b8ebcf; }
.check-status.is-blocked { color: #b42318; background: #fdeceb; border-color: #f6c6c1; }
.check-status.is-error { color: #8a5a00; background: #fff6e5; border-color: #f4ddb0; }
.settings-group { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 12px; }
.settings-group-title { display: flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 650; }
@media (max-width: 640px) {
    .check-row { grid-template-columns: 24px minmax(0, 1fr) 68px; padding: 10px 12px; }
    .check-url { font-size: 11px; }
    .check-head { display: none; }

    /* 手机端工具栏：一行一块，按钮不挤在一起 */
    .check-toolbar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        align-items: stretch;
    }
    .check-toolbar > .seg {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    .check-toolbar > .seg .seg-btn { justify-content: center; }
    .check-toolbar > [data-check-run] { grid-column: 1 / -1; }
    .check-toolbar > [data-check-all] { grid-column: 1 / 2; }
    .check-toolbar > [data-check-del] { grid-column: 2 / 3; }
    .check-toolbar > [data-check-progress],
    .check-toolbar > [data-rate-info] {
        grid-column: 1 / -1;
        text-align: left;
        line-height: 1.6;
    }
    .check-toolbar > .hint-inline { margin: 0; }
}
/* ---------- 26. 二维码组件 ---------- */
.qr-widget { display: grid; gap: 10px; justify-items: center; }
.qr-stage { display: flex; justify-content: center; min-height: 40px; }
.qr-box {
    position: relative;
    display: inline-block;
    background: #fff;
    padding: 10px;
    border-radius: 14px;
    border: 1px solid var(--line);
}
.qr-box canvas { display: block; border-radius: 6px; }
.qr-logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 22%;
    height: 22%;
    background: #fff;
    padding: 3px;
    border-radius: 8px;
    object-fit: contain;
    box-shadow: 0 0 0 3px #fff, 0 2px 8px rgba(15, 23, 42, .12);
}
.qr-tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.qr-empty { color: var(--muted); font-size: 12.5px; padding: 22px 10px; text-align: center; }
/* 二维码图标库 */
.qr-presets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    gap: 8px;
    width: 100%;
    max-width: 360px;
    margin-top: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel-2);
}
.qr-presets[hidden] { display: none; }
.qr-preset {
    position: relative;
    padding: 0;
    aspect-ratio: 1 / 1;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
    cursor: pointer;
    transition: transform .2s var(--ease, ease), border-color .2s ease, box-shadow .2s ease;
}
.qr-preset img { width: 100%; height: 100%; object-fit: cover; display: block; }
.qr-preset:hover { transform: translateY(-1px); border-color: var(--brand); }
.qr-preset.is-active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.qr-preset.is-active::after {
    content: "✓";
    position: absolute; right: 3px; bottom: 2px;
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--brand); color: #fff;
    font-size: 10px; line-height: 14px; text-align: center;
}
[data-qr-lib].is-on { background: var(--brand-soft); color: var(--brand-700); }
/* sc.php 的二维码：中心图标按二维码本身定位 */
.qr-holder .qr-logo {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: 22%; height: auto; aspect-ratio: 1/1; background: #fff; padding: 3px;
    border-radius: 8px; object-fit: contain; box-shadow: 0 0 0 3px #fff, 0 2px 8px rgba(15, 23, 42, .12);
}

/* ---------- 27. Print ---------- */
@media print {
    .sidebar, .topbar, .scrim, .toast-wrap, .btn, .icon-btn { display: none !important; }
    .main { margin: 0; width: 100%; }
    body { background: #fff; }
}
