/**
 * 答题红包系统 - 管理后台样式
 * 作者：寇豆码
 */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
    font-family: "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px; color: #333; background: #f0f2f5;
}
a { color: #1e6fff; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- 整体布局：左侧栏 + 主区 ---- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 200px; background: #1f2d3d; color: #c0c4cc;
    display: flex; flex-direction: column; flex-shrink: 0;
}
.brand { padding: 20px 16px; font-size: 18px; font-weight: 600; color: #fff; }
.sidebar nav { display: flex; flex-direction: column; }
.sidebar nav a {
    padding: 12px 20px; color: #c0c4cc; font-size: 14px;
    border-left: 3px solid transparent; text-decoration: none;
}
.sidebar nav a:hover { color: #fff; background: #263445; }
.sidebar nav a.active { color: #fff; background: #263445; border-left-color: #f56c2d; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    height: 56px; background: #fff; display: flex; align-items: center;
    justify-content: space-between; padding: 0 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08); position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-user { color: #666; display: flex; align-items: center; gap: 12px; }
.content { padding: 24px; }

/* ---- 卡片与表格 ---- */
.card {
    background: #fff; border-radius: 8px; padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 20px;
}
.card h3 { font-size: 15px; margin-bottom: 14px; color: #1f2d3d; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.stat-item { background: #fff; border-radius: 8px; padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.stat-item .num { font-size: 26px; font-weight: 700; margin-top: 6px; }
.stat-item .num.money { color: #d54b30; }
.stat-item .lbl { color: #909399; font-size: 13px; }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th, table.grid td {
    padding: 10px 12px; text-align: left; border-bottom: 1px solid #ebeef5;
    word-break: break-all; vertical-align: middle;
}
table.grid th { background: #f5f7fa; color: #606266; font-weight: 600; white-space: nowrap; }
table.grid tr:hover td { background: #fafafa; }

/* ---- 客户（头像 + 昵称）单元格 ---- */
.cell-user { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.cell-user .u-meta { min-width: 0; line-height: 1.3; }
.cell-user .u-nick { font-weight: 400; color: #303133; word-break: break-all; }
.cell-user .u-openid { font-family: Consolas, monospace; font-size: 12px; color: #909399; }
.avatar-xs {
    width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
    object-fit: cover; background: #f4f4f5; border: 1px solid #ebeef5;
}
.avatar-ph {
    width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: #e9eefb; color: #5a7bd6; font-size: 14px; line-height: 1;
}
.avatar-lg {
    width: 64px; height: 64px; border-radius: 50%;
    object-fit: cover; background: #f4f4f5; border: 1px solid #ebeef5;
}
.card-user { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.card-user .u-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: #fff; border: 1px solid #ebeef5; border-radius: 8px; }
.card-user .u-nick { font-weight: 600; color: #303133; }
.card-user .u-sub { font-size: 12px; color: #909399; font-family: Consolas, monospace; }

.pager { margin-top: 14px; display: flex; gap: 8px; align-items: center; color: #666; }

/* ---- 表单 ---- */
.form-row { display: flex; align-items: flex-start; margin-bottom: 14px; }
.form-row label { width: 140px; flex-shrink: 0; padding-top: 8px; color: #606266; }
.form-input { flex: 1; }
input[type=text], input[type=password], input[type=number], input[type=datetime-local], select, textarea {
    width: 100%; max-width: 420px; padding: 8px 10px; border: 1px solid #dcdfe6;
    border-radius: 4px; font-size: 14px; font-family: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #1e6fff; }
textarea { resize: vertical; }
.form-tip { color: #909399; font-size: 12px; margin-top: 4px; }
.form-actions { margin-left: 140px; }
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.inline-form input, .inline-form select { width: auto; }

/* ---- 按钮 ---- */
.btn {
    display: inline-block; padding: 7px 14px; border: 1px solid #dcdfe6; border-radius: 4px;
    background: #fff; color: #606266; cursor: pointer; font-size: 13px; line-height: 1.4;
    text-decoration: none; white-space: nowrap;
}
.btn:hover { color: #1e6fff; border-color: #1e6fff; text-decoration: none; }
.btn-primary { background: #d54b30; border-color: #d54b30; color: #fff; }
.btn-primary:hover { background: #e05a3c; border-color: #e05a3c; color: #fff; }
.btn-danger { color: #f56c6c; border-color: #fbc4c4; }
.btn-danger:hover { color: #f23c3c; border-color: #f23c3c; }
.btn-sm { padding: 3px 8px; font-size: 12px; }

/* ---- 标签 ---- */
.tag {
    display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 12px;
    background: #ecf5ff; color: #1e6fff;
}
.tag-warn { background: #fdf6ec; color: #e6a23c; }
.tag-ok { background: #f0f9eb; color: #67c23a; }
.tag-gray { background: #f4f4f5; color: #909399; }
.tag-err { background: #fef0f0; color: #f56c6c; }

/* ---- 提示 ---- */
.toast {
    position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,.78); color: #fff; padding: 10px 20px; border-radius: 6px;
    font-size: 14px; z-index: 999; display: none;
}

/* ---- 配置页 ---- */
.cfg-tabs { display: flex; gap: 4px; margin-bottom: 16px; background: #fff; padding: 8px; border-radius: 8px; }
.cfg-tabs a {
    padding: 8px 18px; border-radius: 6px; color: #606266; text-decoration: none;
}
.cfg-tabs a.active { background: #d54b30; color: #fff; }
.cfg-form { max-width: 720px; }
.form-result { margin-left: 12px; color: #67c23a; font-size: 13px; }
.form-result.err { color: #f56c6c; }

/* ---- 链接生成结果区 ---- */
.link-result {
    margin-top: 16px; padding: 16px; background: #f0f9eb; border: 1px solid #e1f3d8;
    border-radius: 6px; display: none;
}
.link-result .url { font-family: Consolas, monospace; font-size: 15px; color: #d54b30; word-break: break-all; margin: 8px 0; }

/* ---- 筛选条 ---- */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filter-bar select, .filter-bar input { width: auto; }

/* ---- 登录页 ---- */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #d54b30, #f05a28);
}
.login-box {
    width: 360px; background: #fff; border-radius: 10px; padding: 36px;
    box-shadow: 0 10px 40px rgba(0,0,0,.2);
}
.login-box h2 { text-align: center; margin-bottom: 24px; color: #d54b30; }
.login-box .form-row label { width: 70px; }
.login-box .form-actions { margin-left: 70px; }
.login-box input { max-width: none; }
.login-err { color: #f56c6c; margin-bottom: 12px; margin-left: 70px; font-size: 13px; }

/* ---- 答题导入 ---- */
.import-tips { background: #fdf6ec; padding: 12px; border-radius: 6px; color: #84611a; font-size: 13px; line-height: 1.8; margin-bottom: 16px; }
.fail-list { margin-top: 10px; max-height: 220px; overflow: auto; background: #fef0f0; color: #f56c6c; padding: 10px; border-radius: 4px; font-size: 12px; line-height: 1.8; }
.ok-list { margin-top: 10px; color: #67c23a; font-size: 13px; }

@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar .brand { font-size: 12px; text-align: center; padding: 14px 4px; }
    .sidebar nav a { padding: 12px 0; text-align: center; font-size: 0; }
    .sidebar nav a::first-letter { font-size: 14px; }
    .form-actions { margin-left: 0; }
}
