/* ================= 管理后台样式 ================= */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
    background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
    min-height: 100vh;
    color: #eee;
    padding: 20px 16px;
}

/* ===== 登录页 ===== */
.login-box {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-card {
    width: 100%;
    max-width: 360px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 16px;
    padding: 36px 28px;
    text-align: center;
}
.login-card h1 {
    font-size: 24px;
    margin-bottom: 24px;
    background: linear-gradient(90deg, #7ce0ff, #ff9a9e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.login-card input {
    width: 100%;
    border: 1px solid rgba(255,255,255,0.18);
    outline: none;
    background: rgba(255,255,255,0.08);
    color: #fff;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 12px;
}
.login-card input::placeholder { color: #8fa3b0; }
.login-card button {
    width: 100%;
    border: none;
    cursor: pointer;
    background: linear-gradient(90deg, #36d1dc, #5b86e5);
    color: #fff;
    font-size: 15px;
    font-weight: bold;
    padding: 12px;
    border-radius: 10px;
    margin-top: 4px;
}
.login-card .msg { min-height: 20px; font-size: 13px; color: #ff7b7b; margin-bottom: 6px; }
.login-card .back { display: block; margin-top: 16px; color: #7ce0ff; font-size: 13px; text-decoration: none; }

/* ===== 主界面布局：左侧菜单 + 右侧内容 ===== */
.layout {
    display: flex;
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
    align-items: flex-start;
}
.sidebar {
    width: 200px;
    flex-shrink: 0;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: sticky;
    top: 20px;
}
.brand { font-size: 16px; font-weight: bold; line-height: 1.4; }
.content { flex: 1; min-width: 0; }

/* 右侧内容区顶栏 */
.content-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.content-top h2 { font-size: 18px; }

/* 管理员下拉菜单 */
.user-menu { position: relative; }
.user-btn {
    border: 1px solid rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.12);
    color: #eee;
    font-size: 14px;
    padding: 8px 14px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}
.user-btn:hover { background: rgba(255,255,255,0.22); }
.user-btn .caret { font-size: 11px; color: #9fb6c4; }
.dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 140px;
    background: rgba(20, 34, 44, 0.97);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    overflow: hidden;
    z-index: 100;
    box-shadow: 0 6px 20px rgba(0,0,0,0.35);
}
.dropdown a {
    display: block;
    padding: 10px 14px;
    color: #dcebf3;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
}
.dropdown a:hover { background: rgba(255,255,255,0.1); }

/* 修改密码弹窗 */
.pwd-mask {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}
.pwd-box {
    width: 100%;
    max-width: 340px;
    background: rgba(20, 34, 44, 0.98);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 16px;
    padding: 26px 22px;
}
.pwd-box h3 { margin-bottom: 16px; font-size: 17px; }
.pwd-box input {
    width: 100%;
    border: 1px solid rgba(255,255,255,0.18);
    outline: none;
    background: rgba(255,255,255,0.08);
    color: #fff;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 10px;
}
.pwd-box input::placeholder { color: #8fa3b0; }
.pwd-msg { min-height: 18px; font-size: 13px; color: #ff7b7b; margin-bottom: 6px; }
.pwd-actions { display: flex; gap: 8px; }
.pwd-actions button {
    flex: 1;
    border: none;
    cursor: pointer;
    background: linear-gradient(90deg, #36d1dc, #5b86e5);
    color: #fff;
    font-size: 14px;
    padding: 10px;
    border-radius: 10px;
}
.pwd-actions button.cancel {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
}

.toolbar button, .gen-row button, .pager button, .ops button, .gen-result button {
    border: 1px solid rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.12);
    color: #eee;
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
}
.toolbar button:hover, .gen-row button:hover, .pager button:hover, .ops button:hover { background: rgba(255,255,255,0.25); }
.toolbar button:disabled, .pager button:disabled { opacity: .4; cursor: not-allowed; }

/* 导航（纵向菜单） */
.nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.nav-btn {
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
    color: #dcebf3;
    font-size: 14px;
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    width: 100%;
}
.nav-btn.active { background: linear-gradient(90deg, #36d1dc, #5b86e5); color: #fff; font-weight: bold; border-color: transparent; }

/* 页面容器 */
.page {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    padding: 18px;
}
.hint { color: #8fa3b0; font-size: 13px; margin-top: 14px; }

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}
.stat-card {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    padding: 18px 12px;
    text-align: center;
}
.stat-card .num { font-size: 26px; font-weight: bold; background: linear-gradient(90deg, #7ce0ff, #ff9a9e); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.stat-card .label { margin-top: 6px; font-size: 13px; color: #9fb6c4; }

/* 工具条 */
.toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.toolbar input, .toolbar select, .gen-row select, .gen-row input {
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.08);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
}
.toolbar input::placeholder { color: #8fa3b0; }
.toolbar select option { background: #1b2b36; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 8px; border-bottom: 1px solid rgba(255,255,255,0.1); text-align: left; white-space: nowrap; }
th { color: #9fb6c4; font-weight: normal; }
tr:hover td { background: rgba(255,255,255,0.05); }
td .code { font-family: Consolas, monospace; letter-spacing: 1px; }
td small { color: #8fa3b0; }
td .empty { text-align: center; color: #8fa3b0; padding: 30px; }

/* 标签 */
.tag {
    display: inline-block;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(255,255,255,0.15);
    color: #dcebf3;
}
.tag.vip { background: linear-gradient(90deg, #f7971e, #ffd200); color: #333; font-weight: bold; }
.tag.ok { background: rgba(58, 199, 103, 0.25); color: #7ce89a; }
.tag.ban { background: rgba(255, 87, 87, 0.25); color: #ff9a9a; }
.tag.used { background: rgba(255, 87, 87, 0.25); color: #ff9a9a; }
.tag.admin { background: rgba(91, 134, 229, 0.3); color: #9fc0ff; }

/* 操作按钮 */
.ops button { padding: 4px 10px; font-size: 12px; margin-right: 4px; }

/* 分页 */
.pager {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    font-size: 13px;
    color: #9fb6c4;
}

/* 生成卡密 */
.gen-box {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}
.gen-box h3 { margin-bottom: 12px; font-size: 16px; }
.gen-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.gen-row select { min-width: 140px; }
.gen-row input { width: 90px; }
.gen-result { margin-top: 12px; }
.gen-result textarea {
    width: 100%;
    min-height: 120px;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    color: #7ce89a;
    font-family: Consolas, monospace;
    font-size: 13px;
    padding: 10px;
    margin-bottom: 8px;
}

/* 手机适配 */
@media (max-width: 640px) {
    body { padding: 12px 8px; }
    .layout { flex-direction: column; }
    .sidebar { width: 100%; position: static; }
    .nav { flex-direction: row; overflow-x: auto; }
    .nav-btn { text-align: center; white-space: nowrap; }
    .page { padding: 12px; }
    th, td { padding: 8px 6px; font-size: 12px; }
}

/* 用户列表：最近登录 IP 链接 */
.ip-link { color: #7ce0ff; text-decoration: none; cursor: pointer; }
.ip-link:hover { text-decoration: underline; }

/* 系统配置表单 */
.set-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.set-row label { width: 110px; color: #9fb6c4; font-size: 13px; flex-shrink: 0; padding-top: 9px; }
/* 每行规则后面的"触发后处理"下拉（固定宽度，不占满整行） */
.set-row select.risk-act { flex: 0 0 auto; width: 128px; border: 1px solid rgba(255,255,255,0.18); background: rgba(255,255,255,0.08); color: #fff; padding: 9px 10px; border-radius: 8px; font-size: 13px; outline: none; }
.set-row select.risk-act option { background: #1b2b36; }
.set-row input, .set-row textarea {
    flex: 1;
    min-width: 200px;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.08);
    color: #fff;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    resize: vertical;
}
.set-row input::placeholder, .set-row textarea::placeholder { color: #8fa3b0; }
.set-actions { margin-top: 4px; }
.set-actions button {
    border: none;
    cursor: pointer;
    padding: 10px 34px;
    background: linear-gradient(90deg, #36d1dc, #5b86e5);
    color: #fff;
    font-size: 14px;
    border-radius: 10px;
}
#settingsMsg { min-height: 20px; font-size: 13px; margin-bottom: 8px; }

/* 登录历史弹窗（比改密码弹窗宽一点） */
.lg-box { max-width: 460px; }

/* 解析详情弹窗：更宽，方便看长链接和返回原文 */
.lg-wide { max-width: 760px; width: 94%; }
.detail-info {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 13px;
    word-break: break-all;
}
.detail-block { margin-bottom: 12px; }
.detail-label {
    font-size: 13px;
    color: #7ce0ff;
    margin-bottom: 6px;
    font-weight: bold;
}
/* 请求地址 / 返回原文：等宽字体 + 自动换行 + 内部滚动 */
.detail-pre {
    max-height: 240px;
    overflow: auto;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    padding: 10px 12px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    line-height: 1.6;
    color: #d8e6ef;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ===== API 配置页 ===== */
.mode-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.mode-item {
    flex: 1 1 240px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 10px;
    padding: 12px 14px;
    cursor: pointer;
}
.mode-item:hover { border-color: #7ce0ff; }
.mode-item input { margin-top: 3px; accent-color: #7ce0ff; }
.mode-item b { display: block; font-size: 14px; margin-bottom: 3px; }
.mode-item small { font-size: 12px; color: #9fb3bd; line-height: 1.5; }

/* 标题栏上的小按钮（新增接口） */
.mini-btn {
    background: linear-gradient(135deg, #26d0ce, #1a9e8c);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    float: right;
}
.mini-btn:hover { opacity: 0.85; }

/* 删除链接（红色） */
.ip-link.danger { color: #ff7b7b; }
.risk-recover { color: #ff7b7b; text-decoration: none; cursor: pointer; }
.risk-recover:hover { text-decoration: underline; }

/* API 编辑弹窗：两列网格布局（一排两个，避免又长又细的输入框） */
.fm-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
}
/* 需要占满整行的元素（名称、地址、提示、分隔标题） */
.fm-item.wide,
.fm-grid .map-divider,
.fm-grid > .hint { grid-column: 1 / -1; }
/* 每个输入项：小标签在上，输入框在下 */
.fm-item label {
    display: block;
    font-size: 12px;
    color: #9fb3bd;
    margin-bottom: 4px;
}
.fm-item input,
#apiEditModal .fm-item select {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(255,255,255,0.18);
    outline: none;
    background: rgba(255,255,255,0.08);
    color: #fff;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
}
.fm-item input::placeholder { color: rgba(255,255,255,0.35); }
#apiEditModal .fm-item select option { background: #203a43; }

/* 字段映射分隔标题 */
.map-divider {
    margin: 6px 0 2px;
    padding-top: 12px;
    border-top: 1px dashed rgba(255,255,255,0.15);
    font-size: 14px;
    font-weight: bold;
    color: #7ce0ff;
}

/* 双击改积分：悬停提示可编辑 */
.pts-cell {
    cursor: pointer;
    border-radius: 6px;
}
.pts-cell:hover {
    background: rgba(124,224,255,0.1);
    text-decoration: underline dotted #7ce0ff;
}
/* 积分编辑输入框 */
.pts-input {
    width: 80px;
    box-sizing: border-box;
    border: 1px solid #7ce0ff;
    outline: none;
    background: rgba(0,0,0,0.3);
    color: #fff;
    padding: 3px 6px;
    border-radius: 6px;
    font-size: 13px;
    text-align: center;
}

/* ===== 生成卡密弹窗 ===== */
/* 卡片类型单选 */
.radio-row { display: flex; gap: 16px; align-items: center; }
.radio-row .r { display: flex; align-items: center; gap: 4px; cursor: pointer; font-size: 13px; color: #d8e6ef; }
.radio-row input { accent-color: #7ce0ff; width: auto; }
/* 常用天数快捷按钮 */
.preset-row { display: flex; gap: 8px; flex-wrap: wrap; }
.preset-row .mini-btn { float: none; padding: 5px 12px; }
/* 生成成功的提示文字 */
.ok-text { color: #7ce89a; font-size: 13px; margin: 0 0 8px; }
/* 风控详情弹窗：详细记录里的账号/IP 列表 */
.risk-sub {
    margin-top: 8px;
    color: #b8c9d4;
    font-size: 13px;
}
.risk-item {
    padding: 6px 10px;
    margin-top: 6px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    font-size: 13px;
    color: #dcebf3;
    word-break: break-all;
}

/* 工具栏里的"生成卡密"按钮（mini-btn 默认靠右，这里放回正常流） */
.gen-btn { float: none; padding: 7px 16px; font-size: 13px; }

/* 系统配置页：选项卡 */
.cfg-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.cfg-tab {
    padding: 8px 22px;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.06);
    color: #b8c9d4;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all .2s;
}
.cfg-tab:hover { background: rgba(255,255,255,0.12); color: #e8f4f9; }
.cfg-tab.active {
    background: linear-gradient(135deg, #26d0ce, #1a9e8c);
    color: #fff;
    border-color: transparent;
    font-weight: bold;
}

/* 联系客服：二维码上传 + 预览 */
.upload-row { display: flex; gap: 8px; align-items: center; }
.qrcode-preview {
    margin-top: 10px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
}
.qrcode-preview img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    background: #fff;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.2);
    padding: 4px;
}
.qrcode-preview a {
    color: #ff7b7b;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
}
.qrcode-preview a:hover { text-decoration: underline; }
