/* 巨量资源采集中心 · 面板样式 */
:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #fafbfc;
    --border: #e5e7eb;
    --border-strong: #d1d5db;
    --text: #111827;
    --muted: #6b7280;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: #eff6ff;
    --ok: #059669;
    --ok-soft: #ecfdf5;
    --warn: #c2740a;
    --warn-soft: #fffbeb;
    --bad: #dc2626;
    --bad-soft: #fef2f2;
    --sidebar: #0f172a;
    --sidebar-text: #cbd5e1;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; }
code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; font-size: .92em; }

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 20px; }
h2 { font-size: 15px; }
p { margin: 0 0 10px; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.text-bad { color: var(--bad); }
.link { font-size: 13px; }

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

.sidebar {
    width: 216px;
    flex: 0 0 216px;
    background: var(--sidebar);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px 14px; }
.brand-mark {
    width: 34px; height: 34px; flex: 0 0 34px;
    display: grid; place-items: center;
    border-radius: 9px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff; font-weight: 700; font-size: 17px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { color: #f8fafc; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: #64748b; font-size: 11px; }

.nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; flex: 1; overflow-y: auto; }
.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 8px;
    color: var(--sidebar-text); font-size: 13.5px;
}
.nav-link:hover { background: rgba(148, 163, 184, .12); color: #f8fafc; text-decoration: none; }
.nav-link.is-active { background: rgba(59, 130, 246, .18); color: #fff; box-shadow: inset 2px 0 0 #3b82f6; }
.nav-ico { width: 16px; text-align: center; opacity: .85; font-size: 14px; }

.sidebar-foot {
    display: flex; justify-content: space-between;
    padding: 12px 18px; border-top: 1px solid rgba(148, 163, 184, .15);
    font-size: 12px; color: #64748b;
}
.sidebar-foot a { color: #94a3b8; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 16px 28px; background: var(--surface); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 20;
}
.topbar-title h1 { font-size: 18px; }
.topbar-title .sub { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }

.content { padding: 22px 28px 48px; max-width: 1500px; width: 100%; }

/* ---------- 卡片 ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px;
    margin-bottom: 18px;
}
.card-soft { background: var(--surface-2); box-shadow: none; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { padding-top: 2px; }
.card-inline { padding: 14px 18px; }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.eyebrow { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 2px; }

.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.cards-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat { display: flex; flex-direction: column; gap: 3px; padding: 16px 18px; }
.stat-label { color: var(--muted); font-size: 12.5px; }
.stat strong { font-size: 24px; font-weight: 650; letter-spacing: -.02em; line-height: 1.25; }
.stat strong em { font-style: normal; color: var(--border-strong); font-size: 18px; margin: 0 1px; }
.stat-hint { color: var(--muted); font-size: 12px; }
.stat-hint a { color: var(--primary); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-form { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
@media (max-width: 1100px) {
    .cards, .cards-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-2, .grid-form { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
    .app { flex-direction: column; }
    .sidebar { width: 100%; flex: none; height: auto; position: static; }
    .nav { flex-direction: row; overflow-x: auto; padding: 6px 10px; }
    .nav-link { white-space: nowrap; }
    .content { padding: 16px; }
    .topbar { padding: 14px 16px; }
    .cards, .cards-4 { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 34px; padding: 0 14px;
    border-radius: 8px; border: 1px solid transparent;
    font-size: 13px; font-weight: 550; font-family: inherit;
    background: #f3f4f6; color: var(--text); cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    text-decoration: none !important;
}
.btn:hover { background: #e5e7eb; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: #374151; }
.btn-ghost:hover { background: #f9fafb; }
.btn-danger { background: var(--bad-soft); color: var(--bad); border-color: #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; }

/* ---------- 徽标 / 标签 ---------- */
.badge {
    display: inline-flex; align-items: center;
    height: 22px; padding: 0 9px; border-radius: 999px;
    font-size: 12px; font-weight: 550; white-space: nowrap;
    background: #f3f4f6; color: #374151;
}
.badge-muted { background: #f3f4f6; color: var(--muted); font-weight: 400; }
.badge-ok, .badge-done { background: var(--ok-soft); color: var(--ok); }
.badge-running { background: var(--primary-soft); color: var(--primary); }
.badge-pending { background: #eef2ff; color: #4f46e5; }
.badge-stopped { background: #f3f4f6; color: #4b5563; }
.badge-failed, .badge-bad { background: var(--bad-soft); color: var(--bad); }

.chip {
    display: inline-block; padding: 1px 7px; margin: 1px 2px 1px 0;
    border-radius: 5px; font-size: 11.5px; background: #f1f5f9; color: #475569;
}
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-line { background: #eef2ff; color: #4338ca; }

/* ---------- 提示条 ---------- */
.banner { padding: 10px 14px; border-radius: 9px; margin-bottom: 16px; font-size: 13px; }
.banner-warn { background: var(--warn-soft); border: 1px solid #fde68a; color: #92400e; }
.alert { padding: 10px 14px; border-radius: 9px; margin-bottom: 14px; font-size: 13px; }
.alert-ok { background: var(--ok-soft); border: 1px solid #a7f3d0; color: #065f46; }
.alert-error { background: var(--bad-soft); border: 1px solid #fecaca; color: #991b1b; }
.alert-warn { background: var(--warn-soft); border: 1px solid #fde68a; color: #92400e; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
    text-align: left; font-weight: 600; color: var(--muted); font-size: 12px;
    padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 9px 10px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.table tbody tr:hover { background: #fbfcfe; }
.table tr:last-child td { border-bottom: none; }
.table-compact td, .table-compact th { padding: 6px 8px; }
.table-vod td { padding: 8px 10px; }
.w-40 { width: 40px; } .w-60 { width: 60px; } .w-70 { width: 70px; }
.w-90 { width: 90px; } .w-100 { width: 100px; } .w-110 { width: 110px; }
.w-120 { width: 120px; } .w-140 { width: 140px; } .w-150 { width: 150px; }
.w-160 { width: 160px; } .w-220 { width: 220px; }
.table-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.pager { display: flex; gap: 6px; flex-wrap: wrap; }

.poster {
    width: 48px; height: 66px; object-fit: cover;
    border-radius: 5px; background: #f1f5f9; display: block;
}
.poster-empty { display: grid; place-items: center; color: #9ca3af; font-size: 11px; }

.empty { padding: 28px 12px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- 进度 ---------- */
.bar { height: 9px; border-radius: 999px; background: #eef2f7; overflow: hidden; margin: 4px 0 12px; }
.bar i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #3b82f6, #6366f1); transition: width .4s ease; }
.bar-sm { height: 6px; margin: 0 0 5px; }
.progress-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.progress-meta b { color: var(--text); font-variant-numeric: tabular-nums; }

.log {
    background: #0b1220; color: #cbd5e1;
    border-radius: 9px; padding: 12px 14px;
    font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; line-height: 1.7;
    height: 260px; overflow-y: auto; white-space: pre-wrap; word-break: break-all;
}
.log:empty::before { content: "等待日志…"; color: #64748b; }
.log-line { padding: 1px 0; border-bottom: 1px solid rgba(148, 163, 184, .08); }
.log-time { color: #64748b; margin-right: 8px; }
.log-warn { color: #fbbf24; }
.log-error { color: #f87171; }

/* ---------- 表单 ---------- */
.form { display: flex; flex-direction: column; gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field-label { font-size: 12.5px; color: #374151; font-weight: 550; }
.field-label em { font-style: normal; color: var(--muted); font-weight: 400; }
.field-hint { font-size: 11.5px; color: var(--muted); }

input[type="text"], input[type="password"], input[type="number"], input[type="search"], input[type="url"], select, textarea {
    height: 34px; padding: 0 10px;
    border: 1px solid var(--border-strong); border-radius: 8px;
    background: #fff; color: var(--text); font-size: 13px; font-family: inherit;
    min-width: 0; width: 100%;
}
textarea { height: auto; padding: 8px 10px; }
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.input-full { width: 100%; }
.input-sort { width: 74px; }

.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: #374151; }
.check input { width: 15px; height: 15px; margin-top: 3px; accent-color: var(--primary); }

.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input[type="search"] { width: 220px; }
.inline-form select { width: 160px; }

.switch { position: relative; display: inline-block; width: 38px; height: 21px; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i {
    position: absolute; inset: 0; background: #d1d5db; border-radius: 999px; cursor: pointer; transition: background .15s;
}
.switch i::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px;
    background: #fff; border-radius: 50%; transition: transform .15s;
}
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(17px); }

/* ---------- 列表 / 键值 ---------- */
.kv { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 7px 14px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
.kv-2 { grid-template-columns: 108px minmax(0, 1fr) 108px minmax(0, 1fr); }
@media (max-width: 760px) { .kv-2 { grid-template-columns: 108px minmax(0, 1fr); } }

.tips { margin: 0; padding-left: 18px; font-size: 13px; color: #374151; }
.tips li { margin-bottom: 6px; }
.steps { margin: 0; padding-left: 20px; font-size: 13px; }
.steps li { margin-bottom: 7px; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.faq dt { font-weight: 600; margin-top: 12px; font-size: 13px; }
.faq dt:first-child { margin-top: 0; }
.faq dd { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }

/* ---------- 排行榜 ---------- */
.rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.rank li { display: grid; grid-template-columns: 120px minmax(0, 1fr) 56px; gap: 10px; align-items: center; font-size: 12.5px; }
.rank-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #374151; }
.rank-bar { height: 7px; background: #eef2f7; border-radius: 999px; overflow: hidden; }
.rank-bar i { display: block; height: 100%; background: #93c5fd; border-radius: 999px; }
.rank-num { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- 快捷入口 ---------- */
.quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 6px; }
.quick {
    display: flex; flex-direction: column; gap: 2px;
    padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface-2); color: var(--text);
}
.quick:hover { border-color: #bfdbfe; background: var(--primary-soft); text-decoration: none; }
.quick strong { font-size: 13.5px; }
.quick span { font-size: 12px; color: var(--muted); }

/* ---------- 代码 ---------- */
.code {
    background: #0b1220; color: #e2e8f0; border-radius: 9px;
    padding: 14px 16px; overflow-x: auto; font-size: 12.5px; line-height: 1.7; margin: 0;
}
.code-block { position: relative; }
.code-block .btn { position: absolute; top: 8px; right: 8px; background: rgba(148,163,184,.15); color: #e2e8f0; border-color: transparent; }
.code-block .btn:hover { background: rgba(148,163,184,.28); }
.code-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.code-row label { flex: 0 0 210px; font-size: 12.5px; color: var(--muted); }
.code-row input { flex: 1; font-size: 12px; }

.endpoints { display: flex; flex-direction: column; gap: 16px; }
.endpoint { border-bottom: 1px solid #f1f5f9; padding-bottom: 14px; }
.endpoint:last-child { border-bottom: none; padding-bottom: 0; }
.endpoint-head { display: flex; flex-direction: column; gap: 1px; margin-bottom: 6px; }

/* ---------- 标签页 ---------- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
    padding: 5px 11px; border-radius: 7px; font-size: 12.5px; color: var(--muted);
}
.tab:hover { background: #f3f4f6; text-decoration: none; }
.tab.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

/* ---------- 抽屉 ---------- */
.drawer { position: fixed; inset: 0; z-index: 90; }
.drawer-mask { position: absolute; inset: 0; background: rgba(15, 23, 42, .38); }
.drawer-panel {
    position: absolute; top: 0; right: 0; bottom: 0; width: min(680px, 94vw);
    background: var(--surface); box-shadow: -12px 0 34px rgba(15, 23, 42, .18);
    display: flex; flex-direction: column; animation: slide-in .18s ease;
}
@keyframes slide-in { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.drawer-body { padding: 18px 20px 40px; overflow-y: auto; }
.dv-hero { display: flex; gap: 16px; margin-bottom: 18px; }
.dv-hero img { width: 118px; height: 162px; object-fit: cover; border-radius: 9px; background: #f1f5f9; }
.dv-meta { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.dv-meta .muted { font-size: 12.5px; }
.dv-groups { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.dv-group { border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; }
.dv-group-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.dv-eps { display: flex; flex-wrap: wrap; gap: 5px; max-height: 170px; overflow-y: auto; }
.dv-ep { font-size: 11.5px; padding: 2px 7px; background: #f1f5f9; border-radius: 5px; color: #334155; }
.dv-plot { font-size: 12.5px; color: var(--muted); max-height: 180px; overflow-y: auto; white-space: pre-wrap; margin-top: 6px; }

/* ---------- 登录 ---------- */
.is-blank { background: linear-gradient(160deg, #0f172a, #1e293b 55%, #1e3a8a); }
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 16px; padding: 28px 26px; box-shadow: 0 24px 60px rgba(2, 6, 23, .35); }
.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; }
.login-brand h1 { font-size: 17px; }
.login-brand p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.login-tip { margin: 16px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
.login-foot { color: #94a3b8; font-size: 12px; }

/* ---------- 提示条 ---------- */
.toast {
    position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(12px);
    background: #111827; color: #f9fafb; padding: 10px 16px; border-radius: 9px;
    font-size: 13px; box-shadow: 0 10px 30px rgba(2, 6, 23, .28);
    opacity: 0; transition: opacity .18s, transform .18s; pointer-events: none; z-index: 999;
    max-width: 80vw;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.is-error { background: #b91c1c; }

[hidden] { display: none !important; }
