/* ============ 凌博通行证 · 手机绑定中心 ============ */
:root {
    --bg-app: #0c0c12;
    --bg-sidebar: #111119;
    --bg-card: #181822;
    --bg-card-hover: #1e1e2c;
    --bg-input: #22222e;
    --text-primary: #e6e4dd;
    --text-secondary: #95918a;
    --text-muted: #5e5b55;
    --accent: #d4a04a;
    --accent-soft: rgba(212, 160, 74, 0.1);
    --accent-border: rgba(212, 160, 74, 0.18);
    --green: #50c878;
    --green-soft: rgba(80, 200, 120, 0.1);
    --red: #e07070;
    --red-soft: rgba(224, 112, 112, 0.1);
    --amber: #d4a04a;
    --amber-soft: rgba(212, 160, 74, 0.1);
    --purple: #9a86d4;
    --purple-soft: rgba(154, 134, 212, 0.1);
    --border: rgba(255, 255, 255, 0.05);
    --border-strong: rgba(255, 255, 255, 0.08);
    --radius: 12px;
    --radius-sm: 7px;
    --radius-xs: 5px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
    --sidebar-w: 230px;
    --transition: 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* hidden 属性优先：防止 display 类样式覆盖 hidden 导致元素常显 */
[hidden] { display: none !important; }

body {
    font-family: var(--font);
    background: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
}

/* ============ 认证页 ============ */
.auth-view {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
}

.auth-view::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(ellipse at 50% 20%, rgba(212, 160, 74, 0.04) 0%, transparent 60%);
    pointer-events: none;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 30px 28px 26px;
    position: relative;
    box-shadow: var(--shadow);
    animation: fadeIn 0.3s ease;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0; left: 28px; right: 28px;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--accent-border), transparent);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    background: var(--bg-input);
    border: 1px solid var(--accent-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    flex-shrink: 0;
}

.brand-name {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.brand-sub {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.auth-tabs {
    display: flex;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 20px;
}

.auth-tab {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 9px 0;
    border-radius: 5px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font);
    transition: all var(--transition);
    letter-spacing: 4px;
}

.auth-tab:hover { color: var(--text-primary); }

.auth-tab.active {
    background: var(--accent-soft);
    color: var(--accent);
}

.auth-foot {
    margin-top: 18px;
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    position: relative;
}

/* ============ 表单 ============ */
.form { text-align: left; }

.auth-link {
    display: block;
    width: max-content;
    max-width: 100%;
    margin: 13px auto 0;
    padding: 3px;
    border: 0;
    background: transparent;
    color: var(--accent);
    font: inherit;
    font-size: 0.78rem;
    cursor: pointer;
}

.auth-link:hover { color: var(--text-primary); }

.reset-status {
    margin: 0 0 16px;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.6;
}

.reset-status.error {
    border-color: rgba(224, 112, 112, 0.35);
    background: var(--red-soft);
    color: var(--red);
}

.field { margin-bottom: 16px; }

.field label {
    display: block;
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-bottom: 7px;
    letter-spacing: 0.02em;
}

.field input,
.field select {
    width: 100%;
    padding: 10px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.87rem;
    font-family: var(--font);
    outline: none;
    transition: all var(--transition);
}

.field input:focus,
.field select:focus {
    border-color: var(--accent-border);
    background: var(--bg-card-hover);
}

.field input::placeholder { color: var(--text-muted); }

.field textarea {
    width: 100%;
    padding: 10px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--bg-input);
    color: var(--text-primary);
    font: inherit;
    line-height: 1.55;
    resize: vertical;
    outline: none;
}

.field textarea:focus {
    border-color: var(--accent-border);
    background: var(--bg-card-hover);
}

.app-update-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.checkbox-field {
    display: flex;
    gap: 9px;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.82rem;
    margin: 6px 0 18px;
    cursor: pointer;
}

.checkbox-field input {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
}

.app-release-notes {
    max-width: 380px;
    white-space: pre-line;
}

.hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 7px;
    line-height: 1.6;
}

.hint code {
    font-family: var(--font-mono);
    background: var(--bg-input);
    color: var(--accent);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.72rem;
}

.hint.center { text-align: center; }

/* 表单错误提示（详细错误信息） */
.form-error {
    margin: 4px 0 2px;
    padding: 9px 12px;
    border-radius: var(--radius-xs);
    background: var(--red-soft);
    border: 1px solid rgba(224, 112, 112, 0.35);
    color: var(--red);
    font-size: 0.76rem;
    line-height: 1.7;
}

.form-error::before { content: '⚠ '; }

.field.invalid input {
    border-color: rgba(224, 112, 112, 0.55);
}

.field.invalid input:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(224, 112, 112, 0.15);
}

.row { display: flex; gap: 10px; align-items: center; }
.row.right { justify-content: flex-end; }

/* ============ 按钮 ============ */
.btn {
    border: none;
    border-radius: var(--radius-sm);
    padding: 11px 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font);
    transition: all var(--transition);
    letter-spacing: 0.02em;
}

.btn-block { width: 100%; }

.btn-primary {
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid var(--accent-border);
}

.btn-primary:hover {
    background: var(--accent);
    color: #14140f;
}

.btn-danger {
    background: var(--red-soft);
    color: var(--red);
    border: 1px solid rgba(224, 112, 112, 0.2);
}

.btn-danger:hover {
    background: var(--red);
    color: #14140f;
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-sm {
    padding: 6px 13px;
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid transparent;
    border-radius: var(--radius-xs);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font);
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-sm:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

/* ============ 应用框架 ============ */
.app {
    display: flex;
    height: 100vh;
    position: relative;
}

.app::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(ellipse at 20% 50%, rgba(212, 160, 74, 0.03) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.app > * { position: relative; z-index: 1; }

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: relative;
}

.sidebar::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, transparent, var(--border-strong) 20%, var(--border-strong) 80%, transparent);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 18px;
    border-bottom: 1px solid var(--border);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.87rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    font-family: var(--font);
    text-align: left;
    width: 100%;
}

.nav-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-soft);
    color: var(--accent);
}

/* 微信式待办角标 */
.nav-badge {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--red);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px 18px;
    position: relative;
}

.sidebar-footer::before {
    content: '';
    position: absolute;
    top: 0; left: 18px; right: 18px;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-strong), transparent);
}

.user-line {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    word-break: break-all;
}

.conn-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
    transition: all 0.3s;
}

.conn-dot.online {
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
    animation: pulse 2s infinite;
}

.conn-dot.offline {
    background: var(--red);
    box-shadow: 0 0 8px var(--red);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.footer-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* 主区 */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    background: var(--bg-sidebar);
    position: relative;
    flex-shrink: 0;
}

.topbar::after {
    content: '';
    position: absolute;
    bottom: 0; left: 28px; right: 28px;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-strong), transparent);
}

.page-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.last-refresh {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-xs);
    border: none;
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.btn-icon:hover {
    background: var(--bg-card-hover);
    color: var(--accent);
}

.content {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
}

.tab-panel { display: none; animation: fadeIn 0.25s ease; }
.tab-panel.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============ 统计卡 ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: background var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-strong), transparent);
}

.stat-card:hover { background: var(--bg-card-hover); }

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon-blue { background: var(--accent-soft); color: var(--accent); }
.stat-icon-green { background: var(--green-soft); color: var(--green); }
.stat-icon-red { background: var(--red-soft); color: var(--red); }
.stat-icon-amber { background: var(--amber-soft); color: var(--amber); }
.stat-icon-purple { background: var(--purple-soft); color: var(--purple); }

.stat-value {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
    word-break: break-all;
}

.stat-label {
    display: block;
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 3px;
}

/* ============ 卡片 ============ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-strong), transparent);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    position: relative;
}

.card-header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 20px; right: 20px;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-strong), transparent);
}

.card-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
}

.card-body { padding: 16px 20px; }

.card-body-table {
    padding: 0;
    overflow-x: auto;
    max-height: 480px;
    overflow-y: auto;
}

.auto-badge {
    font-size: 0.65rem;
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--bg-input);
    font-variant-numeric: tabular-nums;
}

.muted { color: var(--text-muted); }

/* 分段页签（审批中心） */
.seg-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    background: var(--bg-sidebar);
    padding: 5px;
    border-radius: var(--radius-sm);
    width: fit-content;
    flex-wrap: wrap;
}

.seg-tab {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font);
    transition: all var(--transition);
}

.seg-tab:hover { color: var(--text-primary); }

.seg-tab.active {
    background: var(--accent-soft);
    color: var(--accent);
}

/* 内部页签数量角标 */
.seg-badge {
    margin-left: 6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--red);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    vertical-align: middle;
}

.seg-badge[hidden] { display: none; }

/* 邀请关系树 */
.tree-inviter-block {
    margin-bottom: 14px;
    border: 1px dashed var(--accent-border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    background: rgba(212, 160, 74, 0.04);
}
.tree-inviter-label {
    font-size: 0.68rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
    font-weight: 600;
}
.tree-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tree-tools input {
    width: 200px;
    padding: 6px 10px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border-strong);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.78rem;
    font-family: var(--font);
    outline: none;
}
.tree-tools input:focus { border-color: var(--accent-border); }
.tree-tools .btn-filter-on {
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid var(--accent-border);
}
.tree-root { font-size: 0.82rem; }
.tree-node { margin: 3px 0; }
.tree-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 8px 10px;
    border-radius: var(--radius-xs);
    background: var(--bg-input);
    border: 1px solid var(--border);
}
.tree-row:hover { border-color: var(--accent-border); }
.tree-toggle {
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    flex-shrink: 0;
    font-family: var(--font);
    transition: all var(--transition);
}
.tree-toggle:hover { background: var(--bg-card-hover); color: var(--accent); }
.tree-email { font-weight: 600; color: var(--text-primary); word-break: break-all; }
.tree-nick {
    font-size: 0.72rem;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
    padding: 1px 8px;
    border-radius: 10px;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 0;
}

.tree-nick.tree-nick-highlight {
    background: var(--accent);
    color: #14140f;
    border-color: var(--accent);
    font-weight: 600;
}
.tree-email.tree-highlight {
    color: var(--accent);
    background: var(--accent-soft);
    padding: 1px 6px;
    border-radius: 4px;
}
.tree-qr { font-size: 0.74rem; color: var(--text-secondary); flex: 1; min-width: 200px; }
.tree-qr .qr-item { display: block; padding: 1px 0; }
.tree-qr .qr-ok { color: var(--green); }
.tree-qr .qr-wait { color: var(--amber); }
.tree-qr .qr-none { color: var(--text-muted); }
.tree-children { margin-left: 26px; padding-left: 14px; border-left: 1px dashed var(--border-strong); }
.tree-actions { display: flex; gap: 6px; }

/* ============ 绑定区 ============ */
.bind-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.bind-main { flex: 1; min-width: 280px; }

.bind-tip {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 14px;
}

.qr-box {
    width: 190px;
    height: 190px;
    background: #fff;
    border-radius: var(--radius-sm);
    padding: 10px;
    margin-bottom: 14px;
}

.qr-inner { width: 100%; height: 100%; }
.qr-inner canvas, .qr-inner img { width: 100% !important; height: 100% !important; }

.qr-refresh {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #6b6974;
    font-size: 0.74rem;
    text-align: center;
    line-height: 1.7;
}

.bindcode-block {
    max-width: 420px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}

.bindcode-label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.bindcode-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bindcode-row code {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--accent);
    word-break: break-all;
    line-height: 1.6;
    user-select: all;
}

.countdown {
    margin-top: 12px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--amber);
    font-variant-numeric: tabular-nums;
}

.bind-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 190px;
}

.bind-actions .hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    max-width: 220px;
}

/* ============ 表格 ============ */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

thead { background: var(--bg-input); }
thead th { position: sticky; top: 0; z-index: 1; background: var(--bg-input); }

th {
    padding: 11px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.66rem;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

td {
    padding: 10px 16px;
    position: relative;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

tbody tr { transition: background var(--transition); }
tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

tbody tr td:first-child::before {
    content: '';
    position: absolute;
    top: 0; left: 16px; right: 16px;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-strong), transparent);
}

.empty-row td {
    text-align: center;
    color: var(--text-muted);
    padding: 36px;
    font-style: italic;
}

/* ============ 徽章 ============ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.64rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-success { background: var(--green-soft); color: var(--green); }
.badge-failed { background: var(--red-soft); color: var(--red); }
.badge-processing { background: var(--amber-soft); color: var(--amber); }
.badge-muted { background: var(--bg-input); color: var(--text-muted); }

/* 表格内复选框 */
.chk {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.chk input[type="checkbox"],
.perm-switch {
    accent-color: var(--accent);
    width: 14px;
    height: 14px;
    cursor: pointer;
}

/* ============ Toast ============ */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    padding: 11px 22px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 500;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow);
    animation: dropIn 0.25s ease;
    max-width: min(540px, 90vw);
}

.toast.ok { border-color: rgba(80, 200, 120, 0.35); }
.toast.err { border-color: rgba(224, 112, 112, 0.45); }

@keyframes dropIn {
    from { opacity: 0; transform: translate(-50%, -10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* ============ 弹窗 ============ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s;
}

.modal-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    animation: slideUp 0.25s ease-out;
    padding: 22px;
    position: relative;
}

.modal-card::before {
    content: '';
    position: absolute;
    top: 0; left: 22px; right: 22px;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--accent-border), transparent);
}

@keyframes slideUp {
    from { transform: translateY(16px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.modal-header h3 { font-size: 1rem; font-weight: 700; }

.detail-close {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    font-family: var(--font);
}

.detail-close:hover {
    border-color: var(--red);
    color: var(--red);
}

/* ============ 滚动条 ============ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-input); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============ 响应式 ============ */
.menu-toggle { display: none; }

/* 小桌面 / 平板横屏：统计卡降为 2 列 */
@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

.sidebar-mask {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 110;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.sidebar-mask[hidden] { display: none; }

/* 平板（竖屏）与手机：抽屉式侧边栏 */
@media (max-width: 900px) {
    .menu-toggle { display: flex; }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 120;
        width: 250px;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.5);
    }

    .sidebar.open { transform: translateX(0); }

    .sidebar::after { display: none; }

    .topbar { gap: 10px; }

    .last-refresh { display: none; }

    .content { padding: 18px; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    .seg-tabs {
        width: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .seg-tab { flex: 1; min-width: max-content; white-space: nowrap; }

    .footer-actions { flex-direction: row; }

    .tree-tools input { width: 100%; }
}

/* 手机 */
@media (max-width: 600px) {
    .stats-grid { grid-template-columns: 1fr; }

    .content { padding: 14px; }

    .topbar { padding: 12px 14px; }

    .bind-layout { flex-direction: column; }

    .auth-card { padding: 22px 16px; }

    .brand-lg { flex-direction: column; text-align: center; }

    table { font-size: 0.72rem; }

    th, td { padding: 8px 10px; }

    .card { border-radius: 10px; }

    .card-header { padding: 12px 14px; }

    .app-update-grid { grid-template-columns: 1fr; }

    .modal-card { max-width: 100%; }

    .tree-row { gap: 6px; padding: 7px 8px; }

    .tree-children { margin-left: 14px; padding-left: 8px; }

    .tree-qr { min-width: 140px; }

    .qr-area { flex-direction: column; align-items: flex-start; }

    .bind-actions { width: 100%; }

    .bind-actions .hint { max-width: none; }
}
