/* 声屿 SONORA · 管理后台样式 */
:root {
  --bg: #070c17;
  --panel: #0f1728;
  --panel-2: #131e33;
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #e9effc;
  --muted: #8b9ab6;
  --dim: #64748b;
  --accent: #4c8dff;
  --accent-2: #22d3c5;
  --ok: #2ed3a0;
  --warn: #f5b455;
  --danger: #ff6b7a;
  --radius: 16px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

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

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 8% -12%, rgba(76, 141, 255, 0.20), transparent 62%),
    radial-gradient(760px 480px at 96% -6%, rgba(34, 211, 197, 0.13), transparent 60%),
    radial-gradient(700px 700px at 60% 120%, rgba(76, 141, 255, 0.07), transparent 65%);
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; }
.grow { flex: 1; }
.nowrap { white-space: nowrap; }

/* ---------------- 登录 ---------------- */
.login-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  padding: 36px 34px 28px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(21, 32, 55, 0.94), rgba(10, 16, 29, 0.97));
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand.small { gap: 10px; padding: 0 6px; }
.brand-mark {
  width: 44px; height: 44px; flex: none;
  border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #4c8dff, #22d3c5);
  box-shadow: 0 10px 26px rgba(76, 141, 255, 0.35);
}
.brand.small .brand-mark { width: 38px; height: 38px; border-radius: 12px; }
.brand-name { font-weight: 700; letter-spacing: 0.4px; font-size: 16px; }
.brand-sub { font-size: 12px; color: var(--muted); letter-spacing: 2px; }
.login-form { margin-top: 30px; display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; font-size: 13px; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; }
.login-hint {
  margin-top: 20px; padding-top: 18px;
  border-top: 1px dashed var(--line);
  font-size: 12px; color: var(--dim); line-height: 1.9; text-align: center;
}
.login-hint b { color: var(--muted); font-weight: 600; }
.form-error {
  background: rgba(255, 107, 122, 0.1);
  border: 1px solid rgba(255, 107, 122, 0.35);
  color: #ffb3ba;
  padding: 9px 12px; border-radius: 10px; font-size: 13px;
}

/* ---------------- 表单控件 ---------------- */
input, select, textarea {
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input::placeholder, textarea::placeholder { color: #5c6b85; }
input:focus, select:focus, textarea:focus {
  border-color: rgba(76, 141, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(76, 141, 255, 0.16);
  background: rgba(76, 141, 255, 0.05);
}
textarea { resize: vertical; min-height: 84px; line-height: 1.65; }
select option { background: #111a2b; color: var(--text); }
input[type="checkbox"] {
  appearance: none;
  width: 18px; height: 18px; padding: 0; flex: none;
  border-radius: 6px; border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer; position: relative;
}
input[type="checkbox"]:checked {
  background: linear-gradient(135deg, #4c8dff, #22d3c5);
  border-color: transparent;
}
input[type="checkbox"]:checked::after {
  content: "";
  position: absolute; left: 5px; top: 2px;
  width: 5px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
input[type="datetime-local"] { color-scheme: dark; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 10px 18px;
  font: inherit; font-weight: 600; font-size: 13.5px;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #4c8dff, #3a74e8);
  box-shadow: 0 8px 22px rgba(76, 141, 255, 0.28);
  transition: transform 0.12s, box-shadow 0.15s, opacity 0.15s, background 0.15s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(76, 141, 255, 0.36); }
.btn:active { transform: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.ghost {
  background: rgba(255, 255, 255, 0.045);
  border-color: var(--line-strong);
  box-shadow: none; color: var(--text); font-weight: 500;
}
.btn.ghost:hover { background: rgba(255, 255, 255, 0.085); }
.btn.danger {
  background: rgba(255, 107, 122, 0.12);
  border-color: rgba(255, 107, 122, 0.35);
  color: #ff9aa4; box-shadow: none;
}
.btn.danger:hover { background: rgba(255, 107, 122, 0.2); }
.btn.sm { padding: 6px 12px; font-size: 12.5px; border-radius: 9px; }
.btn.block { width: 100%; padding: 12px; font-size: 14.5px; letter-spacing: 2px; }
.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 11px; cursor: pointer;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  color: var(--muted);
  transition: color 0.15s, background 0.15s;
}
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.icon-btn svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------- 布局 ---------------- */
.app {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 20px 14px 16px;
  border-right: 1px solid var(--line);
  background: rgba(8, 13, 24, 0.72);
  backdrop-filter: blur(16px);
}
.nav { margin-top: 24px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; flex: 1; }
.nav::-webkit-scrollbar { width: 0; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 13.5px;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
  user-select: none;
}
.nav-item svg {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, 0.045); }
.nav-item.active {
  color: #eef4ff;
  background: linear-gradient(90deg, rgba(76, 141, 255, 0.20), rgba(34, 211, 197, 0.07));
  border-color: rgba(76, 141, 255, 0.28);
  box-shadow: inset 0 0 24px rgba(76, 141, 255, 0.08);
}
.side-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 8px 4px;
  font-size: 12px; color: var(--dim);
  border-top: 1px solid var(--line);
}
.env-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(46, 211, 160, 0.12);
  animation: pulse 2.4s infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(46, 211, 160, 0.04); } }
.side-foot .ver { margin-left: auto; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 12, 23, 0.72);
  backdrop-filter: blur(16px);
}
.topbar-title h1 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: 0.3px; }
.topbar-title p { margin: 2px 0 0; font-size: 12.5px; color: var(--dim); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  font-size: 13px; color: var(--muted);
}
.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600; color: #08111f;
  background: linear-gradient(135deg, #8bb6ff, #22d3c5);
}
.content { padding: 26px 28px 64px; width: 100%; max-width: 1460px; margin: 0 auto; }

/* ---------------- 卡片 ---------------- */
.card {
  background: linear-gradient(180deg, rgba(19, 30, 51, 0.82), rgba(12, 19, 33, 0.9));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; }
.card-head .sub { font-size: 12px; color: var(--dim); }
.card-title { margin: 0 0 14px; font-size: 14.5px; font-weight: 600; }

.grid-2 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; }
.grid-2.even { grid-template-columns: 1fr 1fr; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.stack { display: flex; flex-direction: column; gap: 18px; }

/* ---------------- 统计卡 ---------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(186px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(19, 30, 51, 0.8), rgba(11, 17, 30, 0.9));
}
.stat::after {
  content: "";
  position: absolute; right: -30px; top: -40px;
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(76, 141, 255, 0.16), transparent 68%);
}
.stat .label { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.stat .label .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.stat .value {
  margin-top: 10px;
  font-size: 28px; font-weight: 650; letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
}
.stat .value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.stat .foot { margin-top: 6px; font-size: 12px; color: var(--dim); }
.stat.tone-2 .label .dot { background: var(--accent-2); }
.stat.tone-3 .label .dot { background: var(--ok); }
.stat.tone-4 .label .dot { background: var(--warn); }
.stat.tone-5 .label .dot { background: var(--danger); }

/* ---------------- 图表 ---------------- */
.chart-wrap { width: 100%; overflow: hidden; }
.chart-wrap svg { display: block; width: 100%; height: auto; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }

.bars { display: flex; flex-direction: column; gap: 13px; }
.bar-row { display: grid; grid-template-columns: 92px 1fr 52px; align-items: center; gap: 10px; font-size: 12.5px; }
.bar-row .name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .track { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.055); overflow: hidden; }
.bar-row .fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, rgba(76, 141, 255, 0.85), rgba(34, 211, 197, 0.85));
  transition: width 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.bar-row .val { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }

.top-book { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.top-book:last-child { border-bottom: 0; }
.rank {
  width: 22px; height: 22px; flex: none;
  display: grid; place-items: center;
  border-radius: 7px;
  font-size: 11.5px; font-weight: 700;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
}
.top-book:nth-child(1) .rank { color: #1a1206; background: linear-gradient(135deg, #ffd479, #f5a623); }
.top-book:nth-child(2) .rank { color: #0e1420; background: linear-gradient(135deg, #dbe6f7, #9fb3cd); }
.top-book:nth-child(3) .rank { color: #1a0f06; background: linear-gradient(135deg, #e6a97a, #c47a45); }
.top-book .tb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-book .tb-val { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-weight: 500;
  font-size: 11.5px; letter-spacing: 0.8px;
  color: var(--dim); text-transform: uppercase;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  vertical-align: middle;
}
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: rgba(255, 255, 255, 0.028); }
tbody tr:last-child td { border-bottom: 0; }
td .strong { font-weight: 600; }
td .sub { display: block; font-size: 11.5px; color: var(--dim); margin-top: 2px; }
.t-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.num { font-variant-numeric: tabular-nums; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.ok { color: #6fe9c4; background: rgba(46, 211, 160, 0.1); border-color: rgba(46, 211, 160, 0.24); }
.badge.warn { color: #ffcd85; background: rgba(245, 180, 85, 0.1); border-color: rgba(245, 180, 85, 0.24); }
.badge.danger { color: #ff9aa4; background: rgba(255, 107, 122, 0.1); border-color: rgba(255, 107, 122, 0.26); }
.badge.info { color: #9dc0ff; background: rgba(76, 141, 255, 0.1); border-color: rgba(76, 141, 255, 0.26); }
.badge.muted { color: var(--muted); background: rgba(255, 255, 255, 0.045); border-color: var(--line); }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.search-box { position: relative; }
.search-box input { width: 240px; padding-left: 34px; }
.search-box svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; stroke: var(--dim); fill: none; stroke-width: 2;
}
.empty {
  padding: 44px 20px; text-align: center; color: var(--dim); font-size: 13px;
}
.loading { padding: 60px; text-align: center; color: var(--muted); font-size: 13px; }
.spinner {
  display: inline-block; width: 15px; height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -2px; margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 推荐位卡片 ---------------- */
.feat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.feat-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
  display: flex; flex-direction: column;
}
.feat-cover {
  height: 110px;
  background: linear-gradient(135deg, rgba(76, 141, 255, 0.35), rgba(34, 211, 197, 0.25));
  background-size: cover; background-position: center;
  display: flex; align-items: flex-end;
  padding: 10px 12px;
  font-size: 12px; color: rgba(255, 255, 255, 0.85);
}
.feat-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.feat-body h4 { margin: 0; font-size: 14px; }
.feat-body .sub { font-size: 12px; color: var(--dim); }
.feat-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 10px; }

/* ---------------- 弹窗 / 提示 ---------------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(3, 7, 14, 0.66);
  backdrop-filter: blur(6px);
  display: grid; place-items: center;
  padding: 20px;
  animation: fade 0.18s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 560px;
  max-height: 88vh;
  display: flex; flex-direction: column;
  border-radius: 20px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, #16213a, #0c1425);
  box-shadow: var(--shadow);
  animation: pop 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 15.5px; font-weight: 600; }
.modal-body { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.switch-line { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text); }
.switch-line.muted-line { color: var(--muted); font-size: 12.5px; }
.hint { font-size: 12px; color: var(--dim); line-height: 1.7; }

.upload-box {
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  padding: 14px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.02);
}
.upload-box .progress {
  height: 5px; border-radius: 999px; background: rgba(255, 255, 255, 0.08);
  overflow: hidden; width: 100%;
}
.upload-box .progress i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, #4c8dff, #22d3c5);
  transition: width 0.2s;
}
.upload-box .file-meta { font-size: 12px; color: var(--muted); }

#toast-root { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 200px; max-width: 360px;
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 13px;
  border: 1px solid var(--line-strong);
  background: rgba(18, 28, 46, 0.96);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
.toast.ok { border-color: rgba(46, 211, 160, 0.4); color: #8cf0d3; }
.toast.error { border-color: rgba(255, 107, 122, 0.45); color: #ffb0b7; }
@keyframes toastIn { from { opacity: 0; transform: translateX(16px); } }

/* ---------------- 代码块 ---------------- */
.code-block {
  position: relative;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.85;
  color: #9fb4d8;
  overflow-x: auto;
  white-space: pre;
}
.code-block .k { color: #7fb4ff; }
.code-block .m { color: #59e0c2; }
.api-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 12.5px;
}
.api-row:last-child { border-bottom: 0; }
.api-method {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.5px;
  padding: 2px 7px; border-radius: 6px;
  background: rgba(76, 141, 255, 0.15); color: #9dc0ff;
  flex: none;
}
.api-method.post { background: rgba(46, 211, 160, 0.13); color: #7fe9c8; }
.api-path { font-family: ui-monospace, Consolas, monospace; color: #d5e2fa; }
.api-desc { color: var(--dim); margin-left: auto; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1180px) {
  .grid-2, .grid-2.even { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: relative; height: auto;
    flex-direction: column;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .nav { flex-direction: row; overflow-x: auto; margin-top: 14px; padding-bottom: 4px; }
  .nav-item { flex: none; }
  .side-foot { display: none; }
  .topbar { padding: 12px 16px; }
  .topbar-title h1 { font-size: 17px; }
  .topbar-title p { display: none; }
  .content { padding: 18px 16px 50px; }
  .form-grid { grid-template-columns: 1fr; }
  .search-box input { width: 100%; }
  .user-chip #user-name { display: none; }
}