/* ============================================================
   Luna 影视 · 管理后台样式
   ============================================================ */
:root {
  --bg: #070911;
  --panel: rgba(255, 255, 255, .04);
  --panel-2: rgba(255, 255, 255, .07);
  --line: rgba(255, 255, 255, .09);
  --line-2: rgba(255, 255, 255, .16);
  --text: #eaeefb;
  --dim: #98a0b8;
  --mute: #6a7290;
  --brand: #7c5cff;
  --brand-2: #21d4fd;
  --accent: linear-gradient(120deg, #7c5cff, #21d4fd);
  --ok: #24d17e;
  --danger: #ff5d6c;
  --warn: #ffb020;
  --r: 14px;
  --side-w: 232px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1;
  background: radial-gradient(900px 520px at 8% -10%, rgba(124, 92, 255, .24), transparent 60%),
              radial-gradient(800px 480px at 96% 0%, rgba(33, 212, 253, .14), transparent 62%);
}
a { color: inherit; text-decoration: none; cursor: pointer; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 8px; }

/* ---------------- 登录 ---------------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card {
  width: 100%; max-width: 380px; padding: 34px 30px; border-radius: 20px;
  background: rgba(16, 20, 34, .88); border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6); backdrop-filter: blur(16px); text-align: center;
}
.login-logo { width: 58px; height: 58px; margin: 0 auto 14px; border-radius: 18px; display: grid; place-items: center; font-size: 28px; background: var(--accent); box-shadow: 0 10px 30px rgba(124, 92, 255, .4); }
.login-card h1 { margin: 0 0 6px; font-size: 20px; }
.muted { color: var(--mute); font-size: 13px; margin: 0 0 20px; }
.login-card input {
  width: 100%; height: 44px; margin-bottom: 12px; padding: 0 14px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line); color: var(--text); font-size: 14px; outline: none;
}
.login-card input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(124, 92, 255, .15); }
.login-card button {
  width: 100%; height: 44px; border: none; border-radius: 12px; background: var(--accent);
  color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; box-shadow: 0 10px 26px rgba(124, 92, 255, .35);
}
.login-card button:hover { filter: brightness(1.08); }
.login-msg { min-height: 20px; margin-top: 12px; font-size: 13px; color: var(--danger); }
.back-link { display: block; margin-top: 10px; font-size: 12.5px; color: var(--mute); }

/* ---------------- 布局 ---------------- */
.admin { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--side-w); flex-shrink: 0; position: fixed; inset: 0 auto 0 0; z-index: 40;
  background: rgba(11, 14, 24, .92); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; backdrop-filter: blur(14px);
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px; border-bottom: 1px solid var(--line); }
.side-brand .logo { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; background: var(--accent); }
.side-brand b { display: block; font-size: 15px; }
.side-brand i { font-style: normal; font-size: 11px; color: var(--mute); }
.side-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.side-nav a {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 11px;
  color: var(--dim); font-size: 14px; margin-bottom: 3px; transition: .16s;
}
.side-nav a:hover { background: var(--panel); color: var(--text); }
.side-nav a.on { background: var(--accent); color: #fff; box-shadow: 0 6px 18px rgba(124, 92, 255, .3); }
.side-foot { padding: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.side-foot a, .side-foot button {
  text-align: center; padding: 9px; border-radius: 10px; font-size: 13px;
  background: var(--panel); border: 1px solid var(--line); color: var(--dim); cursor: pointer;
}
.side-foot a:hover, .side-foot button:hover { color: var(--text); background: var(--panel-2); }

.main { flex: 1; margin-left: var(--side-w); min-width: 0; display: flex; flex-direction: column; }
.main-head {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  height: 62px; padding: 0 22px; border-bottom: 1px solid var(--line);
  background: rgba(7, 9, 17, .86); backdrop-filter: blur(14px);
}
.main-head h2 { margin: 0; font-size: 17px; flex: 1; }
.head-right { display: flex; align-items: center; gap: 10px; }
.drawer { display: none; background: none; border: none; color: var(--text); font-size: 20px; }
.badge-kv { font-size: 11.5px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--mute); }
.badge-kv.ok { color: var(--ok); border-color: rgba(36, 209, 126, .35); }
.badge-kv.bad { color: var(--warn); border-color: rgba(255, 176, 32, .35); }
.content { padding: 22px; max-width: 1280px; width: 100%; }

/* ---------------- 通用组件 ---------------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 16px; }
.card h3 { margin: 0 0 4px; font-size: 15px; }
.card .hint { color: var(--mute); font-size: 12.5px; margin: 0 0 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }

.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.stat .n { font-size: 26px; font-weight: 700; background: var(--accent); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat .l { font-size: 12.5px; color: var(--mute); margin-top: 2px; }

label.f { display: block; margin-bottom: 13px; }
label.f > span { display: block; font-size: 12.5px; color: var(--dim); margin-bottom: 6px; }
input[type=text], input[type=number], input[type=password], textarea, select {
  width: 100%; padding: 9px 12px; border-radius: 10px; background: var(--panel);
  border: 1px solid var(--line); color: var(--text); font-size: 13.5px; outline: none; font-family: inherit;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(124, 92, 255, .14); }
textarea { min-height: 92px; resize: vertical; line-height: 1.6; }
select option { background: #12162a; }
.switch { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.switch:last-child { border-bottom: none; }
.switch span { flex: 1; font-size: 13.5px; }
.switch small { display: block; color: var(--mute); font-size: 11.5px; }
.tg { position: relative; width: 44px; height: 24px; border-radius: 999px; background: rgba(255, 255, 255, .16); border: none; cursor: pointer; transition: .2s; flex-shrink: 0; }
.tg::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .2s; }
.tg.on { background: var(--accent); }
.tg.on::after { transform: translateX(20px); }

.btn { padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text); font-size: 13px; transition: .16s; }
.btn:hover { background: var(--panel-2); }
.btn-primary { background: var(--accent); border: none; color: #fff; font-weight: 600; padding: 9px 20px; }
.btn-ghost { background: var(--panel); border: 1px solid var(--line); color: var(--dim); }
.btn-ghost:hover { color: var(--text); }
.btn-danger { background: rgba(255, 93, 108, .16); border: 1px solid rgba(255, 93, 108, .35); color: #ff8f99; }
.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 8px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* 表格 */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: rgba(255, 255, 255, .04); color: var(--dim); font-weight: 600; font-size: 12.5px; position: sticky; top: 0; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255, 255, 255, .028); }
td .mono { font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; color: var(--mute); word-break: break-all; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; }
.tag.on { background: rgba(36, 209, 126, .16); color: #4ce39b; }
.tag.off { background: rgba(255, 255, 255, .07); color: var(--mute); }
.tag.adult { background: rgba(255, 93, 108, .16); color: #ff8f99; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; background: rgba(124, 92, 255, .18); color: #b7a5ff; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type=text] { width: auto; flex: 1; min-width: 160px; max-width: 280px; }
.toolbar select { width: auto; }

/* 弹窗 */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .62); display: grid; place-items: center; padding: 18px; backdrop-filter: blur(4px); }
.modal-box { width: 100%; max-width: 520px; background: #10141f; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, .7); overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.modal-head button { background: none; border: none; color: var(--mute); font-size: 16px; cursor: pointer; }
.modal-body { padding: 18px; max-height: 62vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); }

.toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 300; background: rgba(20, 24, 40, .96); border: 1px solid var(--line); padding: 10px 20px; border-radius: 999px; font-size: 13.5px; box-shadow: 0 18px 50px rgba(0, 0, 0, .6); }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .16); border-top-color: var(--brand-2); animation: spin .8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-load { display: grid; place-items: center; padding: 50px; gap: 12px; color: var(--mute); }

/* 响应式 */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .26s; width: 250px; }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .drawer { display: block; }
  .content { padding: 16px 14px 60px; }
  .grid-2 { grid-template-columns: 1fr; }
}
