/* ============================================================
   IOHut 主样式（完整版）
   暖橙主题 · 圆润 · 柔和
   包含：全局、导航、帖子列表、侧边栏、模态框、设置页面
   ============================================================ */

/* ===== CSS 变量 ===== */
:root {
    /* 主色 - 暖橙 */
    --primary: #f97316;
    --primary-dark: #ea580c;
    --primary-light: #fb923c;
    --primary-bg: #fff7ed;
    --primary-hover: #ea580c;

    /* 背景 & 卡片 */
    --bg: #faf8f6;
    --bg-secondary: #f1ede8;
    --bg-tertiary: #e8e3dc;
    --card-bg: #ffffff;
    --card-border: #e8e3dc;
    --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);

    /* 文字 */
    --text: #1a1a1a;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --text-tertiary: #94a3b8;

    /* 边框 & 分割线 */
    --border: #e8e3dc;
    --border-color: #e8e3dc;
    --border-light: #f1ede8;

    /* 圆角 */
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;

    /* 间距 */
    --gap: 16px;
    --gap-sm: 8px;
    --gap-lg: 24px;

    /* 字体 */
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    --mono-font: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;

    /* 过渡 */
    --transition: 0.2s ease;

    /* 头像颜色池 */
    --avatar-colors: #f97316, #8b5cf6, #ec4899, #06b6d4, #22c55e, #eab308, #f43f5e, #3b82f6, #84cc16, #d946ef;

    /* 状态颜色 */
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
}

/* ===== 暗色模式 ===== */
[data-theme="dark"] {
    --bg: #18181b;
    --bg-secondary: #27272a;
    --bg-tertiary: #3f3f46;
    --card-bg: #27272a;
    --card-border: #3f3f46;
    --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    --text: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --text-tertiary: #6b7280;
    --border: #3f3f46;
    --border-color: #3f3f46;
    --border-light: #3f3f46;
    --primary-bg: #2d1a0e;
}

/* ===== 全局重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
    line-height: 1.6;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover {
    color: var(--primary-dark);
}

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

/* ===== 容器 ===== */
.container {
    max-width: 1024px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ===== 头部导航 ===== */
.header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.92);
    transition: background var(--transition), border-color var(--transition);
}

[data-theme="dark"] .header {
    background: rgba(39, 39, 42, 0.92);
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    flex-shrink: 0;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

.logo span {
    color: var(--primary);
}

/* 导航链接 */
.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.nav-links a {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.nav-links a:hover {
    color: var(--text);
    background: var(--border-light);
}

.nav-links a.active {
    color: var(--primary);
    background: var(--primary-bg);
}

/* 右侧操作 */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.header-actions .btn {
    padding: 6px 14px;
    font-size: 13px;
}

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

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

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1.5px solid var(--border);
}
.btn-outline:hover {
    background: var(--border-light);
    color: var(--text);
}

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

.btn-success {
    background: var(--success);
    color: white;
}
.btn-success:hover {
    background: #16a34a;
}

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

.btn-danger-soft {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}
.btn-danger-soft:hover {
    background: #fee2e2;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
}
.btn-lg {
    padding: 10px 24px;
    font-size: 16px;
}
.btn-block {
    width: 100%;
    justify-content: center;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ===== 搜索框 ===== */
.search-box {
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    transition: all var(--transition);
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

.search-box input {
    border: none;
    background: transparent;
    padding: 8px 8px;
    font-size: 14px;
    width: 160px;
    color: var(--text);
    outline: none;
    font-family: var(--font);
}

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

.search-box .search-icon {
    color: var(--text-muted);
    font-size: 16px;
    flex-shrink: 0;
}

/* ===== 主布局 ===== */
.main-layout {
    display: flex;
    gap: var(--gap-lg);
    padding: 20px 0 40px;
    align-items: flex-start;
}

.main-content {
    flex: 1;
    min-width: 0;
}

.sidebar {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: var(--gap);
}

@media (max-width: 768px) {
    .main-layout {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .sidebar .card {
        flex: 1;
        min-width: 200px;
    }
    .search-box input {
        width: 100px;
    }
}

/* ===== 卡片 ===== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--card-border);
    padding: 16px 20px;
    transition: all var(--transition);
    box-shadow: var(--card-shadow);
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.card-title .count {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    background: var(--bg);
    padding: 0 8px;
    border-radius: 12px;
}

/* ===== 帖子列表 ===== */
.topic-list {
    display: flex;
    flex-direction: column;
}

.topic-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition);
}

.topic-item:last-child {
    border-bottom: none;
}

.topic-item:hover {
    background: var(--bg);
    margin: 0 -12px;
    padding: 14px 12px;
    border-radius: var(--radius-sm);
}

/* 头像 */
.topic-avatar {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
    user-select: none;
    background: var(--primary);
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 14px;
}

.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: 24px;
}

.avatar-preview-frame {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* 帖子内容 */
.topic-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.topic-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.topic-title a {
    color: var(--text);
}
.topic-title a:hover {
    color: var(--primary);
}

/* 标签 */
.topic-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 1px 10px;
    border-radius: 12px;
    flex-shrink: 0;
    background: var(--border-light);
    color: var(--text-secondary);
}

.topic-tag.tag-announce {
    background: #fef3c7;
    color: #d97706;
}
.topic-tag.tag-help {
    background: #dbeafe;
    color: #2563eb;
}
.topic-tag.tag-share {
    background: #d1fae5;
    color: #059669;
}
.topic-tag.tag-discussion {
    background: #ede9fe;
    color: #7c3aed;
}

[data-theme="dark"] .topic-tag.tag-announce {
    background: #2d1a0e;
    color: #f59e0b;
}
[data-theme="dark"] .topic-tag.tag-help {
    background: #172554;
    color: #60a5fa;
}
[data-theme="dark"] .topic-tag.tag-share {
    background: #052e16;
    color: #34d399;
}
[data-theme="dark"] .topic-tag.tag-discussion {
    background: #1e1b4b;
    color: #a78bfa;
}

/* 徽章 */
.topic-badge {
    font-size: 14px;
    flex-shrink: 0;
}
.topic-badge.pinned {
    color: var(--primary);
}
.topic-badge.locked {
    color: var(--text-muted);
}

/* 元数据 */
.topic-meta {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.topic-meta .dot {
    color: var(--text-muted);
    font-size: 3px;
    padding: 0 4px;
}

.topic-meta .node-tag {
    color: var(--text-muted);
    background: var(--bg);
    padding: 0 8px;
    border-radius: 4px;
    font-size: 12px;
}
.topic-meta .node-tag:hover {
    color: var(--primary);
}

.topic-meta .user-link {
    color: var(--text-secondary);
    font-weight: 500;
}
.topic-meta .user-link:hover {
    color: var(--primary);
}

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

.topic-meta .reply-info {
    color: var(--text-muted);
}

/* 统计 */
.topic-stats {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    padding-top: 2px;
}

.topic-stats .stat-item {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.topic-stats .stat-item .num {
    font-weight: 500;
    color: var(--text-secondary);
}

/* ===== 分页 ===== */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
    padding: 16px 0 4px;
}

.pagination a,
.pagination span {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
    min-width: 36px;
    text-align: center;
}

.pagination a:hover {
    background: var(--border-light);
    color: var(--text);
}

.pagination a.active {
    background: var(--primary);
    color: white;
}

.pagination a.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* ===== 侧边栏卡片 ===== */
.user-card .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.user-card .user-name {
    font-weight: 600;
    font-size: 16px;
}
.user-card .user-name a {
    color: var(--text);
}
.user-card .user-name a:hover {
    color: var(--primary);
}

.user-card .user-email {
    font-size: 13px;
    color: var(--text-secondary);
}

.user-card .user-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding-top: 4px;
    border-top: 1px solid var(--border-light);
}

.user-card .user-stat {
    text-align: center;
    padding: 4px 0;
}
.user-card .user-stat .num {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}
.user-card .user-stat .label {
    font-size: 11px;
    color: var(--text-muted);
}

.user-card .user-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.user-card .user-actions .btn {
    flex: 1;
    justify-content: center;
}

.guest-card .guest-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.guest-card .guest-actions .btn {
    flex: 1;
    justify-content: center;
}

/* 标签 */
.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-list .tag {
    font-size: 12px;
    padding: 3px 12px;
    border-radius: 20px;
    background: var(--bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
    transition: all var(--transition);
}

.tag-list .tag:hover {
    background: var(--primary-bg);
    border-color: var(--primary);
    color: var(--primary);
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.stats-grid .stat-item {
    text-align: center;
    padding: 8px 0;
    background: var(--bg);
    border-radius: var(--radius-sm);
}
.stats-grid .stat-item .num {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}
.stats-grid .stat-item .label {
    font-size: 11px;
    color: var(--text-muted);
}

/* ===== 状态横幅 ===== */
.status-banner {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.5;
}

.status-banner--ok {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.status-banner--warn {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.status-banner--error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

[data-theme="dark"] .status-banner--ok {
    background: #052e16;
    color: #6ee7b7;
    border-color: #166534;
}
[data-theme="dark"] .status-banner--warn {
    background: #2d1a0e;
    color: #fcd34d;
    border-color: #92400e;
}
[data-theme="dark"] .status-banner--error {
    background: #2d0a0a;
    color: #fca5a5;
    border-color: #991b1b;
}

/* ===== Toast ===== */
#toastContainer {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 360px;
    width: 100%;
    pointer-events: none;
}

.toast {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    transform: translateX(calc(100% + 24px));
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 4px solid transparent;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}
.toast.hide {
    transform: translateX(calc(100% + 24px));
    opacity: 0;
}

.toast .icon {
    font-size: 18px;
    flex-shrink: 0;
}
.toast .msg {
    flex: 1;
}
.toast .close-btn {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.5;
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
    transition: opacity 0.2s;
}
.toast .close-btn:hover {
    opacity: 1;
}

.toast-success {
    background: #ecfdf5;
    color: #065f46;
    border-left-color: var(--success);
}
.toast-error {
    background: #fef2f2;
    color: #991b1b;
    border-left-color: var(--danger);
}
.toast-info {
    background: #eff6ff;
    color: #1e40af;
    border-left-color: var(--info);
}
.toast-loading {
    background: var(--card-bg);
    color: var(--text-secondary);
    border-left-color: var(--border);
}
.toast-warning {
    background: #fffbeb;
    color: #92400e;
    border-left-color: var(--warning);
}

[data-theme="dark"] .toast-success {
    background: #052e16;
    color: #6ee7b7;
}
[data-theme="dark"] .toast-error {
    background: #2d0a0a;
    color: #fca5a5;
}
[data-theme="dark"] .toast-info {
    background: #0a1a2d;
    color: #93c5fd;
}
[data-theme="dark"] .toast-warning {
    background: #2d1a0a;
    color: #fcd34d;
}

/* ===== 模态框 ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--card-bg);
    border-radius: var(--radius);
    max-width: 420px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px 28px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
    animation: modalIn 0.25s ease;
    border: 1px solid var(--card-border);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.94) translateY(12px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal .modal-close {
    float: right;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 4px;
    transition: color var(--transition);
    line-height: 1;
}

.modal .modal-close:hover {
    color: var(--text);
}

.modal h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.modal .subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

.modal .form-group {
    margin-bottom: 14px;
}

.modal .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.modal .form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    transition: all var(--transition);
}

.modal .form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
}

.modal .form-group input::placeholder {
    color: var(--text-muted);
}

.modal .form-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.modal .form-actions .btn {
    justify-content: center;
}

.modal .form-actions .btn:first-child {
    margin-top: 4px;
}

.modal .form-footer {
    text-align: center;
    margin-top: 14px;
    font-size: 14px;
    color: var(--text-secondary);
}

.modal .form-footer a {
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
}
.modal .form-footer a:hover {
    text-decoration: underline;
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 8px;
}
.empty-state h3 {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 16px;
}
.empty-state p {
    font-size: 14px;
    margin-top: 2px;
}

/* ===== 加载状态 ===== */
.loading-dots::after {
    content: '...';
    animation: dots 1.2s steps(4, end) infinite;
}

@keyframes dots {
    0% {
        content: '';
    }
    25% {
        content: '.';
    }
    50% {
        content: '..';
    }
    75% {
        content: '...';
    }
}

/* ===== 工具类 ===== */
.text-center {
    text-align: center;
}
.text-muted {
    color: var(--text-muted);
}
.text-secondary {
    color: var(--text-secondary);
}
.mt-8 {
    margin-top: 8px;
}
.mt-12 {
    margin-top: 12px;
}
.mt-16 {
    margin-top: 16px;
}
.mb-8 {
    margin-bottom: 8px;
}
.mb-12 {
    margin-bottom: 12px;
}
.mb-16 {
    margin-bottom: 16px;
}
.gap-8 {
    gap: 8px;
}
.gap-12 {
    gap: 12px;
}
.flex {
    display: flex;
}
.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}
.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.flex-col {
    display: flex;
    flex-direction: column;
}
.w-full {
    width: 100%;
}

/* ============================================================
   设置页面样式
   ============================================================ */

/* 设置面板容器 */
.settings-panel {
    display: none;
    padding: 12px 24px;
}

.settings-panel.active {
    display: block;
}

/* 顶部 pill 分组切换器 */
.settings-group-bar {
    margin-bottom: 16px;
}

.settings-group-pills {
    display: inline-flex;
    gap: 4px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: 999px;
}

.settings-group-pills .pill-tab {
    padding: 6px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
}

.settings-group-pills .pill-tab:hover {
    color: var(--text);
}

.settings-group-pills .pill-tab.active {
    background: var(--card-bg);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* 设置布局 */
.settings-layout {
    display: flex;
    gap: 0;
    min-height: 160px;
}

/* 左侧导航 */
.settings-sidenav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 120px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    padding-right: 12px;
    margin-right: 20px;
}

.sidenav-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidenav-group-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    padding: 10px 10px 4px 12px;
    letter-spacing: 0.04em;
    user-select: none;
}

.sidenav-group-label:first-child {
    padding-top: 0;
}

.sidenav-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 7px 10px 7px 12px;
    font-size: 13px;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-left: 2px solid transparent;
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.sidenav-item:hover {
    background: var(--bg-secondary);
    color: var(--text);
}

.sidenav-item.active {
    background: var(--primary-bg);
    color: var(--text);
    font-weight: 600;
    border-left-color: var(--primary);
}

.sidenav-back {
    display: none;
    text-decoration: none;
    font-size: 13px;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
}

.sidenav-back:hover {
    background: var(--bg-secondary);
    color: var(--text);
}

/* 右侧内容 */
.settings-subcontent {
    flex: 1;
    min-width: 0;
}

.sub-panel {
    display: none;
}

.sub-panel.active {
    display: block;
}

/* ===== 安全设置 ===== */
.email-settings-card {
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 26px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.email-current-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.email-current-value {
    font-size: 15px;
    word-break: break-all;
}

.email-badge {
    display: inline-block;
    font-size: 12px;
    line-height: 1;
    padding: 4px 10px;
    border-radius: 999px;
    flex: 0 0 auto;
}

.email-unverified-tip {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 13px;
}

.email-unverified-tip button {
    flex: 0 0 auto;
    align-self: center;
}

/* 修改密码 */
.password-settings-card {
    max-width: 520px;
}

.security-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.security-form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.security-form-row label {
    font-size: 13px;
    color: var(--text-secondary);
}

.security-form-row input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    transition: all var(--transition);
    font-family: var(--font);
}

.security-form-row input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
}

.security-form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}

/* ===== 两步验证 ===== */
.twofa-card {
    max-width: 560px;
}

.twofa-section {
    margin-top: 12px;
}

.twofa-section h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
}

.twofa-section ol {
    padding-left: 18px;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 12px;
}

.code-block-mono {
    font-family: var(--mono-font);
    font-size: 13px;
    padding: 10px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    word-break: break-all;
    line-height: 1.6;
}

#TwofaQR {
    text-align: center;
    margin: 8px 0;
}

#TwofaQR img {
    display: block;
    margin: 12px auto;
    max-width: 220px;
    height: auto;
    background: #fff;
    padding: 8px;
    border-radius: 4px;
}

/* ===== 头像设置 ===== */
.avatar-settings-layout {
    display: flex;
    align-items: flex-start;
    gap: 24px;
}

.avatar-preview-wrap {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.avatar-preview-frame .avatar {
    width: 72px;
    height: 72px;
    font-size: 28px;
}

.avatar-form-fields {
    flex: 1;
    min-width: 0;
}

/* ===== 设备管理 ===== */
.sessions-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.session-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
}

.session-row:last-child {
    border-bottom: none;
}

.session-row-info {
    min-width: 0;
    flex: 1 1 220px;
    word-break: break-word;
}

.session-row-action {
    flex: 0 0 auto;
    margin-left: auto;
}

/* ===== 活动记录 ===== */
.security-info-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 0;
}

.security-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.security-ip {
    font-family: var(--mono-font);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    background: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.03em;
}

.security-tip {
    font-size: 12px;
    color: var(--text-muted);
    margin: 4px 0 0;
    padding: 8px 10px;
    border-left: 3px solid var(--warning);
    background: var(--primary-bg);
    border-radius: 0 4px 4px 0;
    line-height: 1.5;
}

.login-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 6px;
}

.login-history-table th,
.login-history-table td {
    text-align: left;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
}

.login-history-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
}

.login-history-table td {
    color: var(--text);
}

.login-history-table .mono-ip {
    font-family: var(--mono-font);
    font-size: 12px;
}

.login-history-table .ua-cell {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ===== 通知设置 ===== */
.notifications-settings {
    max-width: 760px;
}

.notif-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.notif-panel-title {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
    flex-wrap: wrap;
}

.notif-panel-title h4 {
    margin: 0;
    color: var(--text);
}

.notif-category-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.notif-category-section {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    overflow: hidden;
}

.notif-category-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    cursor: pointer;
    user-select: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: var(--font);
    font-size: 14px;
    color: var(--text);
}

.notif-category-head:hover {
    background: color-mix(in srgb, var(--bg-tertiary) 85%, transparent);
}

.notif-category-main {
    flex: 1 1 auto;
}

.notif-category-main h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.notif-category-meta {
    margin-top: 3px;
    font-size: 12px;
    color: var(--text-muted);
}

.notif-category-caret {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: var(--text-tertiary);
}

.notif-category-caret svg {
    width: 16px;
    height: 16px;
    transition: transform 0.18s ease;
}

.notif-category-section[open] .notif-category-caret svg {
    transform: rotate(90deg);
}

.notif-event-list {
    display: flex;
    flex-direction: column;
}

.notif-event-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 14px;
    border-top: 1px solid var(--border);
}

.notif-event-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.notif-event-action {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 16px;
}

.notif-ctrl {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 44px;
}

.notif-ctrl-label {
    font-size: 11px;
    line-height: 1;
    white-space: nowrap;
    color: var(--text-tertiary);
}

/* 开关 */
.notif-switch {
    position: relative;
    width: 40px;
    height: 22px;
    background: var(--bg-tertiary);
    border-radius: 11px;
    cursor: pointer;
    transition: background var(--transition);
    border: none;
    padding: 0;
}

.notif-switch.active {
    background: var(--primary);
}

.notif-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform var(--transition);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.notif-switch.active::after {
    transform: translateX(18px);
}

.notif-email-na {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 24px;
    color: var(--text-tertiary);
}

.notif-lock {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
}

.notif-lock svg {
    width: 17px;
    height: 17px;
}

/* ===== 签名编辑器 ===== */
.signature-editor {
    position: relative;
    padding: 14px 16px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
}

.signature-editor .md-toolbar {
    display: flex;
    gap: 2px;
    padding: 6px 0 8px;
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
}

.signature-editor .md-toolbar .md-btn {
    background: none;
    border: none;
    padding: 4px 8px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.signature-editor .md-toolbar .md-btn:hover {
    background: var(--bg-secondary);
    color: var(--text);
}

.signature-editor .md-toolbar .md-btn svg {
    width: 18px;
    height: 18px;
}

.signature-editor .md-toolbar .md-separator {
    width: 1px;
    background: var(--border);
    margin: 4px 6px;
}

.signature-editor .merged-composer-editor {
    padding: 4px 0;
}

.signature-textarea {
    width: 100%;
    min-height: 80px;
    padding: 8px 4px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-family: var(--font);
    color: var(--text);
    resize: vertical;
    outline: none;
    line-height: 1.6;
}

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

.signature-editor .merged-composer-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
    flex-wrap: wrap;
    gap: 8px;
}

.signature-char-count {
    font-size: 12px;
    color: var(--text-muted);
}

.signature-char-count.warn {
    color: var(--warning);
}
.signature-char-count.error {
    color: var(--danger);
}

.signature-editor .merged-composer-meta-list {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.signature-editor .merged-composer-footer-actions {
    display: flex;
    gap: 8px;
}

.signature-editor .merged-composer-submit {
    display: flex;
    align-items: center;
    gap: 6px;
}

.signature-editor .emoji-picker {
    display: none;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 4px;
    border-top: 1px solid var(--border-light);
}

.signature-editor .emoji-picker.show {
    display: flex;
}

.signature-editor .emoji-picker .emoji-item {
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xs);
    transition: background var(--transition);
    border: none;
    background: transparent;
    font-size: 18px;
    padding: 0;
}

.signature-editor .emoji-picker .emoji-item:hover {
    background: var(--bg-secondary);
}

.signature-editor .input-panel {
    margin: 6px 0;
    display: none;
}

.signature-editor .input-panel.show {
    display: block;
}

.signature-editor .input-panel-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.signature-editor .input-panel-row input {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    font-family: var(--font);
    flex: 1;
    min-width: 120px;
}

.signature-editor .input-panel-row input:focus {
    outline: none;
    border-color: var(--primary);
}

.signature-preview-card {
    margin-top: 16px;
    padding: 14px 16px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
}

.signature-preview-label {
    display: block;
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== Telegram / GitHub 绑定 ===== */
.auth-btn-telegram {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    transition: all var(--transition);
}

.auth-btn-telegram:hover {
    background: var(--bg-secondary);
}

.auth-btn-github {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: none;
    background: #24292e;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: white;
    transition: all var(--transition);
}

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

.auth-btn-github svg {
    fill: currentColor;
}

.auth-telegram-panel {
    margin-top: 12px;
}

/* ===== 响应式（设置页） ===== */
@media screen and (max-width: 768px) {
    .settings-layout {
        flex-direction: column;
        gap: 12px;
    }

    .settings-sidenav {
        width: auto;
        align-self: flex-start;
        max-width: 100%;
        flex-direction: row;
        align-items: center;
        gap: 0;
        overflow-x: auto;
        background: var(--bg-secondary);
        border-radius: 999px;
        border-right: 0;
        padding: 4px;
        margin-right: 0;
    }

    .sidenav-item {
        width: auto;
        padding: 4px 12px;
        font-size: 13px;
        font-weight: 500;
        border: none;
        border-radius: 999px;
        flex: 0 0 auto;
    }

    .sidenav-item.active {
        border-left-color: transparent;
        background: var(--card-bg);
        color: var(--text);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    }

    .sidenav-group {
        flex-direction: row;
        gap: 0;
    }

    .sidenav-back {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 4px 10px 4px 8px;
        font-size: 12px;
        font-weight: 500;
        margin-right: 4px;
        white-space: nowrap;
    }

    .settings-panel {
        padding: 8px 12px;
    }

    .settings-group-pills {
        flex-wrap: wrap;
        border-radius: var(--radius-sm);
        padding: 4px;
    }

    .settings-group-pills .pill-tab {
        font-size: 12px;
        padding: 4px 12px;
    }

    .avatar-settings-layout {
        flex-direction: column;
        align-items: center;
    }

    .notif-panel-head,
    .notif-category-head,
    .notif-event-row {
        align-items: flex-start;
    }

    .notif-event-action {
        flex-wrap: wrap;
        gap: 8px;
    }

    .login-history-table thead {
        display: none;
    }
    .login-history-table,
    .login-history-table tbody,
    .login-history-table tr,
    .login-history-table td {
        display: block;
        width: 100%;
    }
    .login-history-table tbody tr {
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        padding: 8px 12px;
        margin-bottom: 8px;
    }
    .login-history-table tbody td {
        padding: 3px 0;
        border-bottom: none;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        font-size: 12px;
        line-height: 1.5;
    }
    .login-history-table tbody td::before {
        content: attr(data-label);
        display: inline-block;
        min-width: 56px;
        font-weight: 600;
        color: var(--text-secondary);
        margin-right: 6px;
    }
    .login-history-table .ua-cell {
        max-width: none;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .email-settings-card,
    .password-settings-card {
        max-width: 100%;
    }

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

    .session-row {
        flex-direction: column;
        align-items: stretch;
    }
    .session-row-action {
        margin-left: 0;
    }
}

/* ===== 响应式（全局） ===== */
@media (max-width: 600px) {
    .header .container {
        flex-wrap: wrap;
    }
    .nav-links {
        order: 3;
        width: 100%;
        justify-content: center;
        gap: 0;
    }
    .nav-links a {
        font-size: 13px;
        padding: 4px 10px;
    }
    .header-actions .btn span {
        display: none;
    }
    .search-box input {
        width: 80px;
    }
    .modal {
        padding: 24px 18px;
        margin: 10px;
    }
    .topic-item {
        gap: 10px;
        padding: 12px 0;
    }
    .topic-avatar {
        width: 34px;
        height: 34px;
    }
    .avatar {
        width: 34px;
        height: 34px;
        font-size: 14px;
    }
    .topic-title {
        font-size: 14px;
    }
    .topic-stats .stat-item {
        font-size: 11px;
    }
    .topic-meta {
        font-size: 12px;
    }
    .topic-meta .reply-info {
        display: none;
    }
}
/* ===== 表单样式 ===== */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}
/* ===== 用户悬浮卡片 ===== */
.user-card-popup {
    position: fixed;
    z-index: 3000;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--card-border);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
    min-width: 280px;
    max-width: 340px;
    padding: 20px 22px;
    animation: popupFadeIn 0.2s ease;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-6px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.user-card-popup-inner {
    position: relative;
}

.user-card-close {
    position: absolute;
    top: -4px;
    right: -4px;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 50%;
    transition: all 0.2s;
}

.user-card-close:hover {
    background: var(--bg-secondary);
    color: var(--text);
}

.user-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.user-card-avatar {
    flex-shrink: 0;
}

.user-card-avatar .avatar {
    width: 56px;
    height: 56px;
    font-size: 24px;
}

.user-card-name-section {
    flex: 1;
    min-width: 0;
}

.user-card-display-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
}

.user-card-username {
    font-size: 13px;
    color: var(--text-muted);
}

.user-card-body {
    padding: 8px 0 12px;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

.user-card-bio {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.5;
    word-break: break-word;
}

.user-card-bio:empty {
    display: none;
}

.user-card-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: var(--text-muted);
}

.user-card-meta a {
    color: var(--primary);
    text-decoration: none;
}

.user-card-meta a:hover {
    text-decoration: underline;
}

.user-card-stats {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
    font-size: 13px;
    color: var(--text-muted);
}

.user-card-stats strong {
    color: var(--text);
}

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

.user-card-actions .btn {
    flex: 1;
    justify-content: center;
}

/* 暗色模式适配 */
[data-theme="dark"] .user-card-popup {
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
}