/* ============================================================
   Design System - CSS Variables
   ============================================================ */

:root {
    /* === Colors - Light Mode === */
    --bg-body: #F5F5F7;
    --bg-card: #FFFFFF;
    --bg-input: #F5F5F7;
    --bg-hover: #E8E8ED;
    --navbar-bg: rgba(255, 255, 255, 0.85);

    --text-primary: #1D1D1F;
    --text-secondary: #86868B;
    --text-tertiary: #A1A1A6;
    --text-inverse: #FFFFFF;

    --accent: #0071E3;
    --accent-hover: #0077ED;
    --accent-light: rgba(0, 113, 227, 0.1);

    --danger: #FF3B30;
    --danger-light: rgba(255, 59, 48, 0.1);
    --success: #34C759;
    --success-light: rgba(52, 199, 89, 0.1);
    --warning: #FF9500;
    --warning-light: rgba(255, 149, 0, 0.1);

    --border: #E5E5EA;
    --border-light: #F2F2F7;

    --modal-overlay: rgba(0, 0, 0, 0.3);

    /* === Spacing & Radius === */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 999px;

    /* === Shadows === */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.08);

    /* === Motion === */
    --ease-apple: cubic-bezier(0.25, 0.1, 0.25, 1);
    --spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);

    /* === Typography === */
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ============================================================
   Dark Mode - Variable Overrides
   ============================================================ */

[data-theme="dark"] {
    --bg-body: #000000;
    --bg-card: #1C1C1E;
    --bg-input: #2C2C2E;
    --bg-hover: #3A3A3C;
    --navbar-bg: rgba(0, 0, 0, 0.9);

    --text-primary: #F5F5F7;
    --text-secondary: #A1A1A6;
    --text-tertiary: #8E8E93;
    --text-inverse: #000000;

    --accent: #0A84FF;
    --accent-hover: #409CFF;
    --accent-light: rgba(10, 132, 255, 0.2);

    --danger: #FF453A;
    --danger-light: rgba(255, 69, 58, 0.2);
    --success: #30D158;
    --success-light: rgba(48, 209, 88, 0.2);
    --warning: #FF9F0A;
    --warning-light: rgba(255, 159, 10, 0.2);

    --border: #38383A;
    --border-light: #2C2C2E;

    --modal-overlay: rgba(0, 0, 0, 0.6);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.7);
}

/* System preference auto-switch */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-body: #000000;
        --bg-card: #1C1C1E;
        --bg-input: #2C2C2E;
        --bg-hover: #3A3A3C;
        --navbar-bg: rgba(0, 0, 0, 0.9);

        --text-primary: #F5F5F7;
        --text-secondary: #A1A1A6;
        --text-tertiary: #8E8E93;
        --text-inverse: #000000;

        --accent: #0A84FF;
        --accent-hover: #409CFF;
        --accent-light: rgba(10, 132, 255, 0.2);

        --danger: #FF453A;
        --danger-light: rgba(255, 69, 58, 0.2);
        --success: #30D158;
        --success-light: rgba(48, 209, 88, 0.2);
        --warning: #FF9F0A;
        --warning-light: rgba(255, 159, 10, 0.2);

        --border: #38383A;
        --border-light: #2C2C2E;

        --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.5);
        --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.6);
        --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.7);
    }
}

/* ============================================================
   Theme Toggle Button
   ============================================================ */

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

.icon-sun { display: none; }
.icon-moon { display: block; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .icon-sun { display: block; }
    :root:not([data-theme="light"]) .icon-moon { display: none; }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

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

/* React 挂载根:撑满视口的纵向 flex 容器(让 .hero flex:1、footer 沉底等生效) */
#app-root {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- Components --- */

/* 1. Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-weight: 500;
    font-size: 14px;
    line-height: 1.5;
    border-radius: var(--radius-full);
    /* Pill shape */
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    gap: 6px;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.96);
}

/* Button Sizes */
.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
    gap: 4px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
    gap: 8px;
}

.btn-icon {
    padding: 8px;
    width: 32px;
    height: 32px;
}

.btn-icon.btn-sm {
    padding: 6px;
    width: 28px;
    height: 28px;
}

/* Button Variants */
.btn-primary {
    background-color: var(--text-primary);
    color: var(--text-inverse);
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* 禁用态：明确变灰 + 禁用光标，并屏蔽 hover 抬升（如中转页倒计时未结束的「继续访问」） */
.btn:disabled,
.btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
    transform: none;
    box-shadow: none;
}

.btn-accent {
    background-color: var(--accent);
    color: var(--text-inverse);
}

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

.btn-danger {
    background-color: var(--danger);
    color: var(--text-inverse);
}

.btn-danger:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* 2. Inputs */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: left;
}

/* Base input/textarea/select styles */
input, textarea, select {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

input::placeholder, textarea::placeholder {
    color: var(--text-tertiary);
}

.form-input,.form-select {
    width: 100%;
    padding: 0.5rem 1rem;
    background: var(--bg-input);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s var(--ease-apple);
}

/* 列表搜索框：紧凑、自适应，复用 .form-input 基础样式 */
.search-input {
    width: auto;
    min-width: 220px;
    padding: 0.4rem 0.85rem;
    font-size: 0.9rem;
    border-color: var(--border);
}

.form-input:focus {
    background: var(--bg-card);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-light);
}

/* 3. Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    border: 1px solid var(--border-light);
}

/* 4. Navbar (Dashboard) */
.navbar {
    height: 64px;
    background: var(--navbar-bg, rgba(255, 255, 255, 0.85));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    justify-content: space-between;
}

.nav-brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 24px;
    align-items: center;
    min-width: 0;
}

.nav-link {
    display: inline-block;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
    cursor: pointer;
    padding: 4px 0;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
}

/* Drodown Menu */
.nav-item-dropdown {
    position: relative;
    display: flex;
    align-items: center;
    padding-bottom: 8px;
    /* Extend hit area downwards */
    margin-bottom: -8px;
    /* Compensate layout */
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-card);
    min-width: 160px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    padding: 8px;
    display: none;
    z-index: 100;
    margin-top: 0;
    animation: scaleIn 0.2s var(--ease-apple);
}

.nav-item-dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 10px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.dropdown-menu a:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: 4px 0;
}

/* 5. Misc */
.hidden {
    display: none !important;
}

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

.text-sm {
    font-size: 0.875rem;
}

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

/* Animation Utility */
.animate-in {
    animation: fadeUp 0.6s var(--ease-apple) forwards;
    opacity: 0;
    transform: translateY(15px);
}

/* --- Keyframes (CRITICAL for Opacity Animations) --- */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 6. Layout Utilities (Global) */
.container {
    width: 100%;
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 24px;
}

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

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}


/* 7. Data Tables */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th {
    text-align: left;
    padding: 16px 24px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    background: var(--bg-input);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table td {
    padding: 16px 24px;
    font-size: 0.95rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: var(--bg-hover);
}

/* 8. Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--border-light);
    color: var(--text-primary);
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-info {
    background: var(--accent-light);
    color: var(--accent);
}

.badge-neutral {
    background: var(--bg-input);
    color: var(--text-secondary);
}

/* ========== Pagination ========== */
.pagination {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-light);
}

.pagination-top {
    border-top: none;
    border-bottom: 1px solid var(--border-light);
}

.pagination-total {
    margin-right: auto;
    font-size: 13px;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.pagination-info {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* 表格容器：圆角卡片 —— 表体内部滚动、分页固定在卡片底部。
   flex:1 自动填满 admin-main 剩余空间，无需脆弱的 calc 偏移。 */
.table-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.table-scroll-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-scroll-area .data-table {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .navbar {
        height: auto;
        min-height: 56px;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 10px;
        padding: 10px 14px 0;
    }

    .nav-brand {
        flex: 0 0 100%;
        line-height: 28px;
    }

    .nav-links {
        flex: 0 0 100%;
        max-width: 100%;
        justify-content: flex-start;
        gap: 8px;
        overflow-x: auto;
        padding: 0 0 10px 0;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .nav-links::-webkit-scrollbar {
        display: none;
    }

    .nav-link,
    .theme-toggle {
        flex: 0 0 auto;
        min-height: 36px;
    }

    .nav-item-dropdown {
        flex: 0 0 auto;
    }

    .nav-link {
        display: inline-flex;
        align-items: center;
        white-space: nowrap;
        padding: 6px 10px;
        border-radius: var(--radius-md);
        background: var(--bg-input);
        font-size: 0.88rem;
    }

    .nav-link.active {
        background: var(--text-primary);
        color: var(--text-inverse);
    }

    .dropdown-menu {
        right: auto;
        left: 0;
        max-width: calc(100vw - 28px);
    }

    .container {
        margin: 24px auto;
        padding: 0 16px;
    }

    .header-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
        margin-bottom: 20px;
    }

    .page-title {
        font-size: 1.4rem;
    }

    .card {
        padding: 18px;
        border-radius: var(--radius-md);
    }

    .search-input {
        width: 100%;
        min-width: 0;
    }

    .data-table {
        min-width: 680px;
        font-size: 0.88rem;
    }

    .data-table th,
    .data-table td {
        padding: 12px 14px;
    }

    .pagination {
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px;
    }

    .pagination-total {
        flex-basis: 100%;
        margin-right: 0;
        text-align: center;
    }

    .modal-overlay {
        align-items: flex-end;
        padding: 12px;
    }

    .modal {
        width: 100%;
        max-width: none;
        max-height: calc(100vh - 24px);
        overflow-y: auto;
        border-radius: 16px;
        padding: 22px;
    }
}

/* ===== Modal Styles ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease-out;
}

.modal-overlay.hidden {
    display: none !important;
}

.modal {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 28px;
    width: 90%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s var(--ease-apple);
}

.modal h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 20px 0;
}

.modal p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0 0 24px 0;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* ============================================================
   Utility Classes - 通用工具类
   ============================================================ */

/* 空状态提示 */
.empty-state {
    padding: 40px;
    text-align: center;
    color: var(--text-tertiary);
}

/* 加载状态 */
.loading-state {
    padding: 32px;
    text-align: center;
    color: var(--text-tertiary);
}

/* 列表项 */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-card);
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--border-light);
}

/* 提示框 */
.tip-box {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.tip-box-info {
    background: var(--accent-light);
    color: var(--accent);
}

.tip-box-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.tip-box-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.tip-box-success {
    background: var(--success-light);
    color: var(--success);
}

/* 取消按钮样式 */
.btn-cancel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-cancel:hover {
    background: var(--bg-hover);
}

/* 页面容器 */
.page-container {
    background: var(--bg-body);
    min-height: 100vh;
}

/* 内容卡片 */
.content-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 32px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

/* 分组标题行（用于表格等） */
.group-header {
    background: var(--bg-input);
}

/* 禁用标签 */
.badge-disabled {
    font-size: 0.75rem;
    background: var(--bg-input);
    color: var(--text-tertiary);
    padding: 2px 8px;
    border-radius: 4px;
}

/* 二维码容器 */
.qr-container {
    display: inline-block;
    padding: 10px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
}

/* ============================================================
   Social Login Buttons - 社交登录按钮
   ============================================================ */

.social-divider {
    display: flex;
    align-items: center;
    margin: 24px 0 16px;
    color: var(--text-tertiary);
    font-size: 0.85rem;
}

.social-divider::before,
.social-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.social-divider span {
    padding: 0 16px;
}

/* 社交登录图标容器 */
.social-icons {
    display: flex;
    justify-content: center;
    gap: 16px;
}

/* 社交登录图标按钮 */
.social-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s var(--ease-apple);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    text-decoration: none;
}

.social-icon-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.social-icon-btn:active {
    transform: scale(0.95);
}

.social-icon-btn svg {
    width: 24px;
    height: 24px;
}

/* GitHub 图标 */
.social-icon-github {
    background: var(--bg-card);
    color: var(--text-primary);
}

.social-icon-github:hover {
    background: var(--bg-hover);
}

/* Apple 图标 */
.social-icon-apple {
    background: var(--bg-card);
    color: var(--text-primary);
}

.social-icon-apple:hover {
    background: var(--bg-hover);
}

/* 保留旧的按钮样式用于其他地方 */
.social-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s var(--ease-apple);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    text-decoration: none;
}

.btn-social:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-social:active {
    transform: scale(0.98);
}

.btn-social svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Google Button */
.btn-google {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-google:hover {
    background: var(--bg-hover);
}

/* GitHub Button */
.btn-github {
    background: #24292f;
    border-color: #24292f;
    color: #ffffff;
}

.btn-github:hover {
    background: #1b1f23;
}

[data-theme="dark"] .btn-github {
    background: #f0f0f0;
    border-color: #f0f0f0;
    color: #24292f;
}

[data-theme="dark"] .btn-github:hover {
    background: #ffffff;
}

/* Apple Button */
.btn-apple {
    background: #000000;
    border-color: #000000;
    color: #ffffff;
}

.btn-apple:hover {
    background: #1a1a1a;
}

[data-theme="dark"] .btn-apple {
    background: #ffffff;
    border-color: #ffffff;
    color: #000000;
}

[data-theme="dark"] .btn-apple:hover {
    background: #f0f0f0;
}

/* OAuth Binding Card in Settings */
.oauth-bindings {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.oauth-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-input);
    border-radius: 12px;
}

.oauth-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.oauth-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.oauth-item-icon svg {
    width: 24px;
    height: 24px;
}

.oauth-item-details {
    display: flex;
    flex-direction: column;
}

.oauth-item-name {
    font-weight: 600;
    color: var(--text-primary);
}

.oauth-item-status {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.oauth-item-status.bound {
    color: var(--success);
}

.btn-bind {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-unbind {
    padding: 8px 16px;
    font-size: 0.85rem;
    background: var(--danger-light);
    color: var(--danger);
    border: none;
}

.btn-unbind:hover {
    background: var(--danger);
    color: white;
}

/* ===== Markdown 渲染（站内信/活动正文） ===== */
.markdown-body { line-height: 1.7; color: var(--text-primary); word-break: break-word; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 { margin: 1em 0 0.5em; font-weight: 700; line-height: 1.3; }
.markdown-body h1 { font-size: 1.5rem; }
.markdown-body h2 { font-size: 1.3rem; }
.markdown-body h3 { font-size: 1.1rem; }
.markdown-body p { margin: 0.6em 0; }
.markdown-body ul, .markdown-body ol { margin: 0.6em 0; padding-left: 1.6em; }
.markdown-body li { margin: 0.3em 0; }
.markdown-body a { color: var(--accent); text-decoration: none; }
.markdown-body a:hover { text-decoration: underline; }
.markdown-body code { background: var(--bg-input); padding: 0.15em 0.4em; border-radius: 4px; font-family: 'SF Mono', Monaco, monospace; font-size: 0.9em; }
.markdown-body pre { background: var(--bg-input); padding: 14px 16px; border-radius: 10px; overflow-x: auto; margin: 0.8em 0; }
.markdown-body pre code { background: none; padding: 0; }
.markdown-body blockquote { margin: 0.8em 0; padding: 6px 16px; border-left: 3px solid var(--border); color: var(--text-secondary); }
.markdown-body img { max-width: 100%; border-radius: 8px; }
.markdown-body table { border-collapse: collapse; margin: 0.8em 0; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border); padding: 6px 12px; }
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 1.2em 0; }
.markdown-body > :first-child { margin-top: 0; }
.markdown-body > :last-child { margin-bottom: 0; }

/* ===== Markdown 编辑器字段（编辑/预览切换） ===== */
.markdown-field { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--bg-input); }
.markdown-field-toolbar { display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-bottom: 1px solid var(--border); background: var(--bg-card); }
.markdown-field-toolbar .md-tab { padding: 4px 14px; border: none; background: transparent; border-radius: 6px; cursor: pointer; font-size: 0.85rem; color: var(--text-secondary); }
.markdown-field-toolbar .md-tab.active { background: var(--bg-hover); color: var(--text-primary); font-weight: 600; }
.markdown-field-toolbar .md-hint { margin-left: auto; font-size: 0.78rem; color: var(--text-tertiary); }
.markdown-field-input { border: none !important; border-radius: 0 !important; min-height: 220px; resize: vertical; width: 100%; }
.markdown-field-preview { min-height: 220px; padding: 14px 16px; background: var(--bg-card); }

/* ===== 用户页统一布局辅助 ===== */
/* 窄容器：表单/详情类页面（profile/settings 等），比 .container(1100) 收窄 */
.container.container-narrow { max-width: 680px; }
/* 页副标题：紧跟 .page-title 的说明文字 */
.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: -20px 0 24px;
}
/* 标题行内的副标题（header-row 为 flex，故副标题单独成行时用 .page-head 包裹） */
.page-head { margin-bottom: 28px; }
.page-head .page-title { margin-bottom: 6px; }
.page-head .page-subtitle { margin: 0; }

/* 操作列（Table 中 key=actions）：宽度按按钮内容固定、不换行，横向滚动时固定在右侧 */
.data-table th.col-actions,
.data-table td.col-actions {
    width: 1%;
    white-space: nowrap;
    position: sticky;
    right: 0;
    z-index: 1;
}
.data-table td.col-actions { background: var(--bg-card); }
.data-table tr:hover td.col-actions { background: var(--bg-hover); }
.data-table .col-actions .table-actions { flex-wrap: nowrap; }

/* 导航未读角标 */
.nav-link { position: relative; }
.nav-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 16px; height: 16px; padding: 0 5px; margin-left: 4px;
    border-radius: var(--radius-full); background: var(--danger); color: #fff;
    font-size: 0.68rem; font-weight: 600; line-height: 1; vertical-align: 2px;
}


/* ===== 数据可视化（src/components/viz，后台与用户中心共用） ===== */
/* ===== 数据可视化（Canvas 图表，src/components/viz） =====
   系列色取自经色盲校验的参考调色板（蓝/橙，对 #FFF / #1C1C1E 卡片底均通过）；
   热力图为单色相蓝色顺序色阶，暗色下近零端贴近卡片底色。 */
:root {
  --viz-1: #2a78d6;
  --viz-2: #eb6834;
  --viz-grid: #ececf0;
  --viz-axis: #d2d2d7;
  --viz-empty: #f2f2f5;
  --viz-seq-1: #cde2fb; --viz-seq-2: #9ec5f4; --viz-seq-3: #6da7ec;
  --viz-seq-4: #3987e5; --viz-seq-5: #256abf; --viz-seq-6: #184f95; --viz-seq-7: #0d366b;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    --viz-1: #3987e5;
    --viz-2: #d95926;
    --viz-grid: #2c2c2e;
    --viz-axis: #3a3a3c;
    --viz-empty: #242426;
    --viz-seq-1: #13345f; --viz-seq-2: #184f95; --viz-seq-3: #1c5cab;
    --viz-seq-4: #2a78d6; --viz-seq-5: #3987e5; --viz-seq-6: #6da7ec; --viz-seq-7: #9ec5f4;
  }
}
:root[data-theme="dark"] {
  --viz-1: #3987e5;
  --viz-2: #d95926;
  --viz-grid: #2c2c2e;
  --viz-axis: #3a3a3c;
  --viz-empty: #242426;
  --viz-seq-1: #13345f; --viz-seq-2: #184f95; --viz-seq-3: #1c5cab;
  --viz-seq-4: #2a78d6; --viz-seq-5: #3987e5; --viz-seq-6: #6da7ec; --viz-seq-7: #9ec5f4;
}

/* Canvas 容器与悬浮提示 */
.viz { position: relative; width: 100%; }
.viz canvas { display: block; width: 100%; height: 100%; }
.viz-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.8rem; color: var(--text-secondary); }
.viz-legend i, .viz-tip i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.viz-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 120px;
  padding: 8px 10px; border-radius: 10px; font-size: 0.8rem; line-height: 1.6;
  background: var(--bg-card); color: var(--text-primary);
  border: 1px solid var(--border); box-shadow: var(--shadow-md);
  transform: translate(-50%, calc(-100% - 12px)); white-space: nowrap;
}
.viz-tip b { font-weight: 600; }
.viz-tip .muted { color: var(--text-secondary); }
.viz-scale { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--text-secondary); }
.viz-scale span.ramp { display: flex; gap: 2px; }
.viz-scale span.ramp i { width: 14px; height: 10px; border-radius: 2px; }

/* 横向条形列表（分布 / 排行） */
.bar-list { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.bar-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 0.86rem; }
.bar-list .bl-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); }
.bar-list .bl-label small { margin-left: 6px; color: var(--text-secondary); }
.bar-list .bl-value { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.bar-list .bl-track { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--viz-empty); overflow: hidden; }
.bar-list .bl-fill { display: block; height: 100%; border-radius: 3px; background: var(--viz-1); transition: width 0.6s var(--ease-apple); }

/* 数据表格视图（图表的可访问替代） */
.viz-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.viz-table th, .viz-table td { padding: 7px 8px; border-bottom: 1px solid var(--border-light); text-align: right; font-variant-numeric: tabular-nums; }
.viz-table th:first-child, .viz-table td:first-child { text-align: left; }
.viz-table th { color: var(--text-secondary); font-weight: 500; }

@media (prefers-reduced-motion: reduce) {
  .bar-list .bl-fill { transition: none; }
}
.chart-empty { padding: 32px 0; text-align: center; color: var(--text-tertiary); font-size: 0.9rem; }

/* 原生控件（复选框/下拉/滚动条）随主题切换 */
:root { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) { color-scheme: dark; }
}

/* 分段选择（时间范围 / 视图切换 / 单选分段，全站共用） */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg-input); border-radius: var(--radius-full); }
.seg button {
  border: 0; background: transparent; color: var(--text-secondary); font: inherit; font-size: 0.82rem;
  padding: 5px 12px; border-radius: var(--radius-full); cursor: pointer; transition: background 0.15s, color 0.15s;
}
.seg button:hover { color: var(--text-primary); }
.seg button.active { background: var(--bg-card); color: var(--text-primary); font-weight: 600; box-shadow: var(--shadow-sm); }

/* ===== 开关 + 设置行 ===== */
.setting-list { display: flex; flex-direction: column; }
.setting-item {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 16px 0; border-bottom: 1px solid var(--border-light);
}
.setting-item:last-child { border-bottom: 0; }
.setting-item h4 { margin: 0 0 2px; font-size: 0.95rem; font-weight: 600; color: var(--text-primary); }
.setting-item p { margin: 0; font-size: 0.85rem; color: var(--text-secondary); }
.switch { position: relative; flex-shrink: 0; width: 44px; height: 26px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .slider {
    position: absolute; inset: 0; border-radius: var(--radius-full);
    background: var(--border); transition: background 0.2s var(--ease-apple);
}
.switch .slider::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.2s var(--ease-apple);
}
.switch input:checked + .slider { background: var(--success); }
.switch input:checked + .slider::after { transform: translateX(18px); }
.switch input:focus-visible + .slider { box-shadow: 0 0 0 3px var(--accent-light); }
.switch input:disabled + .slider { opacity: 0.5; }

/* =====================================================================
   UI 体系（src/components/ui）—— 会员中心等页面共用的基础零件
   规则：页面只组合这些零件，不再写页面级覆盖与内联样式。
   - 间距 4/8/12/16/24/32；卡片圆角 --radius-md(16)，控件胶囊 --radius-full
   - 卡片只用细边框、不用阴影；主按钮黑色（.btn-primary），次按钮灰底（.btn-secondary）
   - 选中态用中性色（白底/黑字），蓝色 --accent 只用于链接与数据
   ===================================================================== */
/* 次按钮：白底 + 内描边（inset 阴影不占尺寸，与主按钮等高），灰底页面与白卡片上都清晰 */
.btn-secondary { background: var(--bg-card); color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--border); }
.btn-secondary:hover { background: var(--bg-input); }
.btn-danger-ghost { background: transparent; color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-light); }

/* 页面 */
.ui-page { width: 100%; padding: 24px 28px 48px; }
.ui-page-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px;
    padding: 14px 20px; background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius-lg);
}
.ui-page-title { margin: 0; font-size: 1.3rem; font-weight: 700; color: var(--text-primary); }
.ui-page-sub { margin: 2px 0 0; font-size: 0.85rem; color: var(--text-secondary); }
.ui-page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ui-stack > * + * { margin-top: 16px; }

/* 卡片 */
.ui-card { background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius-lg); padding: 20px; min-width: 0; }
.ui-card--flush { padding: 0; overflow: hidden; }
.ui-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.ui-card--flush > .ui-card-head { padding: 18px 20px 0; }
.ui-card-title { margin: 0; font-size: 1rem; font-weight: 600; color: var(--text-primary); }
.ui-card-hint { margin: 4px 0 0; font-size: 0.82rem; color: var(--text-secondary); }
.ui-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(var(--ui-min, 220px), 1fr)); }

/* 数字卡 */
.ui-stat { display: flex; flex-direction: column; gap: 6px; }
.ui-stat-label { font-size: 0.82rem; color: var(--text-secondary); }
.ui-stat-value { font-size: 1.8rem; font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; color: var(--text-primary); }
.ui-stat-value small { margin-left: 4px; font-size: 0.9rem; font-weight: 500; color: var(--text-tertiary); }
.ui-stat-sub { font-size: 0.8rem; color: var(--text-secondary); }
.ui-stat-bar { height: 6px; margin-top: 6px; border-radius: 3px; background: var(--bg-input); overflow: hidden; }
.ui-stat-bar i { display: block; height: 100%; border-radius: 3px; background: var(--text-primary); }
.up { color: var(--success); }
.down { color: var(--danger); }

/* 列表行（卡片内分隔列表） */
.ui-list { list-style: none; margin: 0; padding: 0; }
.ui-row { display: flex; align-items: center; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--border-light); min-width: 0; }
.ui-row:last-child { border-bottom: 0; }
.ui-card:not(.ui-card--flush) .ui-row { padding-left: 0; padding-right: 0; }
.ui-row-main { flex: 1; min-width: 0; }
.ui-row-title { font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-row-meta { margin-top: 2px; font-size: 0.82rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-row-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.ui-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* 图标按钮 */
.ui-icon-btn {
    display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
    border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-secondary);
    cursor: pointer; transition: background 0.15s, color 0.15s;
}
.ui-icon-btn:hover { background: var(--bg-input); color: var(--text-primary); }
.ui-icon-btn.danger:hover { background: var(--danger-light); color: var(--danger); }
.ui-icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* 表单字段 */
.ui-field { margin-bottom: 18px; }
.ui-field > label { display: block; margin-bottom: 6px; font-size: 0.86rem; font-weight: 500; color: var(--text-secondary); }
.ui-field-hint { margin: 6px 0 0; font-size: 0.8rem; color: var(--text-tertiary); }
.ui-field-hint.error { color: var(--danger); }
.ui-field .form-input[aria-invalid="true"] { box-shadow: 0 0 0 2px var(--danger-light); }
.ui-form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
@media (max-width: 640px) { .ui-form-row { grid-template-columns: 1fr; } }

/* 空状态 */
.ui-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 48px 16px; text-align: center; }
.ui-empty-icon { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--bg-input); color: var(--text-tertiary); }
.ui-empty-title { font-weight: 600; color: var(--text-primary); }
.ui-empty-hint { font-size: 0.86rem; color: var(--text-secondary); max-width: 360px; }
.ui-empty .btn { margin-top: 8px; }

/* 分段控件尺寸：页面级标签 */
.seg.seg--md button { padding: 8px 18px; font-size: 0.9rem; }
.seg + .ui-stack, .seg + .ui-card { margin-top: 16px; }

@media (max-width: 768px) {
    .ui-page { padding: 16px 12px 40px; }
    .ui-page-head { padding: 12px 14px; border-radius: var(--radius-md); }
    .ui-page-title { font-size: 1.15rem; }
    .ui-card:not(.ui-card--flush) { padding: 18px; }
    .ui-row { padding: 14px 16px; flex-wrap: wrap; row-gap: 8px; }
    .ui-row-main { flex-basis: calc(100% - 48px); }
    .ui-row-actions { margin-left: auto; }
    .ui-card--flush > .ui-card-head, .ui-card--flush > .ui-toolbar { padding-left: 16px; padding-right: 16px; }
    .seg { max-width: 100%; overflow-x: auto; }
}
.tabs-content { margin-top: 16px; }

/* 外壳：左侧导航 + 内容区（apps/user/UserShell） */
.ui-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; background: var(--bg-body); }
.ui-side {
    position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
    background: var(--bg-card); border-right: 1px solid var(--border);
}
.ui-side-top { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 12px; border-bottom: 1px solid var(--border-light); }
.ui-brand { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); text-decoration: none; letter-spacing: -0.01em; }
.ui-side-close { display: none; }
.ui-side-nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 12px 10px; }
.ui-side-group { display: flex; flex-direction: column; gap: 2px; }
.ui-side-group-title { padding: 10px 14px 4px; font-size: 0.8rem; font-weight: 600; color: var(--text-tertiary); }
.ui-side-item {
    display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: var(--radius-md);
    font-size: 0.92rem; color: var(--text-secondary); text-decoration: none; transition: background 0.15s, color 0.15s;
}
.ui-side-item:hover { background: var(--bg-hover, var(--bg-input)); color: var(--text-primary); }
.ui-side-item.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }
.ui-side-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.85; }
.ui-side-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ui-side-item span:not(.ui-badge) { flex: 1; min-width: 0; }
.ui-badge {
    min-width: 18px; height: 18px; padding: 0 6px; border-radius: var(--radius-full);
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--danger); color: #fff; font-size: 0.7rem; font-weight: 700;
}
.ui-side-foot { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border-light); }
.ui-user { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.ui-avatar {
    width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: var(--bg-input); color: var(--text-primary); font-weight: 700;
}
.ui-user-main { min-width: 0; }
.ui-user-name { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-user-plan { font-size: 0.75rem; color: var(--text-secondary); text-decoration: none; white-space: nowrap; }
.ui-user-plan:hover { color: var(--text-primary); text-decoration: underline; }
.ui-side-tools { display: flex; gap: 2px; }
.ui-main { min-width: 0; }
.ui-topbar, .ui-scrim { display: none; }

@media (max-width: 900px) {
    /* 顶部栏按内容高，内容区吃掉剩余高度（否则短页面会把顶部栏那一行拉高） */
    .ui-shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .ui-topbar {
        position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between;
        height: 56px; padding: 0 8px; background: var(--navbar-bg); backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--border-light);
    }
    .ui-topbar-bell { position: relative; }
    .ui-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
    .ui-side {
        position: fixed; z-index: 50; left: 0; top: 0; width: 272px; max-width: 86vw;
        transform: translateX(-100%); transition: transform 0.25s var(--ease-apple); box-shadow: var(--shadow-lg);
    }
    .ui-side-close { display: inline-flex; }
    .ui-shell.is-open .ui-side { transform: none; }
    .ui-scrim { position: fixed; inset: 0; z-index: 40; background: var(--modal-overlay); opacity: 0; pointer-events: none; transition: opacity 0.25s; display: block; }
    .ui-shell.is-open .ui-scrim { opacity: 1; pointer-events: auto; }
}
@media (prefers-reduced-motion: reduce) { .ui-side, .ui-scrim { transition: none; } }
/* 表格放进卡片时由卡片提供外框（统一圆角 16，不叠双层边框） */
.ui-card .table-container { border: 0; border-radius: 0; background: transparent; }
.ui-secret { margin: 12px 0; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--bg-input); color: var(--text-primary); font-size: 0.85rem; white-space: pre-wrap; word-break: break-all; }

/* 消息列表（可展开行） */
.msg-head { width: 100%; border: 0; background: transparent; text-align: left; font: inherit; cursor: pointer; }
.msg-head:hover { background: var(--bg-input); }
.msg-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.msg-row + .msg-row { border-top: 1px solid var(--border-light); }
.msg-row .ui-row { border-bottom: 0; }
.msg-icon { width: 36px; height: 36px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--bg-input); color: var(--text-secondary); }
.msg-row .ui-row-title { display: block; font-weight: 500; }
.msg-row.unread .ui-row-title { font-weight: 700; }
.msg-dot { display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--accent); vertical-align: 2px; }
.msg-row .ui-row-meta { display: block; }
.msg-chevron { flex-shrink: 0; color: var(--text-tertiary); transition: transform 0.2s; }
.msg-chevron.open { transform: rotate(180deg); }
.msg-body { padding: 0 24px 20px 76px; font-size: 0.95rem; line-height: 1.7; color: var(--text-primary); }
.msg-actions { display: flex; gap: 8px; margin-top: 14px; }
@media (max-width: 768px) { .msg-body { padding: 0 18px 18px; } }
.setting-list + .btn { margin-top: 20px; }

/* 链接信息（统计页顶部） */
.link-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.link-info-item { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.link-info-item .ui-row-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-primary); font-size: 0.92rem; }
.ui-link { color: var(--accent); text-decoration: none; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-link:hover { text-decoration: underline; }
.cell-ellipsis { display: inline-block; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; color: var(--text-secondary); }
.ui-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ui-toolbar-hint { font-size: 0.82rem; color: var(--text-tertiary); }
.ui-block { width: 100%; }
.ui-grid--lg { --ui-min: 300px; }

/* 概览：链接行 */
.ui-check { width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--text-primary); cursor: pointer; }
.link-meta { display: flex; align-items: center; gap: 10px; }
.link-meta .ui-link { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; font-weight: 600; }
.link-target { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-bar { margin-bottom: 0; }
.ui-card--flush > .ui-toolbar { padding: 14px 20px; border-bottom: 1px solid var(--border-light); }
.bulk-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 24px; background: var(--bg-input); border-bottom: 1px solid var(--border-light); font-size: 0.88rem; font-weight: 500; }
@media (max-width: 768px) {
    .ui-row-actions .ui-icon-btn { width: 30px; height: 30px; }
    .link-meta { flex-wrap: wrap; }
}

/* 弹窗（components/Modal） */
.ui-modal-overlay {
    position: fixed; inset: 0; z-index: 10001; display: flex; align-items: center; justify-content: center; padding: 16px;
    background: var(--modal-overlay); opacity: 0; transition: opacity 0.2s var(--ease-apple);
}
.ui-modal-overlay.visible { opacity: 1; }
.ui-modal {
    display: flex; flex-direction: column; max-width: 100%; max-height: calc(100vh - 32px);
    background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border-light);
    border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
    transform: translateY(8px) scale(0.98); transition: transform 0.2s var(--ease-apple);
}
.ui-modal-overlay.visible .ui-modal { transform: none; }
.ui-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 16px 24px; border-bottom: 1px solid var(--border-light); }
.ui-modal-head h3 { margin: 0; font-size: 1.05rem; font-weight: 600; }
.ui-modal-body { flex: 1; overflow-y: auto; padding: 20px 24px; }
.ui-modal-body .ui-field:last-child { margin-bottom: 0; }
.ui-modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--border-light); }
@media (max-width: 768px) {
    .ui-modal-overlay { align-items: flex-end; padding: 8px; }
    .ui-modal { width: 100% !important; }
}
@media (prefers-reduced-motion: reduce) { .ui-modal-overlay, .ui-modal { transition: none; } }
/* 无标题无底栏（如滑块验证码 300px 宽 + 344 容器）：紧凑内边距 */
.ui-modal--bare .ui-modal-body { padding: 12px; }
@media (max-width: 768px) {
    .msg-head.ui-row { flex-wrap: nowrap; }
    .msg-head .ui-row-main { flex-basis: auto; }
}
.link-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; max-width: 320px; }
.link-cell .ui-link { display: inline-flex; align-items: center; gap: 4px; font-size: 0.85rem; }

/* 移动端兼容补充 */
.seg button { white-space: nowrap; flex-shrink: 0; }
.ui-grid--sm { --ui-min: 150px; }
@media (max-width: 768px) {
    /* 空表格不需要横向滚动的最小宽度，否则空状态文字被推出屏幕 */
    .data-table:has(td[colspan]) { min-width: 0; }
    .ui-grid--sm { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .ui-stat-value { font-size: 1.5rem; }
}
