:root {
    --bg: #f4f6fb;
    --panel: #ffffff;
    --border: #e6e9f0;
    --text: #1f2430;
    --muted: #7a8397;
    --primary: #4f6ef7;
    --primary-dark: #3b57d6;
    --success: #17b26a;
    --danger: #ef4b4b;
    --warning: #f5a524;
    --radius: 14px;
    --shadow: 0 6px 24px rgba(31, 36, 48, 0.06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}

a { color: var(--primary); text-decoration: none; }

/* ---------- 登录页 ---------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4f6ef7 0%, #7b5cf0 100%);
}

.login-card {
    width: 380px;
    background: #fff;
    border-radius: 18px;
    padding: 36px 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
}

.login-card h1 { margin: 0 0 6px; font-size: 22px; }
.login-card p.sub { margin: 0 0 24px; color: var(--muted); font-size: 13px; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 216px;
    background: #1e2333;
    color: #c9d0e0;
    padding: 20px 14px;
    flex-shrink: 0;
}

.sidebar .logo {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    padding: 6px 10px 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar .logo span.dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: linear-gradient(135deg, #4f6ef7, #7b5cf0);
    display: inline-block;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    color: #c9d0e0;
    margin-bottom: 4px;
    font-size: 14px;
    transition: background .15s, color .15s;
}

.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: linear-gradient(135deg, #4f6ef7, #7b5cf0); color: #fff; }
.nav-item .icon { width: 18px; text-align: center; }

.sidebar-footer {
    margin-top: 24px;
    padding: 10px;
    font-size: 12px;
    color: #6b7488;
    border-top: 1px solid rgba(255,255,255,.08);
}

.main { flex: 1; padding: 22px 26px 60px; overflow-x: hidden; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
    gap: 12px;
}

.topbar h2 { margin: 0; font-size: 20px; }
.topbar .desc { color: var(--muted); font-size: 13px; margin-top: 4px; }

.view { display: none; }
.view.active { display: block; }

/* ---------- 卡片 ---------- */
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    margin-bottom: 18px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
}

.stat-card .label { color: var(--muted); font-size: 13px; }
.stat-card .value { font-size: 26px; font-weight: 700; margin-top: 8px; }
.stat-card .value.primary { color: var(--primary); }

.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 160px;
    padding-top: 10px;
}

.chart-bars .bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    height: 100%;
    justify-content: flex-end;
}

.chart-bars .bar {
    width: 100%;
    max-width: 42px;
    background: linear-gradient(180deg, #6f86ff, #4f6ef7);
    border-radius: 6px 6px 0 0;
    min-height: 3px;
    transition: height .3s;
}

.chart-bars .bar-label { color: var(--muted); font-size: 12px; }
.chart-bars .bar-value { font-size: 12px; font-weight: 600; }

/* ---------- 表单 ---------- */
input[type=text], input[type=password], input[type=number], select, textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    background: #fff;
    color: var(--text);
    font-family: inherit;
}

input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { min-height: 110px; resize: vertical; line-height: 1.6; }

.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--muted); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all .15s;
    font-family: inherit;
}

.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn.danger { color: var(--danger); border-color: #f6c9c9; }
.btn.danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
}

.toolbar .grow { flex: 1; min-width: 140px; }
.toolbar select, .toolbar input { width: auto; min-width: 150px; }

/* ---------- 图片网格 ---------- */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}

.image-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    position: relative;
    transition: box-shadow .15s, transform .15s;
}

.image-card:hover { box-shadow: 0 8px 22px rgba(31, 36, 48, .12); transform: translateY(-2px); }
.image-card.selected { outline: 2px solid var(--primary); }

.image-card .thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: #eef1f7;
    cursor: pointer;
    display: block;
}

.image-card .meta { padding: 8px 10px 10px; }
.image-card .title {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.image-card .sub { font-size: 12px; color: var(--muted); }
.image-card .actions { display: flex; gap: 6px; padding: 0 10px 10px; }
.image-card .check {
    position: absolute; top: 8px; left: 8px;
    width: 18px; height: 18px; cursor: pointer;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    background: #eef1fb;
    color: var(--primary);
}

.badge.off { background: #f3f4f6; color: var(--muted); }
.badge.ok { background: #e7f7ef; color: var(--success); }

.empty {
    text-align: center;
    color: var(--muted);
    padding: 60px 0;
}

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 18px;
}

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
th { color: var(--muted); font-weight: 500; background: #fafbfe; }
tbody tr:hover { background: #fafbfe; }

.mono { font-family: Consolas, "Courier New", monospace; font-size: 12px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
    position: fixed; inset: 0;
    background: rgba(20, 24, 35, .5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99;
}

.modal-mask.show { display: flex; }

.modal {
    background: #fff;
    border-radius: 16px;
    width: 520px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 60px);
    overflow: auto;
    padding: 22px;
}

.modal h3 { margin: 0 0 16px; font-size: 17px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---------- 文档 ---------- */
.code {
    background: #1e2333;
    color: #d7dced;
    border-radius: 12px;
    padding: 14px 16px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12.5px;
    line-height: 1.7;
    overflow-x: auto;
    position: relative;
    white-space: pre;
}

.code .copy-btn {
    position: absolute; top: 8px; right: 8px;
    background: rgba(255,255,255,.12);
    border: none; color: #fff;
    border-radius: 8px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 12px;
}

.doc-endpoint {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border);
    flex-wrap: wrap;
}

.method {
    background: #eaf0ff;
    color: var(--primary);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
}

.param-table td:first-child { font-family: Consolas, monospace; color: var(--primary); }

/* ---------- 提示 ---------- */
.toast-wrap {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 10px 18px;
    border-radius: 10px;
    background: #1e2333;
    color: #fff;
    box-shadow: 0 10px 30px rgba(0,0,0,.2);
    animation: fade .25s ease;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

@keyframes fade { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.drop-zone {
    border: 2px dashed #cbd3e6;
    border-radius: 12px;
    padding: 28px;
    text-align: center;
    color: var(--muted);
    cursor: pointer;
}

.drop-zone:hover, .drop-zone.over { border-color: var(--primary); color: var(--primary); background: #f7f9ff; }

@media (max-width: 760px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; display: flex; overflow-x: auto; padding: 12px; }
    .sidebar .logo, .sidebar-footer { display: none; }
    .nav-item { margin: 0 6px 0 0; white-space: nowrap; }
    .main { padding: 16px; }
}
