/* ===== 灵沐管理后台样式 ===== */
:root {
    --bg: #f2f5fa;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #e7ecf4;
    --primary: #3b6cf6;
    --primary-soft: #eaf0ff;
    --green: #16a34a;
    --orange: #f59e0b;
    --red: #dc2626;
    --sidebar: #141b2d;
    --sidebar-muted: #8b95ab;
    --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font: 14px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
a:hover { opacity: .85; }
code { background: #f1f4fa; padding: 2px 6px; border-radius: 6px; font-size: 12.5px; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 216px; flex: none; background: var(--sidebar); color: #e5e9f2;
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px 16px; font-size: 16px; font-weight: 700; }
.brand em { font-style: normal; font-weight: 400; font-size: 12px; color: var(--sidebar-muted); margin-left: 4px; }
.brand-mark {
    width: 32px; height: 32px; border-radius: 10px; flex: none;
    background: linear-gradient(135deg, #4f7cff, #8b5cf6);
    display: flex; align-items: center; justify-content: center; color: #fff; font-size: 15px; font-weight: 700;
}
.nav { flex: 1; overflow-y: auto; padding: 6px 10px 16px; }
.nav-group { font-size: 11.5px; color: var(--sidebar-muted); padding: 14px 10px 6px; letter-spacing: .04em; }
.nav-item {
    display: block; padding: 9px 12px; border-radius: 10px; color: #d6dbe8;
    font-size: 13.5px; margin-bottom: 2px; border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); opacity: 1; }
.nav-item.active {
    background: linear-gradient(90deg, rgba(79, 124, 255, .9), rgba(124, 108, 255, .55));
    color: #fff; font-weight: 600; border-left-color: #fff;
}
.sidebar-foot { padding: 14px 18px; font-size: 11.5px; color: var(--sidebar-muted); border-top: 1px solid rgba(255, 255, 255, .06); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    height: 60px; background: #fff; border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between; padding: 0 22px;
    position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.topbar-right .who { color: var(--muted); }
.topbar-right .link { color: var(--primary); }
.content { padding: 20px 22px 48px; }

/* ---------- 页面标题 ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 18px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: 0 12px 28px -22px rgba(15, 23, 42, .35); padding: 18px; margin-bottom: 18px; }
.card h3 { margin: 0 0 14px; font-size: 15px; }
.card-note { color: var(--muted); font-size: 12.5px; margin: -8px 0 14px; }
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: #fff; border-radius: var(--radius); padding: 16px 18px; box-shadow: 0 12px 28px -22px rgba(15, 23, 42, .35); }
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 6px; }
.stat .value small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 6px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.table th, table.table td { padding: 11px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.table th { color: var(--muted); font-size: 12.5px; font-weight: 600; background: #fafbfe; white-space: nowrap; }
table.table tr:hover td { background: #fbfcff; }
table.table td.nowrap, table.table th.nowrap { white-space: nowrap; }
table.table .ops { white-space: nowrap; }
table.table .ops a, table.table .ops button { margin-right: 8px; font-size: 13px; }
.thumb { width: 46px; height: 34px; object-fit: cover; border-radius: 8px; background: #eef2f8; display: block; }
.thumb-empty { color: #c3cad6; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12.5px; font-weight: 600; color: #475569; margin-bottom: 6px; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 5px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=file], select, textarea {
    width: 100%; padding: 9px 11px; border: 1px solid #dbe1ec; border-radius: 10px;
    font-size: 13.5px; font-family: inherit; color: var(--text); background: #fbfcfe;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #8aa6ff; background: #fff; box-shadow: 0 0 0 3px rgba(59, 108, 246, .12); }
textarea { min-height: 130px; line-height: 1.7; resize: vertical; }
textarea.short { min-height: 74px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.grid2 .full, .grid3 .full { grid-column: 1 / -1; }
@media (max-width: 860px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin: 10px 0; }
.checkbox input { width: 16px; height: 16px; margin: 0; }
.inline-choices { display: flex; gap: 18px; flex-wrap: wrap; padding: 4px 0; }
.inline-choices label { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 400; color: var(--text); }
.inline-choices input { width: 15px; height: 15px; }
.form-actions { display: flex; gap: 10px; align-items: center; padding-top: 16px; border-top: 1px solid var(--line); margin-top: 6px; flex-wrap: wrap; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 18px; border: none; border-radius: 10px; font-size: 13.5px; font-weight: 600;
    font-family: inherit; cursor: pointer; background: linear-gradient(135deg, #4f7cff, #7c6cff); color: #fff;
    box-shadow: 0 10px 20px -14px rgba(79, 124, 255, 1);
}
.btn:hover { opacity: .94; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.btn-ghost { background: #f1f4fa; color: #475569; box-shadow: none; }
.btn-danger { background: linear-gradient(135deg, #f97316, #ef4444); box-shadow: none; }
.btn-plain { background: none; border: none; color: var(--primary); padding: 0; font-size: 13px; cursor: pointer; font-family: inherit; }
.btn-plain.danger, a.danger-link { color: var(--red); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- 徽标 / 提示 ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.badge-green { background: #e7f6ee; color: #16794a; }
.badge-gray { background: #eef1f6; color: #64748b; }
.badge-orange { background: #fff5e5; color: #a16207; }
.badge-red { background: #fdeaea; color: #b91c1c; }
.badge-blue { background: #eaf0ff; color: #2f4dad; }
.alert { padding: 11px 14px; border-radius: 11px; font-size: 13.5px; margin-bottom: 14px; }
.alert-success { background: #e9f7f0; color: #15724a; }
.alert-error { background: #fdecec; color: #b91c1c; }
.alert-warn { background: #fff7e8; color: #9a6100; }
.alert-info { background: #eef3ff; color: #2f4dad; }
.empty { text-align: center; color: var(--muted); padding: 34px 0; font-size: 13.5px; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; gap: 8px; padding: 14px 4px 4px; flex-wrap: wrap; }
.pager-info { color: var(--muted); font-size: 12.5px; margin-right: 6px; }
.pager-btn { padding: 5px 11px; border-radius: 8px; background: #fff; border: 1px solid var(--line); font-size: 13px; color: #475569; }
.pager-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- 筛选条 ---------- */
.filter { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.filter .field { margin-bottom: 0; min-width: 150px; }
.filter .field.grow { flex: 1; min-width: 220px; }

/* ---------- 登录页 ---------- */
.auth-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: #0f172a;
    background-image: radial-gradient(900px 400px at 50% -80px, #2b3f7a 0%, rgba(15, 23, 42, 0) 70%);
    padding: 30px 16px;
}
.auth-wrap { width: 100%; max-width: 420px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; color: #fff; }
.auth-brand h1 { margin: 0; font-size: 18px; }
.auth-brand p { margin: 2px 0 0; font-size: 12.5px; color: #94a3b8; }
.auth-card { padding: 26px; margin-bottom: 14px; }
.auth-card h2 { margin: 0 0 4px; font-size: 17px; }
.auth-card .sub { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.auth-tip { color: #7c8798; font-size: 12px; text-align: center; line-height: 1.7; }
.auth-tip code { background: rgba(255, 255, 255, .08); color: #cbd5e1; }

/* ---------- 代码块 ---------- */
pre.code {
    background: #0f172a; color: #dbe4f0; padding: 14px; border-radius: 12px;
    font-size: 12.5px; overflow-x: auto; line-height: 1.7; margin: 0;
}
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 7px 14px; border-radius: 9px; background: #eef1f6; color: #475569; font-size: 13px; }
.tabs a.active { background: var(--primary); color: #fff; }
.kv { font-size: 13.5px; }
.kv > div { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.kv > div:last-child { border-bottom: none; }
.kv b { flex: none; width: 118px; color: var(--muted); font-weight: 600; }
.kv span { word-break: break-all; }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }

/* ---------- 素材库 ---------- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 14px; }
.media-card { position: relative; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.media-card:hover { border-color: #b9ccff; }
.media-check { position: absolute; top: 6px; left: 6px; z-index: 2; background: rgba(255, 255, 255, .9); border-radius: 6px; padding: 2px 5px; }
.media-check input { width: 15px; height: 15px; margin: 0; display: block; }
.media-thumb {
    height: 116px; display: flex; align-items: center; justify-content: center;
    background: #f4f6fb; overflow: hidden;
}
.media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-video { color: #94a3b8; font-size: 13px; }
.media-meta { padding: 9px 10px 10px; }
.media-name { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-info { color: #98a1b0; font-size: 11.5px; margin-top: 2px; }
.media-ops { display: flex; gap: 10px; margin-top: 7px; font-size: 12.5px; }
.media-ops .btn-plain { font-size: 12.5px; }
label.btn { cursor: pointer; }
