/* =========================================================
   导航页 · 后台样式
   ========================================================= */

:root {
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

html[data-theme="dark"] {
  --bg: #070a12;
  --panel: rgba(255, 255, 255, .042);
  --panel-2: rgba(255, 255, 255, .07);
  --stroke: rgba(255, 255, 255, .085);
  --stroke-hi: rgba(255, 255, 255, .2);
  --text: #eef1f8;
  --text-2: #aab3c9;
  --muted: #737d95;
  --accent: #7c9cff;
  --accent-2: #a78bfa;
  --glow: rgba(124, 156, 255, .32);
  --ok: #4ade80;
  --err: #ff8b8b;
  --warn: #ffd894;
  --shadow: 0 24px 60px -40px #000;
  --input-bg: rgba(255, 255, 255, .045);
  --ico-bg: rgba(255, 255, 255, .92);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC",
    "HarmonyOS Sans SC", "MiSans", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; border: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.aurora-a {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(52vmax 52vmax at 6% -8%, rgba(79, 99, 255, .2), transparent 62%),
    radial-gradient(44vmax 44vmax at 100% 4%, rgba(168, 85, 247, .15), transparent 60%);
}

/* ---------- 骨架 ---------- */
.shell {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100dvh;
}

.side {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  width: 224px;
  flex: 0 0 224px;
  height: 100dvh;
  padding: 20px 14px;
  border-right: 1px solid var(--stroke);
  background: rgba(9, 13, 23, .55);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 20px; }

.side-brand .mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 11px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 8px 20px -10px var(--glow), inset 0 1px 0 rgba(255, 255, 255, .3);
}

.side-brand-t { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.side-brand-t b {
  font-size: 13.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-brand-t i { font-style: normal; font-size: 9px; letter-spacing: .16em; color: var(--muted); margin-top: 4px; }

.side-nav { display: flex; flex-direction: column; gap: 3px; }

.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  color: var(--text-2);
  font-size: 13.2px;
  transition: background .22s, color .22s;
}

.side-nav a svg { width: 17px; height: 17px; opacity: .8; }
.side-nav a:hover { background: var(--panel-2); color: var(--text); }
.side-nav a.is-on {
  background: linear-gradient(100deg, rgba(124, 156, 255, .22), rgba(167, 139, 250, .12));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(124, 156, 255, .28);
}
.side-nav a.is-on svg { opacity: 1; }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; padding-top: 14px; border-top: 1px solid var(--stroke); }
.side-foot a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border-radius: 9px;
  font-size: 12.5px;
  color: var(--muted);
  transition: color .2s, background .2s;
}
.side-foot a svg { width: 15px; height: 15px; }
.side-foot a:hover { color: var(--text); background: var(--panel-2); }
.side-foot a.quit:hover { color: var(--err); }

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

.topbar-a {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 58px;
  padding: 0 20px;
  border-bottom: 1px solid var(--stroke);
  background: rgba(7, 10, 18, .7);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.topbar-a h1 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: .01em; }

.who { margin-left: auto; font-size: 12px; color: var(--muted); }
.who span {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--panel);
}

.burger { display: none; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--stroke); color: var(--text-2); }
.burger svg { width: 18px; height: 18px; margin: 0 auto; }

.content { padding: 20px; flex: 1; max-width: 1080px; width: 100%; }

/* ---------- 提示条 ---------- */
.flash {
  margin-bottom: 14px;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  font-size: 12.8px;
  line-height: 1.65;
  border: 1px solid transparent;
}
.flash ul { margin: 0; padding-left: 18px; }
.flash-ok { background: rgba(74, 222, 128, .1); border-color: rgba(74, 222, 128, .28); color: #a7f3c4; }
.flash-err { background: rgba(255, 90, 90, .1); border-color: rgba(255, 90, 90, .28); color: #ffb4b4; }

/* ---------- 数据卡 ---------- */
.stats {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  margin-bottom: 16px;
}

.stat {
  padding: 14px 15px;
  border-radius: var(--r-md);
  border: 1px solid var(--stroke);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.stat span { display: block; font-size: 11.5px; color: var(--muted); letter-spacing: .02em; }
.stat b {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.stat b.sm { font-size: 13.5px; font-weight: 600; letter-spacing: 0; word-break: break-all; }

/* ---------- 面板 ---------- */
.panel {
  margin-bottom: 16px;
  padding: 16px;
  border-radius: var(--r-lg);
  border: 1px solid var(--stroke);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.panel-title h2 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-title p { margin: 5px 0 0; font-size: 12px; color: var(--muted); line-height: 1.7; max-width: 60ch; }
.panel-title .count {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 1px 7px;
}

/* ---------- 按钮 ---------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: 10px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 12px 26px -16px var(--glow);
  transition: transform .2s, filter .2s;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { transform: scale(.97); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: var(--panel-2);
  color: var(--text-2);
  font-size: 13px;
  white-space: nowrap;
  transition: color .2s, border-color .2s;
}
.btn-ghost:hover { color: var(--text); border-color: var(--stroke-hi); }

/* ---------- 筛选栏 ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.search-a {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 11px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: var(--input-bg);
  min-width: 220px;
}
.search-a svg { width: 15px; height: 15px; color: var(--muted); flex: 0 0 15px; }
.search-a input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.search-a input::placeholder { color: var(--muted); }

input[type="text"], input[type="password"], input[type="number"], input[type="search"], select {
  height: 36px;
  padding: 0 11px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

select { padding-right: 26px; appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

input:focus, select:focus { border-color: rgba(124, 156, 255, .55); box-shadow: 0 0 0 3px rgba(124, 156, 255, .14); }

/* ---------- 列表 ---------- */
.table { display: flex; flex-direction: column; }

.thead, .tr {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) 88px 54px 74px 132px;
  align-items: center;
  gap: 10px;
}

.thead {
  padding: 0 10px 8px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .04em;
  border-bottom: 1px solid var(--stroke);
}

.tr {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, .04);
  border-radius: 10px;
  transition: background .18s;
}
.tr:hover { background: var(--panel-2); }
.tr.is-off { opacity: .5; }

.c-sort { display: flex; gap: 4px; }
.c-site { display: flex; align-items: center; gap: 10px; min-width: 0; }

.ico-s {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 9px;
  background: var(--ico-bg);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(127, 140, 170, .16);
}
.ico-s img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }
.ico-s img.is-broken { display: none; }
.ico-s i {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-style: normal;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
}

.meta { min-width: 0; display: flex; flex-direction: column; }
.meta b {
  font-size: 13.2px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.meta a {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .2s;
}
.meta a:hover { color: var(--accent); }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--input-bg);
  font-size: 11px;
  color: var(--text-2);
  white-space: nowrap;
}
.tag-pin {
  font-style: normal;
  font-size: 10px;
  padding: 0 5px;
  border-radius: 4px;
  color: #ffd894;
  background: rgba(255, 196, 84, .14);
  border: 1px solid rgba(255, 196, 84, .3);
}

.c-hits { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: center; }

.c-state { display: flex; align-items: center; gap: 6px; }

.switch {
  position: relative;
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  border: 1px solid var(--stroke);
  transition: background .22s;
}
.switch span {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  transition: transform .22s var(--ease);
}
.switch.on { background: rgba(74, 222, 128, .85); border-color: transparent; }
.switch.on span { transform: translateX(14px); }

.pinbtn {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  border: 1px solid transparent;
  transition: color .2s, background .2s;
}
.pinbtn:hover { background: var(--panel-2); color: var(--text); }
.pinbtn.on { color: #ffd894; background: rgba(255, 196, 84, .12); border-color: rgba(255, 196, 84, .28); }

.c-act { display: flex; gap: 6px; justify-content: flex-end; }

.mini {
  height: 24px;
  min-width: 24px;
  padding: 0 6px;
  border-radius: 7px;
  border: 1px solid var(--stroke);
  background: var(--panel-2);
  color: var(--text-2);
  font-size: 11.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color .18s, border-color .18s, background .18s;
}
.mini:hover { color: var(--text); border-color: var(--stroke-hi); }
.mini.wide { padding: 0 10px; }
.mini.danger:hover { color: #ffb4b4; border-color: rgba(255, 90, 90, .45); background: rgba(255, 90, 90, .1); }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  font-size: 12px;
  color: var(--muted);
}
.pager a {
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: var(--panel-2);
  color: var(--text-2);
}
.pager a:hover { border-color: var(--stroke-hi); color: var(--text); }

.blank { padding: 42px 16px; text-align: center; color: var(--muted); }
.blank p { margin: 0 0 4px; font-size: 14px; color: var(--text-2); font-weight: 600; }
.blank span { font-size: 12px; }

.note { margin: 12px 0 0; font-size: 12px; color: var(--muted); }
.note a { color: var(--accent); }

/* ---------- 表单 ---------- */
.panel-form { padding-bottom: 20px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.span2 { grid-column: 1 / -1; }

.field label { font-size: 12.2px; color: var(--text-2); }
.field label em { font-style: normal; color: var(--err); }
.field input[type="text"], .field input[type="password"], .field select { height: 40px; font-size: 13.5px; }
.hint { font-size: 11.3px; color: var(--muted); }

.checkline { display: flex; gap: 18px; flex-wrap: wrap; padding: 4px 0; }

.ck { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.ck input { accent-color: #7c9cff; width: 15px; height: 15px; }
.ck.tight { font-size: 12px; color: var(--muted); }

.form-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 4px; }

/* ---------- 分类管理 ---------- */
.inline-add { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-add input[type="text"] { flex: 1; min-width: 180px; height: 38px; }
.inline-add input.narrow { flex: 0 0 150px; }
.inline-add .btn-primary { height: 38px; }

.catlist { display: flex; flex-direction: column; gap: 8px; }

.catrow {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, .02);
}

.ico-cat {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--input-bg);
  border: 1px solid var(--stroke);
  font-size: 15px;
}
.catrow input[type="text"] { flex: 1; min-width: 120px; }
.catrow input.narrow { flex: 0 0 90px; }
.catrow input.tiny { flex: 0 0 64px; text-align: center; font-size: 12px; }

.badge { font-size: 11px; color: var(--muted); white-space: nowrap; }
.row-acts { display: flex; gap: 5px; margin-left: auto; }

/* ---------- 登录页 ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px 18px;
}

.login-wrap { position: relative; z-index: 1; width: 100%; max-width: 400px; }

.login-card {
  padding: 26px 22px;
  border-radius: 22px;
  border: 1px solid var(--stroke);
  background: rgba(12, 17, 31, .74);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: 0 50px 100px -60px #000;
}

.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.mark.lg {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 13px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 12px 26px -14px var(--glow);
}
.login-brand h1 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.login-brand p { margin: 3px 0 0; font-size: 11.5px; color: var(--muted); }

.login-card label { display: block; font-size: 12px; color: var(--text-2); margin: 14px 0 6px; }
.login-card input { width: 100%; height: 42px; font-size: 14px; }
.login-card .btn-primary { width: 100%; height: 44px; margin-top: 20px; font-size: 14px; letter-spacing: .1em; }

.login-foot { margin: 16px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
.login-foot a:hover { color: var(--accent); }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .side {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 80;
    height: 100dvh;
    transform: translateX(-102%);
    transition: transform .3s var(--ease);
    background: rgba(9, 13, 23, .96);
    box-shadow: 20px 0 60px -30px #000;
  }
  .side.is-open { transform: none; }
  .burger { display: grid; place-items: center; }
  .scrim {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(3, 6, 12, .6);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
  }
  .scrim[hidden] { display: none; }
  .content { padding: 14px; }
  .topbar-a { padding: 0 14px; }
  .who { display: none; }
}

@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }

  /* 筛选栏在手机上占满整行，避免搜索框被挤扁 */
  .filters { width: 100%; }
  .search-a { flex: 1 1 100%; min-width: 0; }
  .filters select { flex: 1 1 auto; min-width: 0; }
  .inline-add input[type="text"] { flex: 1 1 100%; }
  .inline-add input.narrow { flex: 1 1 40%; }

  .thead { display: none; }
  .table { gap: 10px; }
  .tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 10px;
    padding: 12px;
    border: 1px solid var(--stroke);
    border-radius: var(--r-md);
    background: rgba(255, 255, 255, .02);
  }
  .tr:hover { background: rgba(255, 255, 255, .03); }
  .c-sort { grid-column: 2; grid-row: 1; justify-self: end; }
  .c-site { grid-column: 1; grid-row: 1; }
  .c-cat { grid-column: 1; grid-row: 2; }
  .c-hits { display: none; }
  .c-state { grid-column: 2; grid-row: 2; justify-self: end; }
  .c-act { grid-column: 1 / -1; grid-row: 3; justify-content: flex-start; }
  .c-act .mini { height: 28px; padding: 0 12px; }

  .catrow { gap: 7px; }
  .catrow input[type="text"] { flex: 1 1 100%; order: 2; }
  .catrow input.narrow { flex: 1 1 auto; order: 3; }
  .catrow input.tiny { flex: 0 0 64px; order: 4; }
  .ico-cat { order: 1; }
  .badge { order: 5; }
  .ck.tight { order: 6; }
  .row-acts { order: 7; flex: 1 1 100%; margin-left: 0; }
  .row-acts .mini { flex: 1; height: 30px; }
}
