/* ==========================================================================
   8J 控制台 · 设计系统
   --------------------------------------------------------------------------
   1. tokens        颜色 / 字号 / 间距 / 圆角 / 阴影
   2. base          重置与排版
   3. shell         侧栏 / 顶栏 / 内容区
   4. components    按钮 / 卡片 / 表格 / 表单 / 徽章 / 提示 / 空状态 / 骨架 / 弹层
   5. modules       账号 / 转发 / 代理 / 选择器 等业务块
   6. responsive    断点
   ========================================================================== */

/* ---------------------------------------------------------------- 1. tokens */
:root {
    --bg: #f6f8fc;
    --bg-soft: #eef2f9;
    --surface: #ffffff;
    --surface-2: #fbfcfe;
    --line: #e6ecf5;
    --line-soft: #f0f4fa;
    --line-strong: #d8e1ee;

    --text: #0f172a;
    --text-2: #475569;
    --text-3: #8394a9;
    --text-inv: #f8fafc;

    --brand: #2563eb;
    --brand-hover: #1d4ed8;
    --brand-soft: #eef4ff;
    --brand-line: #cfe0ff;

    --ok: #0f9d6e;
    --ok-soft: #ecfdf5;
    --ok-line: #b7ebd3;
    --warn: #b45309;
    --warn-soft: #fffbeb;
    --warn-line: #fde68a;
    --danger: #d92d20;
    --danger-soft: #fef3f2;
    --danger-line: #fecdc9;
    --info: #4f46e5;
    --info-soft: #eef2ff;
    --info-line: #dbe2ff;

    --side-bg: #0b1220;
    --side-bg-2: #101a2e;
    --side-text: #9fb0c7;
    --side-text-hi: #ffffff;
    --side-line: rgba(255, 255, 255, .07);

    --r-xs: 6px;
    --r-sm: 9px;
    --r: 12px;
    --r-lg: 16px;
    --r-xl: 20px;
    --r-pill: 999px;

    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-7: 32px;

    --fs-11: 11px;
    --fs-12: 12px;
    --fs-13: 13px;
    --fs-14: 14px;
    --fs-15: 15px;
    --fs-16: 16px;
    --fs-20: 20px;
    --fs-24: 24px;
    --fs-28: 28px;

    --sh-1: 0 1px 2px rgba(15, 23, 42, .05);
    --sh-2: 0 2px 10px rgba(15, 23, 42, .05);
    --sh-3: 0 10px 30px rgba(15, 23, 42, .09);
    --sh-4: 0 24px 60px rgba(15, 23, 42, .16);

    --side-w: 248px;
    --top-h: 58px;
    --ease: cubic-bezier(.22, .8, .28, 1);
    --t-fast: 120ms;
    --t: 180ms;
}

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

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, Arial, sans-serif;
    font-size: var(--fs-14);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
    margin: 0 0 var(--sp-3);
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--text);
    line-height: 1.35;
}
h1 { font-size: var(--fs-24); }
h2 { font-size: var(--fs-16); }
h3 { font-size: var(--fs-14); }
p { margin: 0 0 var(--sp-3); }

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }

code, .code, pre {
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-variant-ligatures: none;
}

::selection { background: #dbeafe; color: #0b1220; }

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: var(--r-xs);
}

/* 细滚动条，长表格和日志区都受益 */
* { scrollbar-width: thin; scrollbar-color: #c6d2e2 transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb {
    background: #c6d2e2;
    border: 2px solid transparent;
    background-clip: content-box;
    border-radius: var(--r-pill);
}
*::-webkit-scrollbar-thumb:hover { background: #a9b8cd; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

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

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: var(--side-w);
    display: flex;
    flex-direction: column;
    padding: var(--sp-4) var(--sp-3) var(--sp-3);
    color: var(--side-text);
    background:
        radial-gradient(120% 60% at 0% 0%, #17253f 0%, transparent 60%),
        linear-gradient(180deg, var(--side-bg-2) 0%, var(--side-bg) 100%);
    border-right: 1px solid rgba(255, 255, 255, .04);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 2px 6px 18px;
    font-size: var(--fs-15);
    font-weight: 700;
    color: var(--side-text-hi);
    letter-spacing: -.01em;
}
.brand::before {
    content: "";
    width: 28px;
    height: 28px;
    flex: none;
    border-radius: 9px;
    background:
        linear-gradient(145deg, #3b82f6, #1e40af);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16), 0 4px 12px rgba(37, 99, 235, .35);
}

.sidebar nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 2px;
}

.nav-group {
    margin: 14px 0 6px;
    padding: 0 10px;
    font-size: var(--fs-11);
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #64748b;
}
.nav-group:first-child { margin-top: 4px; }

.sidebar nav a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    margin: 2px 0;
    border-radius: 10px;
    color: var(--side-text);
    font-size: var(--fs-13);
    font-weight: 500;
    transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.sidebar nav a:hover {
    background: rgba(255, 255, 255, .06);
    color: var(--side-text-hi);
}
.sidebar nav a.active {
    background: linear-gradient(90deg, rgba(37, 99, 235, .28), rgba(37, 99, 235, .10));
    color: var(--side-text-hi);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, .28);
}
.sidebar nav a.active::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 50%;
    width: 3px;
    height: 16px;
    margin-top: -8px;
    border-radius: 0 3px 3px 0;
    background: #60a5fa;
}
.sidebar nav a .ico {
    width: 16px;
    height: 16px;
    flex: none;
    opacity: .85;
}
.sidebar nav a.active .ico { opacity: 1; }

.side-foot {
    margin-top: 10px;
    padding: 12px 12px 4px;
    border-top: 1px solid var(--side-line);
    color: #7c8ea6;
    font-size: var(--fs-12);
    line-height: 1.7;
}
.side-foot a { color: #93c5fd; }
.side-foot a:hover { color: #bfdbfe; }

.shell {
    flex: 1;
    min-width: 0;
    margin-left: var(--side-w);
    display: flex;
    flex-direction: column;
}

.top {
    position: sticky;
    top: 0;
    z-index: 30;
    height: var(--top-h);
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: 0 var(--sp-6);
    background: rgba(246, 248, 252, .82);
    backdrop-filter: saturate(160%) blur(10px);
    -webkit-backdrop-filter: saturate(160%) blur(10px);
    border-bottom: 1px solid var(--line);
}
.top h1 {
    margin: 0;
    font-size: var(--fs-16);
    font-weight: 700;
}

.crumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--fs-13);
    color: var(--text-3);
    min-width: 0;
}
.crumb b {
    color: var(--text);
    font-size: var(--fs-15);
    font-weight: 700;
    letter-spacing: -.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.crumb .sep { color: #cbd5e1; }
.crumb a { color: var(--text-2); }
.crumb a:hover { color: var(--brand); }

.top-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 10px 0 4px;
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    background: var(--surface);
    font-size: var(--fs-12);
    color: var(--text-2);
    box-shadow: var(--sh-1);
}
.user-chip .ava {
    width: 24px;
    height: 24px;
    border-radius: var(--r-pill);
    display: grid;
    place-items: center;
    font-size: var(--fs-11);
    font-weight: 700;
    color: #fff;
    background: linear-gradient(145deg, #6366f1, #2563eb);
}

.menu-btn {
    display: none;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text-2);
    cursor: pointer;
}

.main {
    flex: 1;
    width: 100%;
    min-width: 0;
    /* 全宽铺满侧栏以外的空间；超宽屏靠 padding 留呼吸，不再用 max-width 把内容挤到中间 */
    padding: 22px 26px 32px;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--sp-4);
    margin-bottom: var(--sp-5);
}
.page-head h1 { margin: 0; font-size: var(--fs-24); }
.page-sub {
    margin: 6px 0 0;
    color: var(--text-3);
    font-size: var(--fs-13);
}
.page-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-wrap: wrap;
}

/* 侧栏遮罩，仅移动端出现 */
.side-mask {
    position: fixed;
    inset: 0;
    z-index: 39;
    background: rgba(15, 23, 42, .45);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t) var(--ease);
}
.side-mask.on { opacity: 1; pointer-events: auto; }

/* ------------------------------------------------------------ 4. components */

/* 卡片：默认无重阴影，靠边框与留白分层 */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: var(--sp-5);
    margin-bottom: var(--sp-4);
    box-shadow: var(--sh-1);
}

/* 标题在卡片首位时自动成为卡头，避免每页手写结构 */
.card > h2:first-child,
.card > h3:first-child {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 var(--sp-4);
    padding-bottom: var(--sp-3);
    border-bottom: 1px solid var(--line-soft);
    font-size: var(--fs-15);
    font-weight: 700;
}
.card > h2:first-child::before {
    content: "";
    width: 3px;
    height: 14px;
    border-radius: 2px;
    background: var(--brand);
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
}

.stat {
    position: relative;
    padding: var(--sp-4) var(--sp-5);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
    overflow: hidden;
    transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.stat:hover { border-color: var(--line-strong); box-shadow: var(--sh-2); }
.stat .muted {
    display: block;
    font-size: var(--fs-12);
    font-weight: 500;
}
.stat b {
    display: block;
    margin-top: 6px;
    font-size: var(--fs-28);
    font-weight: 700;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}

.muted { color: var(--text-3); }
.small { font-size: var(--fs-12); }
.nowrap { white-space: nowrap; }

/* 按钮 */

/* 按钮：默认是“次要按钮”（白底描边），.primary 才是主操作，.danger 是危险操作。
   一个区域里最多一个 .primary，其余用默认样式，视觉层级才立得住。 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    padding: 0 13px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: var(--fs-13);
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
    box-shadow: var(--sh-1);
    transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
                box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease),
                color var(--t-fast) var(--ease);
}
.btn:hover {
    background: var(--surface-2);
    border-color: #c3cfdf;
    color: var(--text);
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--brand-line); outline-offset: 1px; }
.btn:disabled,
.btn[aria-busy="true"] {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
}
.btn[aria-busy="true"]::before {
    content: "";
    width: 12px;
    height: 12px;
    border-radius: var(--r-pill);
    border: 2px solid rgba(15, 23, 42, .18);
    border-top-color: currentColor;
    animation: spin .7s linear infinite;
}

/* 主操作 */
.btn.primary,
.btn.blue {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, .22);
}
.btn.primary:hover,
.btn.blue:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }

/* 危险操作：白底红字，hover 才上浅红，避免整屏都是红块 */
.btn.danger,
.btn.red {
    background: var(--surface);
    border-color: var(--danger-line);
    color: #b42318;
    box-shadow: none;
}
.btn.danger:hover,
.btn.red:hover { background: var(--danger-soft); border-color: #f4a9a2; color: #b42318; }

/* 正向操作 */
.btn.green {
    background: var(--surface);
    border-color: var(--ok-line);
    color: #067a55;
    box-shadow: none;
}
.btn.green:hover { background: var(--ok-soft); border-color: #a5e6cd; color: #067a55; }

.btn.yellow {
    background: var(--surface);
    border-color: var(--warn-line);
    color: var(--warn);
    box-shadow: none;
}
.btn.yellow:hover { background: var(--warn-soft); border-color: #fbdc94; color: #8a5308; }

.btn.gray {
    background: var(--surface);
    border-color: var(--line-strong);
    color: var(--text-2);
}
.btn.gray:hover {
    background: var(--surface-2);
    border-color: #c3cfdf;
    color: var(--text);
}

.btn.ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-2);
    box-shadow: none;
}
.btn.ghost:hover { background: var(--line-soft); color: var(--text); }

.btn.sm { min-height: 28px; padding: 0 10px; font-size: var(--fs-12); border-radius: 8px; }
.btn.icon { padding: 0; width: 34px; }

.btn.sm {
    min-height: 30px;
    padding: 0 10px;
    font-size: var(--fs-12);
    border-radius: 8px;
}
.btn.icon { width: 36px; padding: 0; }

/* 表单 */
.form-row { margin-bottom: var(--sp-4); }
.form-row > label,
.field-label {
    display: block;
    margin-bottom: 6px;
    font-size: var(--fs-13);
    font-weight: 600;
    color: var(--text-2);
}
.input,
textarea,
select {
    width: 100%;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: var(--fs-14);
    transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.input::placeholder,
textarea::placeholder { color: #a3b0c2; }
.input:hover,
textarea:hover,
select:hover { border-color: #c3cfdf; }
.input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .16);
}
.input:disabled,
textarea:disabled,
select:disabled {
    background: var(--bg-soft);
    color: var(--text-3);
    cursor: not-allowed;
}
.input[aria-invalid="true"] {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(217, 45, 32, .12);
}
textarea { min-height: 110px; resize: vertical; line-height: 1.65; }
textarea.short { min-height: 72px; }
select {
    appearance: none;
    padding-right: 34px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%2364748b' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}
input[type="checkbox"],
input[type="radio"] {
    width: 15px;
    height: 15px;
    min-height: 0;
    padding: 0;
    border-radius: 4px;
    accent-color: var(--brand);
    cursor: pointer;
}
input[type="date"],
input[type="datetime-local"],
input[type="time"] { font-variant-numeric: tabular-nums; }

.two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-4);
}
.three {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--sp-3);
}

/* 表格 */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
    font-size: var(--fs-13);
}
.table th,
.table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--line-soft);
    text-align: left;
    vertical-align: middle;
}
/* 标记了 .wide 的列吃掉剩余宽度，其余列收到内容宽 */
.table .wide { width: 100%; }

/* 只装一个状态标签的列不需要那么宽，把空间让给内容列 */
.table td:has(> .badge:only-child),
.table th:has(+ td .badge),
.table td.num,
.table th:last-child:has(+ th) { width: 1%; white-space: nowrap; }

.table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    font-size: var(--fs-11);
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-3);
    white-space: nowrap;
}
.table tbody tr { transition: background var(--t-fast) var(--ease); }
.table tbody tr:hover { background: #f8fafd; }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num,
.table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .table-empty td {
    padding: 40px 16px;
    text-align: center;
    color: var(--text-3);
}

/* 表格横向滚动容器；JS 会给未包裹的 .table 自动加上 */
.table-scroll { position: relative; }
.table-scroll::after {
    content: "";
    position: absolute;
    top: 1px;
    right: 1px;
    bottom: 1px;
    width: 34px;
    pointer-events: none;
    border-radius: 0 var(--r-lg) var(--r-lg) 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(15, 23, 42, .07));
    opacity: 0;
    transition: opacity var(--t) var(--ease);
}
.table-scroll.has-more::after { opacity: 1; }
.card-flush > .table-scroll::after { border-radius: 0; }

.table-wrap {
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    overflow: auto;
    box-shadow: var(--sh-1);
}
.table-wrap > .table { border: 0; }
.table-wrap > .table th:first-child,
.table-wrap > .table td:first-child { padding-left: 16px; }
.table-wrap > .table th:last-child,
.table-wrap > .table td:last-child { padding-right: 16px; }
.scroll-x { position: relative; }
.scroll-x::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 24px;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, rgba(15, 23, 42, .06));
    opacity: 0;
    transition: opacity var(--t);
}

/* 徽章 */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border-radius: var(--r-pill);
    font-size: var(--fs-12);
    font-weight: 600;
    line-height: 1.7;
    white-space: nowrap;
}
.badge::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: var(--r-pill);
    background: currentColor;
    opacity: .85;
}
.badge.on { background: var(--ok-soft); color: #067a55; box-shadow: inset 0 0 0 1px var(--ok-line); }
.badge.off { background: var(--danger-soft); color: #b42318; box-shadow: inset 0 0 0 1px var(--danger-line); }
.badge.wait { background: var(--info-soft); color: #4338ca; box-shadow: inset 0 0 0 1px var(--info-line); }
.badge.limit { background: var(--warn-soft); color: var(--warn); box-shadow: inset 0 0 0 1px var(--warn-line); }
.badge.info { background: var(--bg-soft); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line); }

/* 提示条 */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: var(--sp-4);
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface);
    font-size: var(--fs-13);
    line-height: 1.6;
    animation: fade-in var(--t) var(--ease);
}
.alert::before {
    content: "";
    width: 6px;
    height: 6px;
    margin-top: 7px;
    flex: none;
    border-radius: var(--r-pill);
    background: currentColor;
}
.alert.ok { background: var(--ok-soft); border-color: var(--ok-line); color: #067a55; }
.alert.err { background: var(--danger-soft); border-color: var(--danger-line); color: #b42318; }
.alert.warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }

.help {
    padding: 12px 14px;
    margin-bottom: var(--sp-4);
    background: var(--warn-soft);
    border: 1px solid var(--warn-line);
    border-radius: var(--r);
    color: #8a5308;
    font-size: var(--fs-13);
    line-height: 1.75;
}
.help a { color: #8a5308; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.help code, .help .code {
    display: inline-block;
    padding: 1px 6px;
    border-radius: var(--r-xs);
    background: rgba(180, 83, 9, .10);
    color: #7c3d06;
}

.code {
    display: block;
    padding: 12px 14px;
    border-radius: var(--r);
    background: #0f172a;
    color: #cbd5e1;
    font-size: var(--fs-12);
    line-height: 1.7;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}
.actions form { margin: 0; }
.endpoint {
    display: flex;
    justify-content: space-between;
    gap: var(--sp-3);
    align-items: flex-start;
    padding: 11px 0;
    border-bottom: 1px solid var(--line-soft);
}
.endpoint:last-child { border-bottom: 0; }
.endpoint form { margin: 0; }

.pagination {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: var(--sp-4);
    font-size: var(--fs-13);
}
.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text-2);
    background: var(--surface);
}
.pagination a:hover { border-color: var(--brand-line); color: var(--brand); }
.pagination .on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* 空状态（JS 自动填充到空表格与空容器） */
.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 44px 20px;
    text-align: center;
    color: var(--text-3);
}
.empty .empty-ico {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--bg-soft);
    color: #9aa9bd;
}
.empty b { color: var(--text-2); font-size: var(--fs-14); font-weight: 600; }
.empty span { font-size: var(--fs-12); max-width: 340px; line-height: 1.65; }

/* 骨架屏 */
.skeleton {
    position: relative;
    overflow: hidden;
    border-radius: var(--r-sm);
    background: #eef2f8;
    color: transparent !important;
}
.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .75), transparent);
    transform: translateX(-100%);
    animation: shimmer 1.15s infinite;
}

/* 弹层（确认框） */
.modal-mask {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(15, 23, 42, .42);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t) var(--ease);
}
.modal-mask.on { opacity: 1; pointer-events: auto; }
.modal {
    width: min(420px, 100%);
    padding: 22px;
    background: var(--surface);
    border-radius: var(--r-xl);
    box-shadow: var(--sh-4);
    transform: translateY(10px) scale(.98);
    transition: transform var(--t) var(--ease);
}
.modal-mask.on .modal { transform: none; }
.modal h3 { margin: 0 0 8px; font-size: var(--fs-16); }
.modal p { margin: 0 0 20px; color: var(--text-2); font-size: var(--fs-13); line-height: 1.7; }
.modal .modal-foot { display: flex; justify-content: flex-end; gap: 8px; }

/* 轻提示 */
.toasts {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: min(380px, calc(100vw - 32px));
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 11px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 3px solid var(--brand);
    border-radius: var(--r);
    box-shadow: var(--sh-3);
    font-size: var(--fs-13);
    color: var(--text);
    animation: toast-in .22s var(--ease);
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--danger); }
.toast.warn { border-left-color: #d97706; }
.toast.out { animation: toast-out .18s var(--ease) forwards; }

/* 开关（供 .seg / 表单使用） */
.switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 40px;
    height: 22px;
    flex: none;
    border-radius: var(--r-pill);
    background: #cfd8e6;
    cursor: pointer;
    transition: background var(--t) var(--ease);
}
.switch::after {
    content: "";
    position: absolute;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: var(--r-pill);
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .25);
    transition: transform var(--t) var(--ease);
}
.switch.on { background: var(--brand); }
.switch.on::after { transform: translateX(18px); }

/* 分段选择 */
.seg {
    display: flex;
    gap: 3px;
    padding: 3px;
    border-radius: var(--r);
    background: #eef2f8;
    border: 1px solid var(--line-soft);
}
.seg label {
    position: relative;
    flex: 1;
    display: block;
    margin: 0;
    padding: 7px 8px;
    border-radius: 9px;
    text-align: center;
    font-size: var(--fs-13);
    font-weight: 600;
    color: var(--text-2);
    cursor: pointer;
    transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:hover { color: var(--text); }
.seg label:has(input:checked) {
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 0 0 1px var(--line-strong), var(--sh-1);
}
.relay .form-row .seg label,
.relay .form-row .seg label:has(input:checked) { margin: 0; }

/* 折叠块 */
.more,
.relay-extra { margin-top: 10px; }
.more summary,
.relay-extra summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    color: var(--text-2);
    font-size: var(--fs-13);
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.more summary::-webkit-details-marker,
.relay-extra summary::-webkit-details-marker { display: none; }
.more summary::before,
.relay-extra summary::before {
    content: "";
    width: 6px;
    height: 6px;
    border-right: 1.6px solid currentColor;
    border-bottom: 1.6px solid currentColor;
    transform: rotate(-45deg);
    transition: transform var(--t) var(--ease);
}
.more[open] summary::before,
.relay-extra[open] summary::before { transform: rotate(45deg); }
.more[open] > *,
.relay-extra[open] > * { animation: fade-in var(--t) var(--ease); }

.section-gap {
    margin: var(--sp-5) 0 var(--sp-3);
    font-size: var(--fs-15);
    font-weight: 700;
}

/* ---------------------------------------------------------------- 5. modules */

/* 工具栏：筛选与操作同一条带子，左侧筛选、右侧操作，组间用细分隔线分开 */
.toolbar,
.acct-tools {
    display: flex;
    gap: var(--sp-2);
    align-items: center;
    flex-wrap: wrap;
    padding: 10px var(--sp-4);
    margin-bottom: var(--sp-4);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
}
.toolbar .input,
.toolbar select,
.acct-tools .input,
.acct-tools select { width: auto; min-width: 200px; height: 34px; }
.toolbar .input[type="search"] { min-width: 240px; }
.toolbar-spacer,
.acct-tools-gap { flex: 1 1 auto; min-width: 8px; }

/* 操作分组：组与组之间一条竖线，语义上“筛选 / 批量 / 新增 / 危险”各自成团 */
.toolbar-group {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}
.toolbar-group + .toolbar-group {
    padding-left: 10px;
    margin-left: 2px;
    border-left: 1px solid var(--line);
}
.toolbar-label {
    font-size: var(--fs-12);
    color: var(--text-3);
    margin-right: 2px;
    white-space: nowrap;
}

/* 按钮层级：primary 蓝实心（每屏一个）/ 默认次要 / danger 红描边 / ghost 无边框 */
.btn.primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, .22);
}
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.danger {
    background: var(--surface);
    border-color: var(--danger-line);
    color: #b42318;
}
.btn.danger:hover { background: var(--danger-soft); border-color: #f4a9a2; }
.btn.ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-2);
}
.btn.ghost:hover { background: var(--line-soft); color: var(--text); }

/* 表格滚动条带子（日志、列表通用） */
.table-tall { max-height: 380px; }
.table-tall .table-wrap { max-height: 380px; overflow-y: auto; }
.table-tall .table thead th,
.table-tall .table tr:first-child th { position: sticky; top: 0; z-index: 2; }

/* 账号 */
/* 账号页：tab 与筛选/操作合并成一张卡，避免顶部一块块断开 */
.toolbar-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
    margin-bottom: 14px;
    overflow: hidden;
}
.toolbar-card .acct-tabs { padding: 12px 16px 0; margin: 0; }
.toolbar-card .acct-tools {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: none;
    border-top: 1px solid var(--line-soft);
}
.acct-tabs {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    margin-bottom: var(--sp-3);
    background: var(--line-soft);
    border: 1px solid var(--line);
    border-radius: 11px;
}
.acct-tabs button {
    padding: 6px 14px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-2);
    font: inherit;
    font-size: var(--fs-13);
    font-weight: 600;
    cursor: pointer;
    transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.acct-tabs button:hover { color: var(--text); background: rgba(255, 255, 255, .6); }
.acct-tabs button.on {
    background: var(--surface);
    color: var(--brand);
    box-shadow: var(--sh-1);
}

.acct-tools {
    display: flex;
    gap: var(--sp-2);
    align-items: center;
    flex-wrap: wrap;
    padding: var(--sp-3) var(--sp-4);
    margin-bottom: var(--sp-4);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
}
.acct-tools .input,
.acct-tools select { width: 240px; }
.acct-tools-gap { flex: 1; }

.acct-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-4);
}
.acct-card {
    padding: var(--sp-4);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
    transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.acct-card:hover { border-color: var(--line-strong); box-shadow: var(--sh-2); }
.acct-card.work { border-color: var(--ok-line); background: linear-gradient(180deg, #f7fefb, var(--surface) 60%); }
.acct-title { font-size: var(--fs-15); font-weight: 700; }
.acct-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.acct-person { display: flex; gap: 10px; align-items: center; }
.acct-avatar {
    width: 44px;
    height: 44px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    color: #fff;
    font-size: var(--fs-16);
    font-weight: 700;
    object-fit: cover;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
}
.acct-avatar.sm { width: 32px; height: 32px; border-radius: 10px; font-size: var(--fs-13); }
.acct-pick { display: flex; gap: var(--sp-3); align-items: center; margin-bottom: var(--sp-4); }
.acct-inline { display: inline; }
.acct-err { color: #b42318; max-width: 320px; white-space: normal; line-height: 1.5; font-size: var(--fs-12); }
.acct-error { margin-top: 8px; color: #b42318; font-size: var(--fs-12); line-height: 1.55; }
.acct-panel > td {
    padding: 0 !important;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
}
.acct-manage-box {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px;
    align-items: start;
}
.acct-manage-box > .inline-form {
    margin: 0;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    flex-wrap: nowrap;
}
.acct-manage-box > .inline-form .input,
.acct-manage-box > .inline-form select {
    flex: 1 1 110px;
    min-width: 0;
    height: 32px;
    font-size: var(--fs-13);
}
.acct-manage-box > .inline-form .btn { min-height: 32px; padding: 0 11px; }
.acct-manage-box > .muted,
.acct-manage-box > span { grid-column: 1 / -1; font-size: var(--fs-12); margin: 0; }
.acct-manage-box > .login-qr { justify-self: start; border-radius: var(--r); }
.acct-table-card { padding: 0; overflow: auto; }
.acct-table { width: 100%; min-width: 1180px; }
.acct-table.slim { width: 100%; min-width: 720px; }
/* 列宽：只给每列一个「最小宽」，剩下的空间由浏览器按内容比例摊开，
   这样宽屏不会出现某一列被拉得特别空、而别的列挤成一团 */
.acct-table tr:not(.acct-panel) > th:nth-child(2),
.acct-table tr:not(.acct-panel) > td:nth-child(2) { min-width: 60px; }
.acct-table tr:not(.acct-panel) > th:nth-child(3),
.acct-table tr:not(.acct-panel) > td:nth-child(3) { min-width: 200px; }
.acct-table tr:not(.acct-panel) > th:nth-child(4),
.acct-table tr:not(.acct-panel) > td:nth-child(4) { min-width: 130px; }
.acct-table tr:not(.acct-panel) > th:nth-child(5),
.acct-table tr:not(.acct-panel) > td:nth-child(5) { min-width: 116px; }
.acct-table tr:not(.acct-panel) > th:nth-child(6),
.acct-table tr:not(.acct-panel) > td:nth-child(6) { min-width: 82px; }
.acct-table tr:not(.acct-panel) > th:nth-child(7),
.acct-table tr:not(.acct-panel) > td:nth-child(7) { min-width: 88px; }
.acct-table tr:not(.acct-panel) > th:nth-child(8),
.acct-table tr:not(.acct-panel) > td:nth-child(8) { min-width: 124px; }
.acct-table tr:not(.acct-panel) > th:nth-child(9),
.acct-table tr:not(.acct-panel) > td:nth-child(9) { min-width: 176px; }
.acct-table tr:not(.acct-panel) > th:nth-child(10),
.acct-table tr:not(.acct-panel) > td:nth-child(10) { min-width: 200px; }
/* 长文本列：不换行，超出用省略号，悬浮看全文（title） */
.acct-table tr:not(.acct-panel) > td:nth-child(9),
.acct-table tr:not(.acct-panel) > td:nth-child(10) {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* 列宽只在两处硬约束，其余交给内容：勾选窄、操作列固定、错误列截断 */
.acct-table tr:not(.acct-panel) > th:first-child,
.acct-table tr:not(.acct-panel) > td:first-child {
    width: 36px;
    padding-right: 0;
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--surface);
}
.acct-table tr:not(.acct-panel) > th:last-child,
.acct-table tr:not(.acct-panel) > td:last-child {
    width: 152px;
    white-space: nowrap;
    position: sticky;
    right: 0;
    z-index: 2;
    background: var(--surface);
    box-shadow: -10px 0 12px -10px rgba(15, 23, 42, .22);
}
.acct-table th { background: var(--surface-2); }
.acct-table th:first-child,
.acct-table th:last-child { background: var(--surface-2); }
/* 横向滚动时表头始终在最上层 */
.acct-table th:last-child { z-index: 3; }
.acct-table tr:not(.acct-panel) > td:nth-child(7) { white-space: nowrap; }
.acct-table tr:not(.acct-panel) > td:nth-child(8) { white-space: nowrap; }
/* 展开行：改成右侧抽屉。不占表格空间，表单在 400px 宽度里排得开，
   点“管理”再点一次即收起（沿用原来的 hidden 切换，JS 不用改）。 */
/* 注意：必须带 :not([hidden])，否则 display:block 会盖掉 [hidden] 的隐藏效果，抽屉一进页面就弹出来 */
.acct-table tr.acct-panel:not([hidden]) { display: block; }
.acct-table tr.acct-panel > td {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 420px;
    max-width: 100vw;
    display: flex;
    flex-direction: column;
    overflow: auto;
    padding: 0 !important;
    background: var(--surface);
    border-left: 1px solid var(--line);
    box-shadow: -24px 0 56px rgba(15, 23, 42, .18);
    z-index: 240;
    animation: drawer-in .18s var(--ease) both;
}
.acct-table tr.acct-panel > td::before {
    content: "账号设置";
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 15px 18px;
    font-size: var(--fs-14);
    font-weight: 700;
    color: var(--text);
    background: var(--surface);
    border-bottom: 1px solid var(--line-soft);
}
@keyframes drawer-in { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }

/* 抽屉遮罩与关闭按钮（由 admin.js 生成，只作用于账号管理页） */
.drawer-mask {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .32);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-fast) var(--ease);
    z-index: 239;
}
.drawer-mask.on { opacity: 1; pointer-events: auto; }
.drawer-close {
    position: fixed;
    top: 12px;
    right: 14px;
    width: 30px;
    height: 30px;
    display: none;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text-2);
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    z-index: 241;
    transition: all var(--t-fast) var(--ease);
}
.drawer-close.on { display: flex; }
.drawer-close:hover { background: var(--surface-2); color: var(--text); }

/* 抽屉里的表单：空间窄，允许换行，别把复选框压成竖排 */
.acct-manage-box .inline-form { flex-wrap: wrap; }
.acct-manage-box .inline-form label { white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.acct-manage-box .inline-form .input,
.acct-manage-box .inline-form input[type="text"] { flex: 1 1 140px; min-width: 0; }

.acct-manage-box {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    gap: 10px;
    padding: 14px;
    align-items: start;
}
.acct-manage-box > .inline-form {
    margin: 0;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    flex-wrap: nowrap;
}
.acct-manage-box > .inline-form .input,
.acct-manage-box > .inline-form select {
    flex: 1 1 110px;
    min-width: 0;
    height: 32px;
    font-size: var(--fs-13);
}
.acct-manage-box > .inline-form .btn { min-height: 32px; padding: 0 11px; }
.acct-manage-box > .muted,
.acct-manage-box > span { grid-column: 1 / -1; font-size: var(--fs-12); margin: 0; }
.acct-manage-box > .login-qr { justify-self: start; border-radius: var(--r); }
.acct-table-card { padding: 0; overflow: auto; }
.acct-table { min-width: 1140px; }
.acct-table.slim { min-width: 720px; }
/* 列宽只在两处硬约束，其余交给内容：勾选窄、操作列固定、错误列截断 */
.acct-table tr:not(.acct-panel) > th:first-child,
.acct-table tr:not(.acct-panel) > td:first-child {
    width: 36px;
    padding-right: 0;
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--surface);
}
.acct-table tr:not(.acct-panel) > th:last-child,
.acct-table tr:not(.acct-panel) > td:last-child {
    width: 176px;
    white-space: nowrap;
    position: sticky;
    right: 0;
    z-index: 2;
    background: var(--surface);
    box-shadow: -10px 0 12px -10px rgba(15, 23, 42, .22);
}
/* 展开行：脱离表格列宽，变成整宽块，避免被列宽挤成一条 */
.acct-table td { vertical-align: middle; padding-top: 8px; padding-bottom: 8px; }
.acct-table th { padding-top: 10px; padding-bottom: 10px; font-size: var(--fs-12); }
.acct-table .acct-err { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-table .acct-person b { font-weight: 600; }
.acct-table .acct-person .badge { margin-left: 4px; }
.acct-table .nowrap { white-space: nowrap; }
/* 行内只留“日志/管理/删除”，改资料与用户名收进管理面板（功能不变） */
.acct-table .acct-profile,
.acct-table .acct-username { display: none; }
.acct-table td:last-child .btn { min-height: 28px; padding: 0 9px; font-size: var(--fs-12); border-radius: 7px; }
.acct-drawer { display: none; }

.inline-form {
    display: flex;
    gap: var(--sp-2);
    align-items: center;
    flex-wrap: wrap;
    margin-top: 8px;
}
.inline-form select,
.inline-form .input { width: auto; flex: 1; min-width: 120px; }
.inline-form .btn { white-space: nowrap; }

/* 转发 */
.relay-status {
    display: flex;
    gap: var(--sp-3);
    align-items: flex-start;
    padding: 13px 16px;
    margin-bottom: var(--sp-4);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
}
.relay-status b { display: block; font-size: var(--fs-14); margin-bottom: 2px; }
.relay-dot {
    width: 9px;
    height: 9px;
    margin-top: 7px;
    flex: none;
    border-radius: var(--r-pill);
    background: #9aa9bd;
}
.relay-status.ok { border-color: var(--ok-line); background: linear-gradient(180deg, #f6fefa, var(--surface) 70%); }
.relay-status.ok .relay-dot { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.relay-status.warn { border-color: var(--warn-line); background: linear-gradient(180deg, #fffdf5, var(--surface) 70%); }
.relay-status.warn .relay-dot { background: #d97706; box-shadow: 0 0 0 4px var(--warn-soft); }
.relay-status.bad { border-color: var(--danger-line); background: linear-gradient(180deg, #fff7f6, var(--surface) 70%); }
.relay-status.bad .relay-dot { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }

.relay-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--sp-3);
    padding-bottom: var(--sp-3);
    margin-bottom: var(--sp-4);
    border-bottom: 1px solid var(--line-soft);
}
.relay-head h2 { margin: 0; font-size: var(--fs-15); }
.relay-board { padding: var(--sp-5) var(--sp-5) var(--sp-2); }
.relay-search { margin-bottom: var(--sp-3); }
.relay-cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.relay-col-h {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: var(--fs-12);
    font-weight: 700;
}
.relay-col-h b {
    min-width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-pill);
    font-size: var(--fs-11);
    color: #fff;
}
.relay-col-h.source b { background: #334155; }
.relay-col-h.target b { background: var(--ok); }
.relay-empty { padding: 12px; }
.relay-block {
    padding: 14px 14px 2px;
    margin-bottom: var(--sp-3);
    background: var(--surface-2);
    border: 1px solid var(--line-soft);
    border-radius: var(--r);
}
.relay-kicker {
    margin-bottom: 10px;
    font-size: var(--fs-11);
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-3);
}
.relay-table td { font-size: var(--fs-13); }
.relay-split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); align-items: start; }
.relay-table-h {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px 0;
}
.relay-table-h h2 { margin: 0; font-size: var(--fs-15); }
.relay-settings { display: block; }

/* 群/账号多选列表 */
.pick-box {
    max-height: 280px;
    overflow: auto;
    padding: 5px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
}
.pick-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.pick-row + .pick-row { margin-top: 2px; }
.pick-row:hover { background: var(--surface-2); }
.pick-row:has(input:checked) { background: #f2fdf8; border-color: var(--ok-line); }
.pick-row input { margin-top: 2px; }
.pick-filter { margin-bottom: 8px; }
.relay .pick-box { min-height: 120px; background: var(--surface-2); }
.relay .pick-row { background: var(--surface); }
/* 来源群用中性蓝（读取侧），目标群用绿色（发送侧），一眼分清角色 */
.relay-cols > div:has(> .relay-col-h.source) .pick-row:has(input:checked) {
    background: #f3f7ff;
    border-color: var(--brand-line);
}
.relay-cols > div:has(> .relay-col-h.target) .pick-row:has(input:checked) {
    background: #f2fdf8;
    border-color: var(--ok-line);
}

/* 代理 / 群 / 跳过名单 */
.proxy-row,
.group-row {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: 11px 0;
    border-bottom: 1px solid var(--line-soft);
}
.proxy-row:last-child,
.group-row:last-child { border-bottom: 0; }
.skip-box { display: flex; flex-direction: column; gap: 10px; }
.skip-search { display: flex; gap: 8px; }
.skip-hits { display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow: auto; }
.skip-picked { display: flex; flex-wrap: wrap; gap: 6px; }
.skip-note { font-size: var(--fs-12); color: var(--text-3); }
.skip-data { display: none; }

.log-time { color: var(--text-3); font-size: var(--fs-12); font-variant-numeric: tabular-nums; white-space: nowrap; }
.log-msg { color: var(--text-2); font-size: var(--fs-13); }

/* 登录页 */
.login-page {
    min-height: 100vh;
    background:
        radial-gradient(60% 50% at 50% 0%, #ffffff 0%, transparent 70%),
        radial-gradient(50% 40% at 15% 100%, #e6efff 0%, transparent 70%),
        var(--bg);
}
.login-wrap {
    width: min(400px, calc(100vw - 32px));
    margin: 0 auto;
    padding: 11vh 0 40px;
    animation: fade-in .3s var(--ease);
}
.login-mark {
    width: 46px;
    height: 46px;
    margin: 0 auto 16px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(145deg, #3b82f6, #1e40af);
    box-shadow: 0 10px 24px rgba(37, 99, 235, .32);
}
.login-wrap .brand2 {
    margin-bottom: 6px;
    text-align: center;
    font-size: var(--fs-20);
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--text);
}
.login-wrap .login-sub {
    margin-bottom: 22px;
    text-align: center;
    color: var(--text-3);
    font-size: var(--fs-13);
}
.login-wrap .card {
    padding: 24px;
    border-radius: var(--r-xl);
    box-shadow: var(--sh-3);
    border-color: #e8eef8;
}
.login-wrap .card .form-row:last-of-type { margin-bottom: 18px; }
.login-wrap .btn { width: 100%; min-height: 42px; }
.login-foot {
    margin: 18px 0 0;
    text-align: center;
    color: var(--text-3);
    font-size: var(--fs-12);
    line-height: 1.7;
}

/* 头像 / 二维码 */
.login-qr { display: block; margin: 12px auto; border-radius: var(--r); background: #fff; padding: 8px; box-shadow: var(--sh-2); }
.profile-from { font-size: var(--fs-12); color: var(--text-3); }
.account-username { font-family: ui-monospace, Consolas, monospace; font-size: var(--fs-12); color: var(--text-2); }
.acct-profile { display: flex; align-items: center; gap: 10px; }
.acct-username { font-size: var(--fs-12); color: var(--text-3); }
.acct-manage { display: flex; flex-wrap: wrap; gap: 6px; }
.acct-row td { vertical-align: top; }

/* 代理页整行卡片（若存在） */
.proxy-card { padding: var(--sp-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }

/* 6. 动画 */
/* 注意：不要给 .main / .card 加 transform 动画——会让内部 position:fixed 的
   抽屉、弹窗以它为包含块，导致定位跑偏。整页淡入交给浏览器默认渲染即可。 */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 100% { transform: translateX(100%); } }
@keyframes fade-in { from { opacity: 0; transform: translateY(-2px); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(12px); } }

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

/* ------------------------------------------------------- 6.5 渐进增强钩子 */
/* 卡片内的表格铺满卡片（由 admin.js 自动追加 .card-flush 与 .table-wrap） */
.card-flush { padding: 0; overflow: hidden; }
/* 表格铺满卡片后，卡片里其余内容仍保持原来的内边距 */
.card-flush > * { padding-left: 18px; padding-right: 18px; }
.card-flush > .table-scroll { padding-left: 0; padding-right: 0; }
.card-flush > h2:first-child {
    margin: 0;
    padding: 15px 18px;
    border-bottom: 1px solid var(--line-soft);
}
.card-flush .table-wrap { border: 0; border-radius: 0; box-shadow: none; }
.card-flush > .actions { margin-top: 14px; margin-bottom: 14px; }
.card-flush > .help { margin-top: 14px; margin-bottom: 0; }

/* 表头排序指示 */
.table th[data-sort] {
    cursor: pointer;
    user-select: none;
    padding-right: 22px;
    white-space: nowrap;
}
.table th[data-sort]:hover { color: var(--text-2); }
.table th[data-sort]::after {
    content: "";
    position: absolute;
    right: 10px;
    top: 50%;
    margin-top: -2px;
    border: 4px solid transparent;
    border-top-color: #b7c3d4;
    opacity: 0;
    transition: opacity var(--t-fast) var(--ease);
}
.table th[data-sort]:hover::after { opacity: .7; }
.table th[data-sort="asc"]::after,
.table th[data-sort="desc"]::after { opacity: 1; }
.table th { position: sticky; }
.table th[data-sort] { position: sticky; }
.table th[data-sort="asc"]::after {
    border-top-color: transparent;
    border-bottom-color: var(--brand);
    margin-top: -6px;
}
.table th[data-sort="desc"]::after { border-top-color: var(--brand); }

/* 抽屉打开时锁定滚动 */
body.no-scroll { overflow: hidden; }

/* 表格内的按钮：描边彩字，hover 才上底色，避免表格被大面积实心色块压住 */
.table .btn.red,
.table .btn.blue,
.table .btn.green,
.table .btn.yellow,
.table .btn.primary {
    background: var(--surface);
    border-color: var(--line);
    color: var(--text-2);
    box-shadow: none;
}
.table .btn.red { color: #b42318; border-color: var(--danger-line); }
.table .btn.blue { color: var(--brand); border-color: var(--brand-line); }
.table .btn.green { color: #067a55; border-color: var(--ok-line); }
.table .btn.yellow { color: var(--warn); border-color: var(--warn-line); }
.table .btn.red:hover { background: var(--danger-soft); border-color: #f8b4ae; color: #b42318; }
.table .btn.blue:hover,
.table .btn.primary:hover { background: var(--brand-soft); border-color: #b9d2ff; color: var(--brand-hover); }
.table .btn.green:hover { background: var(--ok-soft); border-color: #a5e6cd; color: #067a55; }
.table .btn.yellow:hover { background: var(--warn-soft); border-color: #fbdc94; color: #8a5308; }

/* 下拉菜单（details/summary 原生实现，不依赖 JS） */
.menu { position: relative; display: inline-block; }
.menu > summary {
    list-style: none;
    cursor: pointer;
}
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after {
    content: "";
    width: 0; height: 0;
    margin-left: 2px;
    border: 4px solid transparent;
    border-top-color: currentColor;
    opacity: .5;
    transform: translateY(2px);
}
.menu[open] > summary { background: var(--surface-2); border-color: var(--line-strong); }
.menu-list {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 60;
    min-width: 176px;
    padding: 5px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--sh-3);
    display: grid;
    gap: 2px;
}
.menu-list .btn {
    justify-content: flex-start;
    border: 0;
    box-shadow: none;
    background: transparent;
    min-height: 32px;
}
.menu-list .btn:hover { background: var(--line-soft); }

/* 7. responsive */
@media (max-width: 1180px) {
    .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
    :root { --side-w: 0px; }
    .sidebar {
        width: 268px;
        transform: translateX(-100%);
        transition: transform var(--t) var(--ease);
        box-shadow: 0 0 60px rgba(15, 23, 42, .35);
    }
    .sidebar.open { transform: none; }
    .shell { margin-left: 0; }
    .menu-btn { display: inline-flex; }
    .top { padding: 0 var(--sp-4); }
    .main { padding: var(--sp-4); }
    .page-head { flex-direction: column; align-items: flex-start; gap: 10px; }
    .page-head h1 { font-size: var(--fs-20); }
    .grid,
    .two,
    .three,
    .acct-grid,
    .relay-cols,
    .relay-split { grid-template-columns: 1fr; }
    .acct-tools { padding: var(--sp-3); }
    .acct-tools .input,
    .acct-tools select { width: 100%; }
    .acct-tools-gap { display: none; }
    .table { font-size: var(--fs-13); }
    .card { padding: var(--sp-4); border-radius: var(--r); }
    .sidebar nav { padding-bottom: 24px; }
    .toasts { top: 10px; right: 10px; left: 10px; max-width: none; }
}

@media (max-width: 640px) {
    .acct-table tr.acct-panel > td { width: 100%; }
    .grid { grid-template-columns: 1fr; }
    .acct-tools > .btn { flex: 1 1 44%; }
    .acct-tools > .input,
    .acct-tools > select { flex: 1 1 100%; }
    .acct-tabs button { flex: 1 1 auto; }
    .main { padding: var(--sp-3); }
    .stat b { font-size: var(--fs-24); }
    .actions .btn { flex: 1; }
    .modal { padding: 18px; }
}

/* 打印：去掉外壳，只留内容 */
@media print {
    .sidebar, .top, .menu-btn, .toasts, .modal-mask { display: none !important; }
    .shell { margin-left: 0; }
    .main { padding: 0; max-width: none; }
    .card { box-shadow: none; border-color: #ddd; break-inside: avoid; }
}

/* 没发生横向滚动时，末列的投影只会显得多余 */
.table-scroll:not(.has-more) .acct-table tr:not(.acct-panel) > th:last-child,
.table-scroll:not(.has-more) .acct-table tr:not(.acct-panel) > td:last-child { box-shadow: none; }
