:root {
    --primary: #3b6ef6;
    --primary-dark: #2f59cc;
    --bg: #f3f5f9;
    --card: #ffffff;
    --text: #1f2733;
    --text-2: #6b7686;
    --line: #e4e8f0;
    --green: #1da750;
    --amber: #d98a06;
    --red: #d94b3f;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(20, 30, 60, .06), 0 4px 14px rgba(20, 30, 60, .05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, select { font: inherit; }

/* ---------- 登录 ---------- */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eef2fb 0%, #e3e9f7 60%, #dde5f6 100%);
}
.auth-card {
    width: 380px;
    background: var(--card);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 36px 34px 30px;
}
.auth-logo {
    text-align: center;
    margin-bottom: 26px;
}
.auth-logo .mark {
    width: 46px; height: 46px;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}
.auth-logo h1 { font-size: 19px; }
.auth-logo p { color: var(--text-2); font-size: 12.5px; margin-top: 2px; }

.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 5px; }
.field input, .field select {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    outline: none;
    transition: border-color .15s;
    background: #fff;
}
.field input:focus, .field select:focus { border-color: var(--primary); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: 8px;
    padding: 8px 15px;
    font-size: 13.5px;
    transition: background .15s;
}
.btn-primary { background: var(--primary); color: #fff; width: 100%; padding: 10px; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 7px; }
.btn-default { background: #eef1f7; color: var(--text); }
.btn-default:hover { background: #e2e7f1; }
.btn-danger { background: #fdeceb; color: var(--red); }
.btn-danger:hover { background: #fbdcd9; }
.btn-green { background: #e6f6ec; color: var(--green); }
.btn-green:hover { background: #d3efdd; }
.btn-amber { background: #fdf3e0; color: var(--amber); }
.btn-amber:hover { background: #f9e8c8; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.form-error {
    background: #fdeceb; color: var(--red);
    border-radius: 8px; padding: 8px 12px;
    font-size: 13px; margin-bottom: 14px; display: none;
}

/* ---------- 主框架 ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 208px;
    background: #1c2333;
    color: #cbd3e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
}
.sidebar .brand {
    padding: 18px 20px 14px;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .brand small { display: block; font-size: 11px; font-weight: 400; color: #7d8aa3; margin-top: 1px; }
.nav { padding: 10px 0; flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: 9px;
    padding: 10px 20px;
    color: #cbd3e1;
    cursor: pointer;
    border-left: 3px solid transparent;
    font-size: 13.5px;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.active { background: rgba(59,110,246,.16); color: #fff; border-left-color: var(--primary); }
.nav-item .ico { width: 17px; text-align: center; }

.main { flex: 1; margin-left: 208px; display: flex; flex-direction: column; }

.topbar {
    height: 54px;
    background: var(--card);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 24px;
    gap: 14px;
    position: sticky; top: 0; z-index: 10;
}
.user-chip { display: flex; align-items: center; gap: 9px; color: var(--text); }
.avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 600;
}
.user-chip .meta { line-height: 1.3; }
.user-chip .meta b { font-size: 13px; display: block; }
.user-chip .meta span { font-size: 11.5px; color: var(--text-2); }

.content { padding: 22px 26px; flex: 1; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-head h2 { font-size: 17px; }
.page-head .sub { color: var(--text-2); font-size: 12.5px; margin-top: 2px; }

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card-head h3 { font-size: 15px; }

/* ---------- 工作台 ---------- */
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.info-row { display: flex; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.info-row:last-child { border-bottom: none; }
.info-row .k { width: 108px; color: var(--text-2); flex-shrink: 0; }
.info-row .v { flex: 1; word-break: break-all; }
.perm-badge {
    display: inline-block;
    background: #eef3ff; color: var(--primary-dark);
    border-radius: 6px; padding: 2px 9px;
    font-size: 12px; margin: 0 6px 6px 0;
}
.welcome {
    background: linear-gradient(120deg, #3b6ef6, #6a4df4);
    color: #fff; border-radius: var(--radius);
    padding: 22px 24px; margin-bottom: 16px;
}
.welcome h3 { font-size: 17px; margin-bottom: 4px; }
.welcome p { font-size: 13px; opacity: .85; }

/* ---------- 表格 ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input[type="month"], .toolbar input[type="date"], .toolbar input[type="text"], .toolbar select {
    border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 13px; background: #fff;
}
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--primary); }
.tab {
    padding: 6px 14px; border-radius: 7px; font-size: 13px;
    background: #eaeef6; color: var(--text-2); cursor: pointer; border: none;
}
.tab.active { background: var(--primary); color: #fff; }
.tab .cnt { opacity: .75; font-size: 12px; margin-left: 2px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
th { color: var(--text-2); font-weight: 500; font-size: 12.5px; background: #fafbfe; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbff; }

.badge { display: inline-block; border-radius: 20px; padding: 1px 10px; font-size: 12px; }
.badge-pending { background: #fdf3e0; color: var(--amber); }
.badge-active { background: #e6f6ec; color: var(--green); }
.badge-disabled { background: #eef0f4; color: var(--text-2); }
.badge-info { background: #e8f1ff; color: var(--primary); }
.badge-purple { background: #efe9ff; color: #7a5af8; }
.badge-pink { background: #fdeef5; color: #c2317c; }
.badge-grey { background: #eef0f4; color: var(--text-2); }
.badge-mute { background: #fdeceb; color: var(--red); }

.ops { display: flex; gap: 6px; align-items: center; }
.ops select { padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 12.5px; max-width: 130px; }

/* ---------- 认证审核 ---------- */
.ver-imgs { display: flex; gap: 6px; flex-wrap: wrap; }
.ver-thumb { width: 56px; height: 40px; object-fit: cover; border: 1px solid var(--line); border-radius: 6px; cursor: zoom-in; background: #f6f8fc; }
.ver-thumb:hover { border-color: var(--primary); }
.img-light { position: fixed; inset: 0; z-index: 300; background: rgba(10, 16, 32, .85);
    display: flex; align-items: center; justify-content: center; padding: 30px; cursor: zoom-out; }
.img-light img { max-width: 100%; max-height: 100%; border-radius: 8px; background: #fff; }

/* 用户管理页认证小圆徽章 */
.ubadge { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%;
    font-size: 12.5px; font-weight: 700; color: #fff; margin-right: 6px; user-select: none; }
.ubadge.ub-real { background: linear-gradient(135deg, #ff6b6b, #d32f2f); }
.ubadge.ub-ent { background: linear-gradient(135deg, #ffd966, #e8a317); }
.ubadge.ub-none { background: linear-gradient(135deg, #c0c9d6, #93a0b3); }

.empty { text-align: center; color: var(--text-2); padding: 36px 0; }

/* ---------- 弹窗 ---------- */
.modal-mask {
    position: fixed; inset: 0;
    background: rgba(15, 22, 40, .45);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
}
.modal {
    width: 520px; max-width: calc(100vw - 40px);
    max-height: 86vh; overflow: auto;
    background: var(--card); border-radius: 12px;
    padding: 24px 26px;
}
.modal h3 { font-size: 16px; margin-bottom: 16px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal-tip { font-size: 12.5px; color: var(--text-2); background: #f6f8fc; border-radius: 8px;
    padding: 8px 12px; margin-bottom: 14px; line-height: 1.6; }
.field-err { display: none; font-size: 12px; color: var(--red); margin-top: 4px; line-height: 1.5; }
.field-err:not(:empty) { display: block; }
.perm-group { margin-bottom: 14px; }
.perm-group .g-name { font-size: 13px; color: var(--text-2); margin-bottom: 7px; font-weight: 600; }
.perm-group label { display: inline-flex; align-items: center; gap: 6px; margin: 0 16px 8px 0; font-size: 13.5px; cursor: pointer; }

/* ---------- 提示 ---------- */
.toast {
    position: fixed; top: 66px; left: 50%; transform: translateX(-50%);
    background: #1f2733; color: #fff;
    border-radius: 8px; padding: 9px 18px;
    font-size: 13.5px; z-index: 200;
    box-shadow: 0 6px 20px rgba(0,0,0,.2);
}
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }

.loading { text-align: center; color: var(--text-2); padding: 60px 0; }

/* ---------- 站点设置 ---------- */
.set-group h3 {
    font-size: 15px;
    padding-left: 10px;
    border-left: 3px solid var(--primary);
    margin-bottom: 16px;
}
.set-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 18px;
    align-items: start;
}
.set-item.set-full { grid-column: 1 / -1; }
.set-label {
    font-size: 13px;
    color: var(--text-2);
    margin-bottom: 5px;
    font-weight: 600;
}
.set-label em {
    font-style: normal;
    font-weight: 400;
    color: #9aa4b2;
    margin-left: 6px;
}
.set-inp {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13.5px;
    background: #fff;
    color: var(--text);
}
.set-inp:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 110, 246, .12);
}
textarea.set-inp { resize: vertical; min-height: 64px; }
.set-item .set-inp + .set-inp { margin-top: 8px; }
.set-tip { font-size: 12px; color: #9aa4b2; margin-top: 5px; }
.set-stat { display: grid; grid-template-columns: 1fr 90px 1.4fr; gap: 8px; }

.set-img-row { display: flex; gap: 14px; align-items: flex-start; }
.set-img-preview {
    width: 180px; height: 110px;
    border: 1px dashed #c9d2e0;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    background: #fafbfd;
    flex-shrink: 0;
}
.set-img-preview img { width: 100%; height: 100%; object-fit: cover; }
.set-img-preview span { font-size: 12px; color: #9aa4b2; }
.set-img-ops { flex: 1; min-width: 0; }
.set-img-url { margin-bottom: 2px; }
.set-img-btns { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

.picker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-height: 55vh;
    overflow: auto;
}
.picker-item {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: #fff;
}
.picker-item:hover { border-color: var(--primary); }
.picker-item img {
    width: 100%; height: 90px;
    object-fit: cover; display: block;
    background: #f3f5f9;
}
.picker-item span {
    display: block;
    font-size: 11px;
    color: var(--text-2);
    padding: 5px 6px;
    word-break: break-all;
}

@media (max-width: 860px) {
    .set-grid { grid-template-columns: 1fr; }
    .set-stat { grid-template-columns: 1fr; }
    .set-img-row { flex-direction: column; }
    .set-img-preview { width: 100%; }
}

@media (max-width: 860px) {
    .grid-2 { grid-template-columns: 1fr; }
    .sidebar { width: 60px; }
    .sidebar .brand span, .sidebar .brand small, .nav-item span.txt { display: none; }
    .nav-item { justify-content: center; padding: 12px 0; }
    .main { margin-left: 60px; }
}
