/* ============================================================
 * 后台管理系统（纯 PHP 版）样式表
 * 视觉风格对齐原 Vue + Element Plus（浅色主题）
 * 侧边栏主色 #304156，主色 #409eff
 * ============================================================ */

/* ---------- 基础变量 ---------- */
:root {
    --c-primary: #409eff;
    --c-primary-dark: #337ecc;
    --c-success: #67c23a;
    --c-warning: #e6a23c;
    --c-danger: #f56c6c;
    --c-info: #909399;
    --c-text: #303133;
    --c-text-2: #606266;
    --c-text-3: #909399;
    --c-border: #dcdfe6;
    --c-border-light: #ebeef5;
    --c-bg: #f5f7fa;
    --c-white: #ffffff;
    --sidebar-bg: #304156;
    --sidebar-active: #263445;
    --radius: 6px;
    --shadow-card: 0 1px 4px rgba(0, 0, 0, .08);
    --shadow-pop: 0 2px 12px rgba(0, 0, 0, .15);
}

/* ---------- 暗色主题 ---------- */
[data-theme="dark"] {
    --c-text: #e6e8eb;
    --c-text-2: #b9bec7;
    --c-text-3: #828a96;
    --c-border: #3a404d;
    --c-border-light: #2b313c;
    --c-bg: #15181e;
    --c-white: #21252e;
    --sidebar-bg: #181b22;
    --sidebar-active: #262b36;
    --shadow-card: 0 1px 4px rgba(0, 0, 0, .45);
    --shadow-pop: 0 2px 12px rgba(0, 0, 0, .55);
}
[data-theme="dark"] .data-table thead th,
[data-theme="dark"] .data-table thead .col-fixed { background: #20242d; }
[data-theme="dark"] .data-table tbody tr:hover { background: #262b36; }
[data-theme="dark"] .date-selector { background: #2b313c; }
[data-theme="dark"] .dropdown-menu a:hover { background: #262b36; }
[data-theme="dark"] .flash-success { background: #1c2a17; color: #95d475; border-color: #2f4a23; }
[data-theme="dark"] .flash-error   { background: #2a1c1c; color: #f29a9a; border-color: #4a2a2a; }
[data-theme="dark"] .flash-warning { background: #2a2417; color: #e8c07a; border-color: #4a3f23; }
[data-theme="dark"] .flash-info    { background: #172033; color: #8fc0f0; border-color: #233a5a; }

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
    font-size: 14px;
    color: var(--c-text);
    background: var(--c-bg);
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { opacity: .85; }

/* ---------- 整体布局 ---------- */
.app-container { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar {
    width: 220px;
    flex: 0 0 220px;
    background: var(--sidebar-bg);
    color: #cdd4de;
    display: flex;
    flex-direction: column;
    transition: width .2s;
}
/* 桌面端：折叠为 64px 图标态，hover 展开 */
.sidebar.collapsed { width: 64px; flex-basis: 64px; overflow: visible; }
.sidebar.collapsed .logo { justify-content: center; padding: 0; }
.sidebar.collapsed .logo-full { display: none; }
.sidebar.collapsed .logo-mini { display: block; }
.sidebar.collapsed .menu-text { display: none; }
.sidebar.collapsed .menu { padding: 10px; }
.sidebar.collapsed .menu-item { justify-content: center; padding: 0; margin: 6px 10px; }
.sidebar.collapsed .menu-text { display: none; }
.sidebar.collapsed:hover {
    width: 220px; flex-basis: 220px;
    box-shadow: var(--shadow-pop); z-index: 80;
}
.sidebar.collapsed:hover .logo { justify-content: flex-start; padding: 0 20px; }
.sidebar.collapsed:hover .logo-full { display: block; }
.sidebar.collapsed:hover .logo-mini { display: none; }
.sidebar.collapsed:hover .menu-text { display: inline; }
.sidebar.collapsed:hover .menu-item { justify-content: flex-start; padding: 0 14px; margin: 6px 0; }

.logo {
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    color: #fff;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: .5px;
    background: var(--sidebar-active);
}
.logo-mini { display: none; }

.menu { padding: 10px; }
.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 46px;
    padding: 0 14px;
    margin: 6px 0;
    border-radius: 10px;
    color: #cdd4de;
    font-size: 14px;
    transition: background .2s, color .2s, transform .2s, box-shadow .2s;
}
.menu-item:hover {
    background: var(--sidebar-active);
    color: #fff;
    transform: translateX(2px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
}
.menu-item.active {
    background: linear-gradient(135deg, #409eff, #337ecc);
    color: #fff;
    box-shadow: 0 4px 14px rgba(64, 158, 255, .28);
}
.menu-icon-wrap {
    width: 32px; height: 32px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, .08);
    flex: 0 0 32px;
    transition: background .2s;
}
.menu-icon { font-size: 16px; line-height: 1; }
.menu-item.active .menu-icon-wrap { background: rgba(255, 255, 255, .18); }
.menu-item:hover .menu-icon-wrap { background: rgba(255, 255, 255, .12); }

/* 主区域 */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
    height: 56px;
    background: var(--c-white);
    border-bottom: 1px solid var(--c-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: var(--shadow-card);
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.toggle-btn {
    border: none;
    background: transparent;
    font-size: 20px;
    cursor: pointer;
    color: var(--c-text-2);
}
.page-title { font-size: 16px; font-weight: 600; color: var(--c-text); }

.topbar-right { position: relative; display: flex; align-items: center; gap: 10px; }
.user-dropdown { position: relative; cursor: pointer; padding: 6px 8px; border-radius: var(--radius); transition: background .15s; }
.user-dropdown:hover { background: var(--c-bg); }
.user-info { font-size: 14px; color: var(--c-text-2); display: flex; align-items: center; gap: 8px; }
.user-avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.user-avatar-default { font-size: 18px; line-height: 1; }
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-meta b { font-weight: 600; color: var(--c-text); font-size: 13px; }
.user-role { font-style: normal; font-size: 11px; color: var(--c-text-3); }
.user-caret { font-size: 10px; color: var(--c-text-3); }
.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: var(--c-white);
    border: 1px solid var(--c-border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-pop);
    min-width: 120px;
    display: none;
    z-index: 50;
}
.user-dropdown:hover .dropdown-menu { display: block; }
.dropdown-menu a {
    display: block;
    padding: 10px 16px;
    color: var(--c-text-2);
    font-size: 13px;
}
.dropdown-menu a:hover { background: var(--c-bg); color: var(--c-primary); }

.content { flex: 1; padding: 20px; overflow-x: hidden; }

/* ---------- 顶栏图标按钮（主题切换等） ---------- */
.icon-btn {
    width: 32px; height: 32px; border-radius: 50%;
    border: none; background: transparent;
    color: var(--c-text-3); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: color .15s, background .15s, transform .15s;
}
.icon-btn:hover { color: var(--c-primary); background: var(--c-bg); transform: scale(1.05); }
.icon-btn svg { width: 18px; height: 18px; }
[data-theme="dark"] .icon-btn { color: var(--c-text-2); }
[data-theme="dark"] .icon-btn:hover { background: #262b36; color: var(--c-primary); }

/* ---------- Toast 消息（右上角堆叠，自动消失） ---------- */
.toast-container {
    position: fixed; top: 16px; right: 16px; z-index: 9999;
    display: flex; flex-direction: column; gap: 10px;
    width: min(360px, calc(100vw - 32px));
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 14px; border-radius: var(--radius);
    background: var(--c-white); border: 1px solid var(--c-border-light);
    box-shadow: var(--shadow-pop);
    font-size: 13px; color: var(--c-text); line-height: 1.5;
    opacity: 0; transform: translateX(24px);
    transition: opacity .3s ease, transform .3s ease;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast.hide { opacity: 0; transform: translateX(24px); }
.toast-success { border-left: 3px solid var(--c-success); }
.toast-error   { border-left: 3px solid var(--c-danger); }
.toast-warning { border-left: 3px solid var(--c-warning); }
.toast-info    { border-left: 3px solid var(--c-primary); }
.toast-msg { flex: 1; word-break: break-word; }
.toast-close {
    border: none; background: transparent; cursor: pointer;
    color: var(--c-text-3); font-size: 16px; line-height: 1;
    padding: 0 2px; flex: 0 0 auto;
}
.toast-close:hover { color: var(--c-text); }

/* ---------- Flash 消息 ---------- */
.flash-wrap { margin-bottom: 16px; }
.flash {
    padding: 10px 16px;
    border-radius: var(--radius);
    margin-bottom: 10px;
    font-size: 13px;
    border: 1px solid transparent;
}
.flash-success { background: #f0f9eb; color: #529b2e; border-color: #e1f3d8; }
.flash-error   { background: #fef0f0; color: #cf4444; border-color: #fde2e2; }
.flash-warning { background: #fdf6ec; color: #b88230; border-color: #faecd8; }
.flash-info    { background: #edf5ff; color: #337ecc; border-color: #d9ecff; }

/* ---------- 卡片 ---------- */
.card {
    background: var(--c-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 20px;
    margin-bottom: 20px;
}
.card-title { margin: 0 0 18px; font-size: 16px; font-weight: 600; }
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}
.card-head .card-title { margin: 0; }
.perm-denied {
    text-align: center;
    padding: 48px 20px;
    color: var(--c-text-3);
}
.perm-denied .perm-icon { font-size: 44px; margin-bottom: 12px; }
.perm-denied h3 { margin: 0 0 10px; color: var(--c-text); }
.perm-denied p { margin: 0; line-height: 1.8; font-size: 14px; }


/* ---------- 表单 ---------- */
.form { max-width: 720px; }
.form-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 18px;
}
.form-label {
    width: 130px;
    flex: 0 0 130px;
    text-align: right;
    padding-right: 16px;
    padding-top: 8px;
    font-size: 14px;
    color: var(--c-text-2);
}
.form-inline { display: flex; align-items: center; gap: 10px; flex: 1; flex-wrap: wrap; }

.input {
    width: 100%;
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-white);
    color: var(--c-text);
    font-size: 14px;
    outline: none;
    transition: border-color .15s;
}
.input:focus { border-color: var(--c-primary); }
textarea.input { height: auto; padding: 8px 12px; line-height: 1.5; resize: vertical; }
.input-lg { height: 42px; font-size: 15px; }
.input::placeholder { color: var(--c-text-3); }

.hint { color: var(--c-text-3); font-size: 12px; margin-top: 6px; line-height: 1.4; }
.muted { color: var(--c-text-3); }
.small { font-size: 12px; }

/* 开关 */
.switch { position: relative; display: inline-block; width: 40px; height: 20px; }
.switch input { display: none; }
.switch-slider {
    position: absolute; inset: 0;
    background: #c0c4cc; border-radius: 20px; cursor: pointer;
    transition: background .2s;
}
.switch-slider::after {
    content: ""; position: absolute; top: 2px; left: 2px;
    width: 16px; height: 16px; background: #fff; border-radius: 50%;
    transition: transform .2s;
}
.switch input:checked + .switch-slider { background: var(--c-primary); }
.switch input:checked + .switch-slider::after { transform: translateX(20px); }

/* 单选 */
.radio { display: inline-flex; align-items: center; gap: 4px; margin-right: 14px; font-size: 14px; color: var(--c-text-2); cursor: pointer; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 34px;
    padding: 0 16px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-white);
    color: var(--c-text-2);
    font-size: 14px;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}
.btn:hover { color: var(--c-primary); border-color: #c6e2ff; background: #ecf5ff; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-dark); border-color: var(--c-primary-dark); color: #fff; }
.btn-success { background: var(--c-success); border-color: var(--c-success); color: #fff; }
.btn-success:hover { opacity: .9; color: #fff; }
.btn-danger { background: var(--c-danger); border-color: var(--c-danger); color: #fff; }
.btn-danger:hover { opacity: .9; color: #fff; }
.btn-warning { background: #e6a23c; border-color: #e6a23c; color: #fff; }
.btn-warning:hover { opacity: .9; color: #fff; }
.form-hint { font-size: 12px; color: var(--c-text-3); line-height: 1.45; }
.form-row-col { align-items: flex-start; }
.form-input-wrap { display: flex; flex-direction: column; gap: 5px; }
.btn-lg { height: 42px; padding: 0 24px; font-size: 15px; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.disabled, .btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-link {
    border: none; background: transparent; color: var(--c-primary);
    cursor: pointer; font-size: 13px; padding: 0 4px;
}
.btn-link:hover { text-decoration: underline; }
.btn-link-danger { color: var(--c-danger); }

/* 提交中 loading 态 + 防重复点击 */
.btn-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn-loading * { visibility: hidden; }
.btn-loading::after {
    content: ""; position: absolute; left: 50%; top: 50%;
    width: 14px; height: 14px; margin: -7px 0 0 -7px;
    border: 2px solid rgba(255, 255, 255, .55); border-top-color: #fff;
    border-radius: 50%; animation: btn-spin .6s linear infinite; z-index: 2;
}
.btn:not(.btn-primary).btn-loading::after { border-color: rgba(0, 0, 0, .25); border-top-color: var(--c-primary); }
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ---------- 标签 ---------- */
.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 18px;
    border: 1px solid transparent;
}
.tag-primary { background: #ecf5ff; color: #337ecc; border-color: #d9ecff; }
.tag-success { background: #f0f9eb; color: #529b2e; border-color: #e1f3d8; }
.tag-warning { background: #fdf6ec; color: #b88230; border-color: #faecd8; }
.tag-danger  { background: #fef0f0; color: #cf4444; border-color: #fde2e2; }
.tag-info    { background: #f4f4f5; color: #909399; border-color: #e9e9eb; }

/* ---------- 表格 ---------- */
.table-container { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    color: var(--c-text);
    background: var(--c-white);
}
.data-table th, .data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--c-border-light);
    text-align: left;
    white-space: nowrap;
}
.data-table thead th {
    background: #fafafa;
    color: var(--c-text-2);
    font-weight: 600;
    border-top: 1px solid var(--c-border-light);
}
.data-table tbody tr:hover { background: #f5f7fa; }
.data-table .col-fixed { position: sticky; right: 0; background: var(--c-white); }
.data-table thead .col-fixed { background: #fafafa; }
.th-sort { color: var(--c-text-2); cursor: pointer; }
.th-sort:hover { color: var(--c-primary); }
.empty-row { text-align: center; color: var(--c-text-3); padding: 30px 0 !important; }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; vertical-align: middle; }
.avatar-preview { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; display: block; margin-bottom: 8px; }
.active-dot { font-size: 10px; margin-left: 2px; }
.openid-text {
    display: inline-block; max-width: 220px; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom;
}
.points-cell { display: flex; align-items: center; gap: 6px; }
.inline-form { display: inline; }
.code-cell { display: flex; align-items: center; gap: 8px; }
.code-text { font-family: Consolas, Menlo, monospace; }

/* 卡片化表格（与首页统计卡片风格一致） */
.table-card {
    background: var(--c-white);
    border-radius: 10px;
    padding: 0;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--c-border-light);
    overflow: hidden;
}
.data-table-card { background: transparent; }
.data-table-card thead th {
    background: linear-gradient(135deg, #5b8def, #3a6fd8);
    color: #fff;
    border-top: none;
    border-bottom: none;
    padding: 14px 12px;
    font-weight: 600;
}
.data-table-card thead th:first-child { border-top-left-radius: 10px; }
.data-table-card thead th:last-child { border-top-right-radius: 10px; }
.data-table-card tbody td { padding: 13px 12px; border-bottom: 1px solid var(--c-border-light); }
.data-table-card tbody tr:last-child td { border-bottom: none; }
.data-table-card tbody tr:hover { background: #f5f7fa; }
.data-table-card .empty-row { padding: 44px 0 !important; color: var(--c-text-3); }
.data-table-card .tag { font-weight: 500; }
[data-theme="dark"] .table-card { background: var(--c-white); border-color: var(--c-border); }
[data-theme="dark"] .data-table-card thead th { background: linear-gradient(135deg, #2f6fd8, #1e5bbd); }
[data-theme="dark"] .data-table-card tbody tr:hover { background: #262b36; }
[data-theme="dark"] .data-table th,
[data-theme="dark"] .data-table td { border-color: var(--c-border-light); }

/* ---------- 搜索条 / 工具条 ---------- */
.search-bar, .toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
    margin-bottom: 16px;
}
.search-input { width: 240px; }
.filter-select { width: 160px; }

/* ---------- 分页 ---------- */
.pagination {
    display: flex; align-items: center; flex-wrap: wrap; gap: 14px;
    margin-top: 16px; font-size: 13px; color: var(--c-text-2);
}
.pg-total { color: var(--c-text-3); }
.pg-sizes .pg-select { width: 70px; height: 30px; }
.pg-nav { display: flex; align-items: center; gap: 10px; }
.pg-current { color: var(--c-text-3); }

/* ============================================================
 * 首页仪表盘
 * ============================================================ */
.home .section { margin-bottom: 28px; }
.section-title { font-size: 15px; font-weight: 600; margin: 0 0 14px; color: var(--c-text); }

/* 首页快捷操作卡片 —— 与用户统计卡片风格一致 */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.quick-action {
    display: flex; align-items: center;
    gap: 14px; padding: 18px 18px; border-radius: 10px;
    background: var(--c-white); box-shadow: var(--shadow-card);
    color: var(--c-text); transition: transform .15s, box-shadow .15s;
    border: 1px solid var(--c-border-light);
}
.quick-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(64, 158, 255, .18);
    border-color: #c6e2ff;
}
.qa-ic-wrap {
    width: 44px; height: 44px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex: 0 0 44px; font-size: 22px;
}
.qa-ic-wrap.users  { background: #ecf5ff; }
.qa-ic-wrap.codes  { background: #f0f9eb; }
.qa-ic-wrap.config { background: #fdf6ec; }
.qa-ic-wrap.pwd    { background: #f4f4f5; }
.qa-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.qa-text { font-size: 15px; font-weight: 600; color: var(--c-text); }
.qa-desc { font-size: 12px; color: var(--c-text-3); }
[data-theme="dark"] .quick-action { border-color: var(--c-border); }
[data-theme="dark"] .qa-ic-wrap.users  { background: #1b2638; }
[data-theme="dark"] .qa-ic-wrap.codes  { background: #1c2a17; }
[data-theme="dark"] .qa-ic-wrap.config { background: #2a2417; }
[data-theme="dark"] .qa-ic-wrap.pwd    { background: #262b36; }

.stats-header { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.date-selector { display: inline-flex; background: #eef0f3; border-radius: 20px; padding: 3px; }
.radio-pill {
    padding: 6px 18px; border-radius: 18px; color: var(--c-text-2);
    font-size: 13px; cursor: pointer; transition: all .15s;
}
.radio-pill.active { background: var(--c-primary); color: #fff; }
.date-picker { display: flex; align-items: center; gap: 8px; }
.date-input { width: 150px; }
.date-separator { color: var(--c-text-3); }

.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.stat-card {
    border-radius: 10px;
    padding: 22px 20px;
    color: #fff;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}
.stat-value { font-size: 30px; font-weight: 700; line-height: 1.1; }
.stat-label-wrap { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 14px; opacity: .95; }
.stat-ic { font-size: 16px; }
.stat-hint { margin-top: 8px; font-size: 12px; opacity: .85; }

/* 渐变配色（对应 Home.vue） */
.grad-total-users   { background: linear-gradient(135deg, #5b8def, #3a6fd8); }
.grad-normal-users  { background: linear-gradient(135deg, #67c23a, #4e9e2b); }
.grad-permanent-vip { background: linear-gradient(135deg, #f6c343, #e0a82e); }
.grad-normal-vip    { background: linear-gradient(135deg, #9b6bff, #7a4de0); }
.grad-total-parse   { background: linear-gradient(135deg, #36c5d8, #1fa6bb); }
.grad-total-ad      { background: linear-gradient(135deg, #ff7a90, #f0566f); }
.grad-total-invite  { background: linear-gradient(135deg, #4dd0a7, #2bb389); }
.grad-active-users  { background: linear-gradient(135deg, #5b8def, #3a6fd8); }
.grad-new-users     { background: linear-gradient(135deg, #67c23a, #4e9e2b); }
.grad-parse-count   { background: linear-gradient(135deg, #36c5d8, #1fa6bb); }
.grad-ad-view-count { background: linear-gradient(135deg, #ff7a90, #f0566f); }
.grad-invite-count  { background: linear-gradient(135deg, #4dd0a7, #2bb389); }
.grad-parse-rate    { background: linear-gradient(135deg, #67c23a, #4e9e2b); }
.grad-platform      { background: linear-gradient(135deg, #5b8def, #3a6fd8); }

/* 解析成功率卡片 —— 按百分比区间动态变色 */
.grad-rate-excellent { background: linear-gradient(135deg, #67c23a, #4e9e2b); }
.grad-rate-good      { background: linear-gradient(135deg, #5b8def, #3a6fd8); }
.grad-rate-warning   { background: linear-gradient(135deg, #f6c343, #e0a82e); }
.grad-rate-danger    { background: linear-gradient(135deg, #ff7a90, #f0566f); }
.grad-rate-empty     { background: linear-gradient(135deg, #a0a6b1, #7a8190); }

/* 解析运营概览 —— 平台分布迷你条形 */
.rate-sub {
    display: flex; align-items: center; gap: 14px;
    margin-top: 12px; font-size: 12px; opacity: .92;
}
.rate-sub span {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px; background: rgba(255,255,255,.18); border-radius: 20px;
}
.platform-empty { padding: 24px 0; text-align: center; font-size: 13px; opacity: .85; }
.platform-row {
    display: grid; grid-template-columns: 80px 1fr 40px; align-items: center; gap: 10px;
    padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.15);
}
.platform-row:last-child { border-bottom: none; }
.platform-name { font-size: 13px; opacity: .95; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.platform-count { font-size: 14px; font-weight: 700; text-align: right; }
.mini-bar-track { height: 8px; background: rgba(255,255,255,.2); border-radius: 4px; overflow: hidden; }
.mini-bar-fill { height: 100%; background: rgba(255,255,255,.9); border-radius: 4px; transition: width .4s ease; }
[data-theme="dark"] .mini-bar-fill { background: rgba(255,255,255,.95); }

/* ============================================================
 * 兑换码
 * ============================================================ */
.duration-opts { display: flex; flex-direction: column; gap: 6px; }
.codes-list { display: flex; flex-direction: column; gap: 8px; }
.code-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; background: var(--c-bg); border-radius: var(--radius);
}

/* ============================================================
 * 小程序配置 —— 图片上传 / 推荐小程序
 * ============================================================ */
.settings-container { max-width: 1000px; }
.image-uploader { display: flex; align-items: flex-start; gap: 16px; }
.image-preview-wrapper {
    width: 160px; height: 130px; border: 1px dashed var(--c-border);
    border-radius: var(--radius); overflow: hidden; background: var(--c-bg);
    display: flex; align-items: center; justify-content: center;
}
.image-preview { max-width: 100%; max-height: 100%; }
.uploader-btns { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

/* 个人资料 —— 头像上传 */
.avatar-uploader { display: flex; align-items: flex-start; gap: 16px; }
.profile-page .avatar-preview-wrapper,
.avatar-preview-wrapper {
    width: 96px; height: 96px; max-width: 96px; max-height: 96px;
    border: 1px dashed var(--c-border);
    border-radius: 50%; overflow: hidden; background: var(--c-bg);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.profile-page .avatar-preview-img,
.avatar-preview-img {
    width: 100%; height: 100%; max-width: 100%; max-height: 100%;
    object-fit: cover; display: block;
}

.recommend-table th, .recommend-table td { white-space: normal; vertical-align: top; }
.recommend-table .input { width: 100%; }
.rec-icon { position: relative; width: 60px; }
.rec-icon-img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; display: block; }
.rec-icon-btn { position: absolute; top: 0; left: 0; }
.sort-buttons { display: flex; flex-direction: column; gap: 4px; }

/* ============================================================
 * 弹窗
 * ============================================================ */
.modal {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 100;
    align-items: center;
    justify-content: center;
}
.modal.show { display: flex; }
.modal-box {
    background: var(--c-white);
    border-radius: 8px;
    box-shadow: var(--shadow-pop);
    width: 480px;
    max-width: 92vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; font-size: 16px; font-weight: 600;
    border-bottom: 1px solid var(--c-border-light);
}
.modal-close { cursor: pointer; font-size: 20px; color: var(--c-text-3); line-height: 1; }
.modal-close:hover { color: var(--c-text); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-footer {
    display: flex; align-items: center; justify-content: flex-end; gap: 10px;
    padding: 14px 20px; border-top: 1px solid var(--c-border-light);
}

/* ---------- 积分记录片段 ---------- */
.points-log-table-container { max-height: 360px; overflow-y: auto; }

/* ============================================================
 * 登录页
 * ============================================================ */
.login-container {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-box {
    width: 380px;
    background: var(--c-white);
    border-radius: 12px;
    padding: 36px 32px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .2);
}
.login-header { text-align: center; margin-bottom: 26px; }
.login-header h2 { margin: 0 0 8px; font-size: 22px; color: var(--c-text); }
.login-header p { margin: 0; color: var(--c-text-3); font-size: 13px; }
.login-form .form-item { margin-bottom: 16px; }
.login-button { width: 100%; margin-top: 6px; }
.login-extra { text-align: right; margin-top: 10px; }
.login-link { color: var(--c-primary); font-size: 13px; text-decoration: none; }
.login-link:hover { text-decoration: underline; }

/* ============================================================
 * 看板图表（纯 SVG，适配暗色）
 * ============================================================ */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}
.chart-card {
    background: var(--c-white);
    border-radius: 10px;
    padding: 22px 20px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--c-border-light);
}
.chart-title { font-size: 15px; font-weight: 600; margin: 0 0 18px; color: var(--c-text); }
.chart-body { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut-wrap { width: 140px; height: 140px; flex: 0 0 140px; }
.donut-arc-success { stroke: var(--c-success); }
.donut-arc-fail { stroke: var(--c-danger); }
.donut-rate { fill: var(--c-text); font-size: 22px; font-weight: 700; }
.donut-sub { fill: var(--c-text-3); font-size: 12px; }
[data-theme="dark"] .chart-card { background: var(--c-white); border-color: var(--c-border); }
.chart-legend { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--c-text-2); }
.lg-item { display: flex; align-items: center; gap: 8px; }
.lg-item b { color: var(--c-text); }
.lg-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 10px; }
.lg-success { background: var(--c-success); }
.lg-fail { background: var(--c-danger); }
.lg-total { background: var(--c-info); }

.bars-wrap { width: 100%; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 96px 1fr 48px; align-items: center; gap: 10px; }
.bar-label {
    font-size: 13px; color: var(--c-text-2);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bar-track { background: var(--c-border-light); border-radius: 6px; height: 14px; overflow: hidden; }
.bar-fill {
    height: 100%; border-radius: 6px;
    background: linear-gradient(90deg, #5b8def, #409eff);
    transition: width .4s ease;
}
[data-theme="dark"] .bar-fill { background: linear-gradient(90deg, #2f6fd8, #409eff); }
.bar-val { font-size: 13px; font-weight: 600; color: var(--c-text); text-align: right; }

/* ---------- 批量操作栏 ---------- */
.batch-toolbar {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    margin-bottom: 14px; padding: 10px 14px;
    background: var(--c-bg); border: 1px solid var(--c-border-light);
    border-radius: var(--radius);
}
.batch-checkall { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--c-text-2); cursor: pointer; }
.batch-select { width: 130px; height: 30px; }
.batch-count { font-size: 13px; color: var(--c-text-3); }
.batch-count b { color: var(--c-primary); }
[data-theme="dark"] .batch-toolbar { background: #1b1f27; }

/* ---------- 移动端侧边栏遮罩 ---------- */
.sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 55; opacity: 0; visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}
.sidebar-backdrop.show { opacity: 1; visibility: visible; }

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
    .sidebar {
        position: fixed; top: 0; left: 0; z-index: 60; height: 100%;
        width: 220px; flex-basis: 220px;
        transform: translateX(-100%);
        transition: transform .25s ease;
    }
    .sidebar.collapsed,
    .sidebar.collapsed:hover { width: 220px; flex-basis: 220px; overflow: visible; box-shadow: none; }
    .sidebar.mobile-open { transform: translateX(0); }
    .form-label { width: 90px; flex-basis: 90px; }
    .stat-value { font-size: 24px; }
}

/* ---------- P0：改密页 - 当前会话卡片 ---------- */
.session-card {
    background: var(--c-bg);
    border: 1px solid var(--c-border-light);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 18px;
}
.session-title { font-size: 13px; font-weight: 600; color: var(--c-text-2); margin-bottom: 10px; }
.session-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; padding: 5px 0; }
.session-row > span { color: var(--c-text-3); }
.session-row > b { color: var(--c-text); font-weight: 600; max-width: 62%; text-align: right; word-break: break-all; }
[data-theme="dark"] .session-card { background: #1b1f27; }

/* ---------- P0：改密页 - 密码强度条 ---------- */
.pwd-strength { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.pwd-bar { flex: 1; height: 6px; background: var(--c-border-light); border-radius: 4px; overflow: hidden; }
.pwd-bar > span { display: block; height: 100%; width: 0; transition: width .2s ease, background .2s ease; }
.pwd-hint { font-size: 12px; min-width: 32px; }

/* ---------- P2-10：改密页 - 密码显示/隐藏 ---------- */
.pwd-field { position: relative; display: flex; align-items: center; }
.pwd-field .input { flex: 1; padding-right: 38px; }
.pwd-toggle {
    position: absolute;
    right: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    padding: 4px 6px;
    color: var(--c-text-3);
    border-radius: 4px;
}
.pwd-toggle:hover { background: var(--c-bg); color: var(--c-text); }

