/* ============ 领袖演说 · 内容管理后台 ============ */
:root {
  --ink: #0d1a2b;
  --ink-2: #13253c;
  --gold: #c9a35c;
  --gold-dark: #a5813f;
  --bg: #f4f6f9;
  --card: #ffffff;
  --line: #e3e8ef;
  --text: #2b3648;
  --muted: #7a8798;
  --red: #d0453e;
  --green: #1f9d63;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--sans); background: var(--bg); color: var(--text); font-size: 15px; -webkit-font-smoothing: antialiased; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); width: 100%; transition: border-color .2s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); }
label { display: block; font-size: 13px; font-weight: 600; color: #4a586e; margin: 14px 0 6px; }
textarea { resize: vertical; }
.muted { color: var(--muted); font-size: 13px; font-weight: 400; }
.req { color: var(--red); }
[hidden] { display: none !important; }

/* ---------- 登录 ---------- */
.login-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0d1a2b 0%, #1b3355 100%); padding: 20px; }
.login-box { width: min(420px, 100%); background: #fff; border-radius: 16px; padding: 40px 36px; box-shadow: 0 24px 70px rgba(0,0,0,.35); }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.login-brand h1 { font-size: 24px; letter-spacing: 3px; }
.login-brand p { color: var(--muted); font-size: 13px; letter-spacing: 2px; margin-top: 2px; }
.login-form label { margin-top: 16px; }
.login-err { color: var(--red); font-size: 13px; margin: 10px 0 0; }
.setup-tip { background: #fdf6e7; border: 1px solid #ecd9a8; color: #8a6a1f; font-size: 13px; padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; }
.btn-primary { background: linear-gradient(135deg, #d9b878, var(--gold) 55%, var(--gold-dark)); color: #1c2c44; border: none; font-weight: 700; letter-spacing: 2px; padding: 11px 26px; border-radius: 8px; font-size: 15px; width: 100%; margin-top: 18px; transition: filter .2s, transform .1s; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { transform: scale(.98); }
.btn-primary.btn-lg { width: auto; padding: 13px 42px; }
.btn-ghost-sm { background: #fff; border: 1px solid var(--line); color: #4a586e; padding: 8px 16px; border-radius: 8px; font-size: 13.5px; transition: border-color .2s, color .2s; }
.btn-ghost-sm:hover { border-color: var(--gold); color: var(--gold-dark); }
.btn-mini { background: #eef2f7; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; padding: 3px 10px; margin-left: 10px; color: #4a586e; }
.btn-mini:hover { border-color: var(--gold); color: var(--gold-dark); }
.login-foot { margin-top: 22px; text-align: center; font-size: 13px; }
.login-foot a { color: var(--muted); }
.login-foot a:hover { color: var(--gold-dark); }

/* ---------- 主框架 ---------- */
.admin { display: flex; min-height: 100vh; }
.sidebar { width: 216px; flex: none; background: var(--ink); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px; font-size: 18px; letter-spacing: 3px; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,.1); }
.side-nav { flex: 1; padding: 14px 10px; display: flex; flex-direction: column; gap: 4px; }
.side-btn { background: none; border: none; color: rgba(255,255,255,.75); text-align: left; padding: 11px 14px; border-radius: 8px; font-size: 14.5px; transition: background .2s, color .2s; }
.side-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.side-btn.active { background: rgba(201,163,92,.18); color: var(--gold); font-weight: 600; }
.sidebar-foot { padding: 14px 10px; border-top: 1px solid rgba(255,255,255,.1); display: flex; flex-direction: column; gap: 4px; }
.sidebar-foot a, .sidebar-foot button { background: none; border: none; color: rgba(255,255,255,.6); text-align: left; padding: 9px 14px; border-radius: 8px; font-size: 13.5px; text-decoration: none; }
.sidebar-foot a:hover, .sidebar-foot button:hover { background: rgba(255,255,255,.08); color: #fff; }
.main { flex: 1; min-width: 0; padding: 26px 32px 60px; }
.main-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.main-header h2 { font-size: 22px; letter-spacing: 1px; }
.header-actions { display: flex; align-items: center; gap: 14px; }
.save-state { font-size: 12.5px; color: var(--green); }
.save-state.saving { color: var(--muted); }

/* ---------- Tab ---------- */
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.pane-tip { margin-bottom: 18px; }

/* ---------- 内容管理 ---------- */
.content-layout { display: grid; grid-template-columns: 190px 1fr; gap: 22px; align-items: start; }
.sec-tree { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; position: sticky; top: 20px; }
.sec-tree h3 { font-size: 13px; color: var(--muted); letter-spacing: 2px; margin-bottom: 10px; }
.sec-tree ul { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.sec-tree li button { width: 100%; background: none; border: none; text-align: left; padding: 9px 12px; border-radius: 8px; font-size: 14px; color: var(--text); display: flex; justify-content: space-between; align-items: center; }
.sec-tree li button:hover { background: #f2f5f9; }
.sec-tree li button.active { background: rgba(201,163,92,.14); color: var(--gold-dark); font-weight: 700; }
.sec-tree .cnt { font-size: 12px; color: var(--muted); background: #eef2f7; border-radius: 999px; padding: 1px 8px; }
.item-area { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px; min-height: 400px; }
.item-area-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; gap: 12px; }
.item-area-head h3 { font-size: 17px; }
.item-area-head .btn-primary { width: auto; margin-top: 0; padding: 9px 20px; font-size: 14px; }
.item-list { display: flex; flex-direction: column; gap: 10px; }
.item-row { display: flex; align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: #fff; transition: border-color .2s, box-shadow .2s; }
.item-row:hover { border-color: #d5c39a; box-shadow: 0 4px 16px rgba(13,26,43,.06); }
.item-row.off { opacity: .55; }
.item-thumb { width: 84px; height: 60px; border-radius: 6px; object-fit: cover; flex: none; background: #eef2f7; }
.item-meta { flex: 1; min-width: 0; }
.item-meta h4 { font-size: 15px; margin-bottom: 2px; }
.item-meta p { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-ops { display: flex; gap: 6px; flex: none; }
.item-ops button { border: 1px solid var(--line); background: #fff; border-radius: 6px; font-size: 12.5px; padding: 5px 10px; color: #4a586e; }
.item-ops button:hover { border-color: var(--gold); color: var(--gold-dark); }
.item-ops button.danger:hover { border-color: var(--red); color: var(--red); }
.empty-tip { text-align: center; color: var(--muted); padding: 60px 0; font-size: 14px; }

/* ---------- 表单卡片 ---------- */
.form-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 22px 24px; margin-bottom: 18px; }
.form-card h3 { font-size: 16px; margin-bottom: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.ck-line { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-top: 16px; }
.ck-line input { width: auto; }
.save-bar { position: sticky; bottom: 0; background: linear-gradient(180deg, transparent, var(--bg) 40%); padding: 18px 0 6px; text-align: right; }

/* ---------- 栏目管理 ---------- */
.sec-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px 24px; margin-bottom: 14px; }
.sec-card h3 { font-size: 16px; display: flex; align-items: center; gap: 10px; }
.sec-card h3 .tag { font-size: 11px; background: #eef2f7; color: var(--muted); border-radius: 4px; padding: 2px 8px; font-weight: 400; }

/* ---------- 视频管理 ---------- */
.video-row { display: flex; gap: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; align-items: flex-start; }
.video-row img { width: 150px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; flex: none; background: #eef2f7; }
.video-row .vr-meta { flex: 1; min-width: 0; }
.video-row h4 { font-size: 15px; margin-bottom: 2px; }
.video-row .vr-sub { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.video-row .vr-line { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.video-row .vr-line input { flex: 1; min-width: 220px; }
.vtype-badge { font-size: 11px; border-radius: 4px; padding: 2px 8px; background: rgba(201,163,92,.15); color: var(--gold-dark); }
.vtype-badge.none { background: #eef2f7; color: var(--muted); }
.upload-progress { height: 4px; background: #eef2f7; border-radius: 2px; overflow: hidden; margin-top: 8px; display: none; }
.upload-progress.show { display: block; }
.upload-progress i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .2s; }

/* ---------- 图片管理 ---------- */
.img-upload-zone { border: 2px dashed #cdd6e2; border-radius: 12px; padding: 34px; text-align: center; background: #fff; cursor: pointer; transition: border-color .2s, background .2s; margin-bottom: 20px; }
.img-upload-zone:hover, .img-upload-zone.drag { border-color: var(--gold); background: #fdfaf3; }
.img-upload-zone p:first-child { font-size: 15px; font-weight: 600; }
.img-lib-title { font-size: 15px; margin: 18px 0 12px; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.img-cell { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.img-cell img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.img-cell .img-name { font-size: 11.5px; color: var(--muted); padding: 6px 8px; word-break: break-all; line-height: 1.4; }
.img-cell .img-ops { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .2s; }
.img-cell:hover .img-ops { opacity: 1; }
.img-cell .img-ops button { border: none; border-radius: 6px; font-size: 12px; padding: 4px 9px; background: rgba(13,26,43,.8); color: #fff; }
.img-cell .img-ops button.del { background: rgba(208,69,62,.9); }

/* ---------- 条目编辑弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 22px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8,15,26,.6); backdrop-filter: blur(3px); }
.modal-box { position: relative; background: #fff; border-radius: 14px; width: min(640px, 100%); max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 30px 90px rgba(0,0,0,.35); }
.modal-box.modal-lg { width: min(780px, 100%); }
.modal-box.modal-sm { width: min(420px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 17px; }
.modal-close { border: none; background: #f2f5f9; border-radius: 8px; width: 32px; height: 32px; font-size: 14px; color: #4a586e; }
.modal-close:hover { background: #e6ebf1; }
.modal-body { padding: 20px 24px; overflow-y: auto; }
.modal-foot { padding: 14px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.modal-foot .btn-primary { width: auto; margin-top: 0; }
.blk-title { font-size: 15px; margin: 22px 0 10px; padding-top: 16px; border-top: 1px dashed var(--line); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-row { display: flex; gap: 18px; flex-wrap: wrap; margin: 8px 0 4px; }
.radio-row label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; font-size: 14px; }
.radio-row input { width: auto; }
.img-edit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 10px; }
.img-edit-cell { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.img-edit-cell img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.img-edit-cell .iec-ops { display: flex; border-top: 1px solid var(--line); }
.img-edit-cell .iec-ops button { flex: 1; border: none; background: #fff; font-size: 12px; padding: 6px 0; color: #4a586e; }
.img-edit-cell .iec-ops button:hover { background: #f6f8fb; }
.img-edit-cell .iec-ops button.del { color: var(--red); }
.img-edit-cell .cover-flag { position: absolute; top: 6px; left: 6px; background: var(--gold); color: #1c2c44; font-size: 11px; font-weight: 700; border-radius: 4px; padding: 2px 8px; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 36px; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 14px; padding: 12px 26px; border-radius: 999px; box-shadow: 0 12px 40px rgba(0,0,0,.3); z-index: 200; animation: toastIn .25s ease; }
.toast.err { background: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .admin { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar-brand { border: none; padding: 12px 16px; }
  .side-nav { flex-direction: row; flex-wrap: wrap; padding: 8px; }
  .sidebar-foot { flex-direction: row; border: none; padding: 8px; }
  .main { padding: 18px 16px 50px; }
  .content-layout { grid-template-columns: 1fr; }
  .sec-tree { position: static; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .video-row { flex-direction: column; }
  .video-row img { width: 100%; }
}
