/* ========== 全局变量 & 重置 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    /* 主色：绿色系 */
    --primary: #22c55e;
    --primary-dark: #16a34a;
    --primary-light: #dcfce7;
    --primary-bg: #f0fdf4;

    /* 状态色 */
    --success: #22c55e;
    --success-light: #dcfce7;
    --info: #3b82f6;
    --info-light: #dbeafe;
    --warn: #f59e0b;
    --warn-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --purple: #a855f7;
    --purple-light: #f3e8ff;
    --orange: #f97316;
    --orange-light: #ffedd5;

    /* 中性色 */
    --bg: #eff4f7;       /* 页面背景：浅蓝灰（参考截图色调） */
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --text: #1f2937;      /* 主文字：深灰 */
    --text-2: #4b5563;     /* 次文字 */
    --text-3: #9ca3af;     /* 辅助文字 */
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --hover-bg: #f9fafb;

    /* 平台色 */
    --qq-color: #12b7f5;
    --weibo-color: #e6162d;

    /* 尺寸 */
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 1px 3px rgba(0, 0, 0, 0.02);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* ========== 布局 ========== */
.app { display: flex; height: 100vh; max-width: 100vw; overflow: hidden; }

/* ===== 侧边栏（浅色，白色背景） ===== */
.sidebar {
    width: 232px;
    background: var(--sidebar-bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 10;
    border-right: 1px solid var(--border-light);
}
.logo {
    padding: 22px 20px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-light);
}
.logo-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.25);
    color: #fff; flex-shrink: 0;
}
.logo-title { font-size: 17px; font-weight: 700; color: var(--text); }
.logo-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }

.nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 14px;
    color: var(--text-2);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
    font-size: 14px;
    font-weight: 500;
}
.nav-item:hover { background: var(--hover-bg); color: var(--text); }
.nav-item.active {
    background: var(--primary-bg);
    color: var(--primary-dark);
    font-weight: 600;
}
.nav-item.active .nav-ico { color: var(--primary-dark); }
.nav-ico {
    width: 20px; height: 20px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-3);
    flex-shrink: 0;
}

/* 侧边栏底部 */
.sidebar-footer {
    padding: 16px 16px 14px;
    border-top: 1px solid var(--border-light);
    font-size: 12px;
}
.footer-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}
.qr-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    text-align: center;
    margin-bottom: 12px;
}
.qr-placeholder {
    width: 96px; height: 96px;
    margin: 0 auto 6px;
    background: #fff;
    border: 1px dashed var(--border);
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 40px;
}
.qr-img {
    width: 96px; height: 96px;
    margin: 0 auto 6px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}
.qr-tip { font-size: 11px; color: var(--text-3); }
.footer-status {
    display: flex; align-items: center; gap: 7px;
    color: var(--text-2);
}
.footer-status .status-dot {
    display: inline-block;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 3px var(--success-light);
}
.footer-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
}
.footer-version { color: var(--text-3); font-size: 11px; }

/* ===== 主内容 ===== */
.main {
    flex: 1;
    margin-left: 232px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-width: 0;
    max-width: calc(100vw - 232px);
    overflow: hidden;
}

/* 顶部栏 */
.topbar {
    background: var(--card-bg);
    padding: 18px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    z-index: 5;
}
.topbar-left { display: flex; flex-direction: column; gap: 2px; }
.topbar h1 { font-size: 20px; font-weight: 700; color: var(--text); }
.topbar-sub { font-size: 12.5px; color: var(--text-3); }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.icon-btn {
    width: 38px; height: 38px;
    background: var(--bg);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-2);
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}
.icon-btn:hover { background: var(--border-light); color: var(--primary-dark); }

/* 铃铛红点 */
.notif-bell-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}

/* 通知下拉菜单 */
.notif-dropdown {
    position: absolute;
    top: 52px;
    right: 28px;
    width: 360px;
    max-height: 420px;
    overflow-y: auto;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 100;
}
.notif-dropdown::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 24px;
    width: 12px;
    height: 12px;
    background: var(--card-bg);
    border-left: 1px solid var(--border);
    border-top: 1px solid var(--border);
    transform: rotate(45deg);
}
.notif-dropdown-header {
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    border-bottom: 1px solid var(--border-light);
}
.notif-dropdown-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-3);
    font-size: 13px;
}
.notif-dropdown-list {
    padding: 4px 0;
}
.notif-dropdown-item {
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.12s;
    border-bottom: 1px solid var(--border-light);
}
.notif-dropdown-item:last-child { border-bottom: none; }
.notif-dropdown-item:hover { background: var(--hover-bg); }
.notif-dropdown-item.unread {
    background: rgba(52,152,219,0.06);
    position: relative;
}
.notif-dropdown-item.unread::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
}
.notif-dropdown-item.unread .notif-dropdown-item-title { font-weight: 600; }
.notif-dropdown-item-title {
    font-size: 13px;
    color: var(--text);
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.notif-dropdown-item-preview {
    font-size: 12px;
    color: var(--text-3);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.notif-dropdown-item-time {
    font-size: 11px;
    color: var(--text-3);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 12px 5px 5px;
    background: var(--bg);
    border-radius: 999px;
    cursor: pointer;
}
.user-chip:hover { background: var(--border-light); }
.user-avatar {
    width: 30px; height: 30px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
}
.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
}

.content { padding: 24px 28px; flex: 1; min-width: 0; overflow-y: auto; overflow-x: hidden; }

/* ========== 卡片 ========== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    margin-bottom: 18px;
    min-width: 0;
    overflow: hidden;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}
.card-header .card-title { margin-bottom: 0; }
.card-header .card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
/* card-title 里的标题文字不换行 */
.card-title-text { flex-shrink: 0; }
/* card-title 里的按钮组最右，整体 flex 时自动贴右，此处加保险 */
.card-title .card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-wrap: nowrap;
}

/* ========== 统计卡片网格（新样式：彩色图标框） ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}
.stat-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}
.stat-icon.green   { background: var(--primary-light); color: var(--primary-dark); }
.stat-icon.blue    { background: var(--info-light); color: var(--info); }
.stat-icon.purple  { background: var(--purple-light); color: var(--purple); }
.stat-icon.orange  { background: var(--orange-light); color: var(--orange); }

.stat-content { flex: 1; min-width: 0; }
.stat-label {
    font-size: 13px;
    color: var(--text-3);
    margin-bottom: 4px;
}
.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
}
.stat-sub {
    font-size: 11.5px;
    color: var(--text-3);
    margin-top: 4px;
}

/* ========== 双栏布局（趋势图 + 成功率） ========== */
.two-col-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
    align-items: stretch;
}
.two-col-grid > .card {
    display: flex;
    flex-direction: column;
    height: 100%;
    margin-bottom: 0;
}

/* ========== Tabs（近7天/近30天/近90天） ========== */
.seg-tabs {
    display: inline-flex;
    background: var(--bg);
    padding: 3px;
    border-radius: 8px;
    gap: 2px;
}
.seg-tab {
    padding: 5px 14px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-2);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
    background: transparent;
}
.seg-tab:hover { color: var(--text); }
.seg-tab.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 1px 3px rgba(34, 197, 94, 0.3);
}

/* ========== 图表占位 ========== */
.chart-placeholder {
    flex: 1 1 auto;
    min-height: 200px;
    position: relative;
    display: flex;
    align-items: flex-end;
    padding: 4px 0 4px;
    overflow-x: hidden;
}
.chart-bars-scroll {
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}
.chart-bars {
    display: flex;
    align-items: flex-end;
    height: 100%;
}
/* 近7天：自适应撑满，柱子 flex:1 等分宽度 */
.chart-bars.mode-fit {
    width: 100%;
    gap: 16px;
}
.chart-bars.mode-fit .chart-bar-group {
    flex: 1 1 0;
    min-width: 0;
}
/* 近30/90天：固定宽度，横向滚动 */
.chart-bars.mode-scroll {
    width: 100%;
    min-width: max-content;
    gap: 12px;
}
.chart-bars.mode-scroll .chart-bar-group {
    flex: 0 0 auto;
    width: 32px;
}
.chart-bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    height: 100%;
    justify-content: flex-end;
}
.chart-bar {
    width: 75%;
    min-height: 6px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 6px 6px 2px 2px;
    position: relative;
    transition: all 0.2s;
}
.chart-bar-group.is-empty .chart-bar {
    height: 6px !important;
    min-height: 6px;
    background: #e5e7eb;
}
.chart-bar-group.is-empty:hover .chart-bar { background: #d1d5db; }
.chart-bar:hover { filter: brightness(1.1); }
.chart-bar-value {
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 600;
    color: var(--primary-dark);
    white-space: nowrap;
}
.chart-bar-label {
    font-size: 10.5px;
    color: var(--text-3);
    white-space: nowrap;
    line-height: 1;
}

/* ========== 成功率圆环 ========== */
.rate-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0 10px;
    flex: 1 1 auto;
    gap: 16px;
}
.ring-chart {
    position: relative;
    width: 160px;
    height: 160px;
    margin-bottom: 20px;
}
.ring-chart svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}
.ring-bg { fill: none; stroke: var(--bg); stroke-width: 12; }
.ring-fg { fill: none; stroke: var(--primary); stroke-width: 12;
           stroke-linecap: round; transition: stroke-dashoffset 0.5s; }
.ring-label {
    position: absolute;
    inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
}
.ring-value {
    font-size: 30px;
    font-weight: 700;
    color: var(--text);
}
.ring-value small { font-size: 14px; font-weight: 600; color: var(--text-2); }
.ring-caption {
    font-size: 11.5px;
    color: var(--text-3);
    margin-top: 2px;
}

.rate-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.rate-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}
.rate-item-left { display: flex; align-items: center; gap: 10px; }
.rate-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
}
.rate-dot.green   { background: var(--success); }
.rate-dot.red     { background: var(--danger); }
.rate-dot.orange  { background: var(--warn); }
.rate-label { font-size: 13px; color: var(--text-2); }
.rate-count { font-size: 14px; font-weight: 600; color: var(--text); }

/* ========== 最近活动 ========== */
.view-all {
    font-size: 13px;
    color: var(--primary-dark);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}
.view-all:hover { text-decoration: underline; }

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 10px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}
.activity-item:hover { background: var(--hover-bg); }
.activity-check {
    width: 22px; height: 22px;
    flex-shrink: 0;
    margin-top: 1px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary-dark);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
    font-weight: 700;
}
.activity-content { flex: 1; min-width: 0; }
.activity-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}
.activity-desc {
    font-size: 12px;
    color: var(--text-3);
}
.activity-time {
    font-size: 11.5px;
    color: var(--text-3);
    flex-shrink: 0;
    padding-top: 3px;
}

/* ========== 按钮 ========== */
.btn {
    padding: 8px 16px;
    height: 38px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary);
    color: #fff;
}
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost {
    background: transparent;
    color: var(--text-2);
    border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); border-color: var(--text-3); }
.btn-success { background: var(--success); }
.btn-success:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-warn { background: var(--warn); }
.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 6px; white-space: nowrap; height: auto; }
/* 系统设置保存按钮 - 避免折行 */
.btn-save-sm { min-width: 72px; justify-content: center; }

/* ========== 表格 ========== */
.table { width: 100%; min-width: max-content; border-collapse: separate; border-spacing: 0; }
.table th, .table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    white-space: nowrap;          /* 单行显示，不折行 */
    vertical-align: middle;
}
.table th {
    background: var(--card-bg);
    font-weight: 600;
    color: var(--text-3);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    position: sticky;
    top: 0;
    z-index: 1;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--hover-bg); }
.table-wrap { overflow-x: auto; overflow-y: visible; border-radius: var(--radius-sm); min-width: 0; }

/* 操作列粘性固定在最右（左右滑动时可见） */
.table th.col-actions,
.table td.col-actions {
    position: sticky;
    right: 0;
    background: var(--card-bg);
    box-shadow: -4px 0 8px -4px rgba(15, 23, 42, 0.08);
    z-index: 2;
}
.table tr:hover td.col-actions { background: var(--hover-bg); }
.table th.col-actions { z-index: 3; }

/* ========== 标签 ========== */
.tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 500;
}
.tag-qq     { background: rgba(18,183,245,0.12); color: var(--qq-color); }
.tag-weibo  { background: rgba(230,22,45,0.12); color: var(--weibo-color); }
.tag-success{ background: var(--success-light); color: var(--primary-dark); }
.tag-warn   { background: var(--warn-light); color: #b45309; }
.tag-danger { background: var(--danger-light); color: #b91c1c; }
.tag-info   { background: var(--info-light); color: #1d4ed8; }
.tag-default{ background: var(--border-light); color: var(--text-3); }

/* ========== 表单 ========== */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: 12.5px;
    color: var(--text-2);
    margin-bottom: 6px;
    font-weight: 500;
}
.form-control, select.form-control, select {
    width: 100%;
    height: 38px;
    padding: 8px 13px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    transition: all 0.15s;
    line-height: 1.4;
}
.form-control:focus, select.form-control:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
textarea.form-control { min-height: 90px; resize: vertical; height: auto; padding: 8px 13px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.help-text { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }

/* 过期会员禁用样式 */
.disabled-feature {
    pointer-events: none !important;
    opacity: 0.5 !important;
}
.disabled-feature:hover {
    background: var(--primary) !important;
    filter: none !important;
}

/* Switch 开关 */
.switch-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid var(--border-1);
    border-radius: 10px;
    background: var(--bg-2);
    margin-bottom: 12px;
}
.switch-row .switch-label { font-size: 13.5px; color: var(--text-1); font-weight: 600; }
.switch-row .switch-desc { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.switch {
    position: relative;
    display: inline-block;
    width: 44px; height: 24px;
    flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; inset: 0;
    background-color: var(--border-2);
    border-radius: 24px;
    transition: 0.2s;
    cursor: pointer;
}
.slider::before {
    position: absolute;
    content: "";
    height: 18px; width: 18px;
    left: 3px; bottom: 3px;
    background-color: #fff;
    border-radius: 50%;
    transition: 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch input:checked + .slider { background-color: #22c55e; }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* 增强版开关 + 内联文字（清楚显示开关状态） */
.switch-row-enhanced {
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(52,152,219,0.02), rgba(52,152,219,0));
    padding: 12px 14px;
    border-radius: var(--radius);
    transition: all 0.15s ease;
}
.switch-row-enhanced:hover {
    border-color: var(--primary-light);
    background: rgba(52,152,219,0.04);
}
.switch-enhanced {
    display: flex;
    align-items: center;
    gap: 10px;
    width: auto;
    height: auto;
}
.switch-enhanced .slider-enhanced {
    position: relative;
    width: 44px;
    height: 24px;
    display: inline-block;
    flex-shrink: 0;
}
.switch-enhanced input { opacity: 0; width: 0; height: 0; }
.switch-enhanced .slider-enhanced::before {
    content: "";
    position: absolute;
    inset: 0;
    background-color: #e9edf2;
    border: 1px solid #cfd6de;
    border-radius: 24px;
    transition: 0.2s;
    cursor: pointer;
}
.switch-enhanced .slider-enhanced::after {
    position: absolute;
    content: "";
    height: 18px; width: 18px;
    left: 2px; top: 2px;
    background-color: #fff;
    border: 1px solid rgba(0,0,0,0.10);
    border-radius: 50%;
    transition: 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.18);
    z-index: 1;
}
.switch-enhanced input:checked + .slider-enhanced::before {
    background-color: var(--primary);
    border-color: var(--primary);
}
.switch-enhanced input:checked + .slider-enhanced::after { transform: translateX(20px); }
.switch-label-inline {
    min-width: 34px;
    text-align: center;
    font-size: 12.5px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
    background: var(--bg-2);
    color: var(--text-3);
    transition: all 0.15s;
}
.switch-enhanced input:checked ~ .switch-label-inline {
    background: rgba(52,152,219,0.1);
    color: var(--primary);
}

/* 加载动画旋转关键帧 */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
/* 按钮内小型加载指示器 */
.btn-spinner {
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255,255,255,0.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}
.form-control:disabled { background: var(--bg-2); cursor: not-allowed; opacity: 0.75; }

/* ========== Modal ========== */
.modal-mask {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
    animation: fadeIn 0.15s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
    background: #fff;
    border-radius: 14px;
    width: 540px; max-width: 92vw;
    max-height: 88vh;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}
.modal-header {
    padding: 16px 22px;
    border-bottom: 1px solid var(--border-light);
    display: flex; justify-content: space-between; align-items: center;
    font-weight: 600;
    font-size: 15px;
}
.modal-close {
    background: none; border: none;
    font-size: 22px; cursor: pointer;
    color: var(--text-3);
    line-height: 1;
    width: 28px; height: 28px;
    border-radius: 6px;
    transition: all 0.15s;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border-light);
    display: flex; justify-content: flex-end; gap: 8px;
}

/* ========== Toast ========== */
.toast {
    position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
    background: #1f2937;
    color: #fff;
    padding: 10px 20px;
    border-radius: 10px;
    z-index: 1100;
    font-size: 13px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    animation: slideDown 0.2s;
}
@keyframes slideDown {
    from { transform: translateX(-50%) translateY(-10px); opacity: 0; }
    to   { transform: translateX(-50%) translateY(0); opacity: 1; }
}
.toast.success { background: var(--primary-dark); }
.toast.error   { background: var(--danger); }
.toast.warn    { background: var(--warn); }

/* ========== 日志 ========== */
.log-list { max-height: 540px; overflow-y: auto; }
.log-item {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
    display: flex; gap: 12px;
    font-size: 12px;
    font-family: "SF Mono", Menlo, Consolas, monospace;
}
.log-item:last-child { border-bottom: none; }
.log-time   { color: var(--text-3); white-space: nowrap; min-width: 140px; }
.log-level  { width: 50px; font-weight: 700; }
.log-level.info    { color: var(--info); }
.log-level.warn    { color: var(--warn); }
.log-level.error   { color: var(--danger); }
.log-level.success { color: var(--success); }
.log-cat    { color: var(--text-3); width: 70px; }
.log-msg    { flex: 1; word-break: break-all; color: var(--text-2); }

/* ========== 空状态 ========== */
.empty {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-3);
}
.empty-icon { font-size: 44px; margin-bottom: 12px; opacity: 0.35; }

/* ========== 进度条 ========== */
.progress {
    background: var(--bg);
    border-radius: 999px;
    height: 6px;
    overflow: hidden;
}
.progress-bar {
    background: var(--primary);
    height: 100%;
    transition: width 0.3s;
    border-radius: 999px;
}

/* ========== 登录二维码弹窗 ========== */
.qr-login-box {
    text-align: center;
    padding: 10px;
}
.qr-login-img {
    width: 220px; height: 220px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    margin: 0 auto 14px;
    object-fit: contain;
    padding: 10px;
}
.qr-login-tip {
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.7;
}
.qr-login-status {
    margin-top: 10px;
    padding: 10px;
    border-radius: 8px;
    font-size: 12.5px;
    background: var(--primary-bg);
    color: var(--primary-dark);
}
.qr-login-status.error {
    background: var(--danger-light);
    color: var(--danger);
}
.qr-login-status.success {
    background: var(--success-light);
    color: var(--primary-dark);
}

/* ========== 响应式 ========== */
@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .two-col-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .sidebar { width: 64px; }
    .logo-text, .nav-item span:not(.nav-ico),
    .sidebar-footer { display: none; }
    .logo { justify-content: center; padding: 16px 8px; }
    .nav-item { justify-content: center; padding: 12px 8px; }
    .main { margin-left: 64px; max-width: calc(100vw - 64px); }
    .form-row { grid-template-columns: 1fr; }
    .content { padding: 14px; }
    .topbar { padding: 14px; }
    .stats-grid { grid-template-columns: 1fr; }
}

/* ========== 登录/注册遮罩 ========== */
.auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #22c55e 100%);
    background-attachment: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow-y: auto;
}
.auth-card {
    width: 420px;
    max-width: 92vw;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    animation: authSlideIn 0.3s ease;
}
@keyframes authSlideIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
.auth-brand {
    padding: 28px 32px 22px;
    text-align: center;
    background: linear-gradient(135deg, var(--primary-bg) 0%, var(--info-light) 100%);
    border-bottom: 1px solid var(--border-light);
}
.auth-brand-icon {
    width: 56px; height: 56px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 14px;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.35);
    color: #fff;
    margin-bottom: 12px;
}
.auth-brand-title {
    font-size: 20px; font-weight: 700;
    color: var(--text);
}
.auth-brand-sub {
    font-size: 12px;
    color: var(--text-3);
    margin-top: 4px;
}
.auth-form {
    padding: 26px 32px 30px;
}
.auth-form-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}
.auth-form-sub {
    font-size: 12.5px;
    color: var(--text-3);
    margin-bottom: 20px;
}
.auth-submit {
    width: 100%;
    padding: 10px 16px;
    margin-top: 6px;
    font-size: 14px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 9px;
    justify-content: center;
}
.auth-submit:hover { filter: brightness(1.05); }
.auth-error {
    display: none;
    margin-top: 10px;
    padding: 8px 12px;
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid var(--danger);
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
    animation: shake 0.3s ease;
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}
.auth-switch {
    text-align: center;
    font-size: 12.5px;
    color: var(--text-3);
    margin-top: 16px;
}
.auth-switch a {
    color: var(--primary-dark);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.auth-switch a:hover { text-decoration: underline; }
.auth-hint {
    margin-top: 14px;
    font-size: 11.5px;
    color: var(--text-3);
    text-align: center;
    padding: 8px 10px;
    background: var(--bg);
    border-radius: 6px;
}

/* ========== 顶栏用户信息 ========== */
.user-chip {
    padding: 4px 4px 4px 6px;
    background: var(--bg);
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: default;
}
.user-chip:hover { background: var(--border-light); }
.user-chip .user-avatar {
    width: 30px; height: 30px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    font-size: 15px;
}
.user-chip .user-info {
    line-height: 1.2;
    padding: 0 4px;
    max-width: 200px;
}
.user-chip .user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}
.user-chip .user-meta {
    font-size: 11px;
    color: var(--text-3);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-logout {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-2);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.user-logout:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

/* ========== Admin 后台 Tabs ========== */
.admin-tabs {
    display: inline-flex;
    background: var(--bg);
    padding: 3px;
    border-radius: 8px;
    gap: 2px;
    margin-bottom: 16px;
}
.admin-tab {
    padding: 7px 18px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    border-radius: 6px;
    cursor: pointer;
    border: none;
    background: transparent;
    transition: all 0.15s;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 1px 3px rgba(34, 197, 94, 0.3);
}

/* admin 水平表单（生成卡密/创建等级） */
.admin-inline-form {
    display: grid;
    grid-template-columns: repeat(4, 1fr) auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 16px;
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}
.admin-inline-form .form-group { margin-bottom: 0; }
.admin-inline-form label { font-size: 11.5px; }
@media (max-width: 900px) {
    .admin-inline-form { grid-template-columns: 1fr 1fr; }
    .admin-inline-form > button { grid-column: 1 / -1; }
}

/* 通用粘贴卡片（用于生成结果展示等） */
.card-pre {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 12px;
    white-space: pre;
    overflow-x: auto;
    max-height: 240px;
    overflow-y: auto;
}

/* ========== 富文本编辑器 ========== */
.rich-editor {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #fff;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    padding: 8px 10px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.editor-toolbar-group {
    display: flex;
    align-items: center;
    gap: 2px;
}

.editor-toolbar-sep {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 6px;
}

.editor-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border: none;
    background: transparent;
    color: var(--text-2);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.12s;
}

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

.editor-btn.active {
    background: var(--primary);
    color: #fff;
}

.editor-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.editor-color-wrapper {
    position: relative;
    display: inline-flex;
}

.editor-color-input {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    opacity: 0;
    cursor: pointer;
}

.editor-content {
    padding: 16px;
    outline: none;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
    min-height: 200px;
    max-height: 500px;
    overflow-y: auto;
}

.editor-content:empty:before {
    content: attr(data-placeholder);
    color: var(--text-3);
    pointer-events: none;
}

.editor-content h1 { font-size: 22px; font-weight: 700; margin: 12px 0 8px; }
.editor-content h2 { font-size: 18px; font-weight: 700; margin: 10px 0 6px; }
.editor-content h3 { font-size: 15px; font-weight: 600; margin: 8px 0 6px; }
.editor-content p { margin: 4px 0; }
.editor-content ul, .editor-content ol { padding-left: 24px; margin: 4px 0; }
.editor-content li { margin: 2px 0; }
.editor-content a { color: var(--info); text-decoration: underline; }
.editor-content hr { border: none; border-top: 2px solid var(--border); margin: 12px 0; }
.editor-content img { max-width: 100%; height: auto; border-radius: 6px; margin: 6px 0; }
.editor-content blockquote {
    border-left: 3px solid var(--primary);
    padding-left: 12px;
    color: var(--text-2);
    margin: 8px 0;
}

/* ========== 通知中心 ========== */
.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.notif-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.notif-unread-badge {
    display: inline-block;
    padding: 3px 10px;
    background: var(--danger-light);
    color: var(--danger);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

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

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 16px 18px;
    transition: all 0.15s;
    width: 100%;
    box-sizing: border-box;
}

.notif-item:hover {
    border-color: var(--border);
    box-shadow: var(--shadow);
}

.notif-item.unread {
    border-left: 3px solid var(--primary);
    background: var(--primary-bg);
}

.notif-item-dot {
    flex-shrink: 0;
    width: 10px;
    padding-top: 4px;
}

.dot-unread {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.notif-item-body {
    flex: 1;
    min-width: 0;
}

.notif-item-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.notif-item-title {
    font-size: 14.5px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notif-item-preview {
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.5;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notif-item-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-3);
}

.notif-item-time {
    color: var(--text-3);
}

.notif-item-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding-left: 10px;
    border-left: 1px solid var(--border-light);
}

/* 通知详情 */
.notif-detail-meta {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}

.notif-detail-content {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text);
    word-break: break-word;
}

.notif-detail-content h1,
.notif-detail-content h2,
.notif-detail-content h3 {
    margin: 12px 0 8px;
}

.notif-detail-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 8px 0;
}

.notif-detail-content a {
    color: var(--info);
    text-decoration: underline;
}

.notif-detail-content ul,
.notif-detail-content ol {
    padding-left: 24px;
    margin: 8px 0;
}

.notif-detail-content hr {
    border: none;
    border-top: 2px solid var(--border);
    margin: 12px 0;
}

.notif-detail-content blockquote {
    border-left: 3px solid var(--primary);
    padding-left: 12px;
    color: var(--text-2);
    margin: 8px 0;
}

/* 通知徽章（导航栏） */
#notifBadge {
    display: none;
    margin-left: auto;
}

/* ========== 资源导航 ========== */
.nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
}
.nav-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.15s, box-shadow 0.15s;
}
.nav-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}
.nav-cover {
    position: relative;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #e5e7eb, #f3f4f6);
    overflow: hidden;
}
.nav-cover.is-ready { cursor: pointer; }
.nav-cover-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nav-cover-ph {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 30px; color: var(--text-3);
}
.nav-play-btn {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 34px; color: #fff; background: rgba(0, 0, 0, 0.18);
    opacity: 0; transition: opacity 0.15s;
}
.nav-cover.is-ready:hover .nav-play-btn { opacity: 1; }
.nav-badge {
    position: absolute; left: 8px; top: 8px;
    padding: 2px 8px; border-radius: 999px;
    font-size: 11px; color: #fff; background: rgba(0, 0, 0, 0.6);
}
.nav-badge-ready    { background: rgba(34, 197, 94, 0.92); }
.nav-badge-failed   { background: rgba(239, 68, 68, 0.92); }
.nav-badge-building { background: rgba(59, 130, 246, 0.92); }
.nav-dur {
    position: absolute; right: 8px; bottom: 8px;
    padding: 1px 6px; border-radius: 4px;
    background: rgba(0, 0, 0, 0.65); color: #fff; font-size: 11px;
}
.nav-body {
    padding: 12px 14px 14px;
    display: flex; flex-direction: column; gap: 8px; flex: 1;
}
.nav-title {
    font-size: 14px; font-weight: 600; line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; min-height: 39px;
}
.nav-meta {
    display: flex; justify-content: space-between; gap: 8px;
    font-size: 12px; color: var(--text-3);
}
.nav-err {
    font-size: 12px; color: var(--danger);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-actions { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.nav-actions .btn { text-decoration: none; }
.nav-pager {
    display: flex; align-items: center; justify-content: flex-end;
    gap: 10px; margin-top: 16px; flex-wrap: wrap;
}
.nav-runner {
    margin-top: 12px; font-size: 13px; color: var(--text-2);
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}
.nav-run-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-3); display: inline-block;
}
.nav-run-dot.on { background: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.nav-log {
    flex-basis: 100%;
    background: var(--bg); border-radius: 8px; padding: 8px 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11.5px; color: var(--text-2);
    max-height: 120px; overflow: auto;
}
.nav-log-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-video-mask {
    position: fixed; inset: 0; z-index: 1200;
    background: rgba(17, 24, 39, 0.78);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.nav-video-box {
    width: min(1080px, 96vw);
    background: #000; border-radius: 12px; overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.nav-video-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 10px 14px;
    background: #111827; color: #e5e7eb; font-size: 13px;
}
.nav-video-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-video-close {
    background: none; border: none; color: #e5e7eb;
    font-size: 22px; line-height: 1; cursor: pointer;
}
.nav-video-box video { display: block; width: 100%; max-height: 70vh; background: #000; }

@media (max-width: 768px) {
    .nav-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
    .nav-body { padding: 10px; }
    .nav-title { font-size: 13px; min-height: 36px; }
    .nav-pager { justify-content: center; }
    .nav-video-mask { padding: 0; align-items: stretch; }
    .nav-video-box {
        width: 100vw; max-width: 100vw; border-radius: 0;
        display: flex; flex-direction: column;
    }
    .nav-video-box video { max-height: none; flex: 1; object-fit: contain; }
}
