/* ===========================================================
   管理后台 · 深色侧栏 + 浅色内容
   =========================================================== */

.page-admin { background: var(--bg); }

.adm {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  min-height: 100vh;
}

/* ---------------- 侧栏 ---------------- */
.side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: #0f172a;
  padding: 20px 14px 14px;
  z-index: 20;
  overflow: hidden;
}

.side-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 8px 18px; margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.side-brand img {
  width: 36px; height: 36px; border-radius: 11px; object-fit: cover;
  border: 1px solid rgba(255, 255, 255, .12);
}
.brand-txt { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.brand-txt span {
  font-size: 14px; font-weight: 600; color: #f8fafc;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-txt i {
  font-style: normal; font-size: 10.5px; color: #64748b; letter-spacing: .1em;
}

.side-nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; padding-bottom: 8px; }

.side-group {
  font-size: 10px; letter-spacing: .12em; color: #475569;
  padding: 18px 10px 7px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 38px; padding: 0 10px;
  border: 0; border-radius: 9px; background: none;
  font-size: 13px; color: #94a3b8; text-align: left; cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s;
  position: relative;
}
.nav-item svg { flex: none; opacity: .8; transition: opacity .15s; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #e2e8f0; }
.nav-item.on {
  background: rgba(37, 99, 235, .18); color: #fff; font-weight: 600;
}
.nav-item.on::before {
  content: ''; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px;
  border-radius: 0 3px 3px 0; background: #3b82f6;
}
.nav-item.on svg { opacity: 1; color: #93c5fd; }

.side-foot {
  margin-top: auto; padding: 12px 4px 0;
  border-top: 1px solid rgba(255, 255, 255, .07);
  display: flex; flex-direction: column; gap: 2px;
}
.side-foot a, .side-foot button {
  display: flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 10px; border-radius: 8px;
  font-size: 12.5px; color: #64748b; text-decoration: none;
  border: 0; background: none; cursor: pointer; text-align: left;
  font-family: inherit;
  transition: background .15s, color .15s;
}
.side-foot a:hover, .side-foot button:hover { background: rgba(255, 255, 255, .05); color: #cbd5e1; }

/* ---------------- 主区 ---------------- */
.adm-main { min-width: 0; padding: 0 32px 64px; }

.adm-head {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 74px; margin: 0 -32px 24px; padding: 0 32px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.adm-title { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.adm-head h1 {
  margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -.02em; color: var(--text);
}
.adm-sub { margin: 0; font-size: 12.5px; color: var(--dim); }

.adm-user { display: flex; align-items: center; gap: 10px; flex: none; }
.adm-user .u-name {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 12px 0 10px; border-radius: 20px;
  background: var(--card); border: 1px solid var(--border);
  font-size: 12.5px; color: var(--muted);
}
.adm-user .u-name::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .16);
}
.u-dot { display: none; }

/* ---------------- 统计卡 ---------------- */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.stat-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  transition: box-shadow .18s, transform .18s, border-color .18s;
}
.stat-card:hover {
  border-color: rgba(22, 119, 255, .35);
  box-shadow: 0 4px 14px rgba(16, 24, 40, .07);
  transform: translateY(-1px);
}
.sc-ico {
  flex: none; display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 11px;
}
.sc-ico.blue { color: #2563eb; background: rgba(37, 99, 235, .10); }
.sc-ico.violet { color: #7c3aed; background: rgba(124, 58, 237, .10); }
.sc-ico.green { color: #16a34a; background: rgba(22, 163, 74, .10); }
.sc-ico.amber { color: #d97706; background: rgba(217, 119, 6, .12); }
.sc-ico.cyan { color: #0891b2; background: rgba(8, 145, 178, .10); }

.sc-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sc-body i { font-style: normal; font-size: 12px; color: var(--muted); }
.sc-body b {
  font-size: 24px; font-weight: 650; line-height: 1.15; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; color: var(--text);
}

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 20px 22px; margin-bottom: 18px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 14px; margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.card-head h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.card-head .muted { font-size: 12px; }
.card-head .muted b { color: var(--text); font-weight: 600; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; border-radius: 10px; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11px; font-weight: 600; color: var(--dim);
  letter-spacing: .04em; padding: 9px 10px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td {
  padding: 10px; font-size: 13px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: rgba(22, 119, 255, .035); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .mono { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* 表格里的输入框：平时隐形，悬停显形 */
.table td .cell-input {
  width: 100%; height: 32px; padding: 0 9px;
  font-size: 12.5px; color: var(--text); font-family: inherit;
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  transition: background .14s, border-color .14s, box-shadow .14s;
}
.table tbody tr:hover .cell-input { background: var(--bg); border-color: transparent; }
.table td .cell-input:hover { border-color: var(--border); background: var(--bg); }
.table td .cell-input:focus {
  outline: none; background: var(--card); border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(22, 119, 255, .12);
}
.table td .cell-input.tiny { max-width: 96px; text-align: right; }
.table td .cell-input.mono { font-family: var(--mono); font-size: 11.5px; }

/* ---------------- 表单 ---------------- */
.form { display: block; }
.form label {
  display: flex; flex-direction: column; gap: 7px;
  font-size: 12.5px; color: var(--muted); margin-bottom: 16px;
}
.form input, .form select, .form textarea {
  height: 38px; padding: 0 12px; font-size: 13.5px; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  font-family: inherit; transition: border-color .14s, box-shadow .14s, background .14s;
}
.form textarea { height: auto; padding: 10px 12px; line-height: 1.65; resize: vertical; }
.form input:hover, .form select:hover, .form textarea:hover { border-color: var(--border-2); }
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none; background: var(--card); border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(22, 119, 255, .12);
}
.form .check {
  flex-direction: row; align-items: center; gap: 9px;
  padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text); font-size: 13px;
}
.form .check input { width: 16px; height: 16px; accent-color: var(--blue); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }

.cell-input {
  width: 100%; height: 32px; padding: 0 9px;
  font-size: 12.5px; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; font-family: inherit;
}
.cell-input:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(22, 119, 255, .12);
}
.cell-input.tiny { max-width: 96px; }
.cell-input.mono { font-family: var(--mono); font-size: 11.5px; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 15px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  font-size: 13px; font-weight: 500; font-family: inherit; cursor: pointer; text-decoration: none;
  transition: background .14s, border-color .14s, color .14s, box-shadow .14s, transform .1s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--border-2); background: var(--bg); }
.btn:active { transform: translateY(.5px); }
.btn-primary {
  background: var(--blue); border-color: var(--blue); color: #fff;
  box-shadow: 0 1px 2px rgba(22, 119, 255, .35);
}
.btn-primary:hover {
  background: #0f68e0; border-color: #0f68e0; color: #fff;
  box-shadow: 0 3px 10px rgba(22, 119, 255, .3);
}
.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 42px; padding: 0 22px; font-size: 14px; border-radius: 11px; }
.btn.danger { color: #dc2626; border-color: rgba(220, 38, 38, .25); background: transparent; }
.btn.danger:hover { background: rgba(220, 38, 38, .07); border-color: #dc2626; color: #dc2626; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* ---------------- 邀请码条 ---------------- */
.inv-bar {
  display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center;
  padding: 12px 14px; background: var(--bg); border-radius: 12px; border: 1px solid var(--border);
}
.inv-bar input {
  height: 34px; padding: 0 11px; font-size: 13px; color: var(--text);
  background: var(--card); border: 1px solid var(--border); border-radius: 9px;
  font-family: inherit;
}
.inv-bar input:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(22, 119, 255, .12);
}
.inv-bar input#invCount { width: 76px; }
.inv-bar input#invNote { flex: 1; max-width: 340px; }
.inv-code {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: .06em; font-weight: 500;
  user-select: all; -webkit-user-select: all;
}

/* ---------------- 状态 ---------------- */
.u-on, .u-off {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px; border-radius: 20px; font-size: 11.5px;
}
.u-on { color: #15803d; background: rgba(34, 197, 94, .12); }
.u-off { color: #b91c1c; background: rgba(239, 68, 68, .1); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }

.badge {
  display: inline-block; padding: 1px 7px; border-radius: 20px;
  font-size: 11px; line-height: 17px; background: var(--bg);
  border: 1px solid var(--border); color: var(--muted);
}
.notes { font-size: 12px; color: var(--dim); line-height: 1.7; margin: 12px 0 0; }
.form-actions { display: flex; align-items: center; gap: 10px; padding-top: 4px; }
.sub { font-size: 12px; color: var(--dim); }
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }

/* ---------------- 标签页 ---------------- */
.tab-panel { display: none; }
.tab-panel.on { display: block; animation: fadeUp .22s ease; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ---------------- 上传 ---------------- */
.upload-box {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 120px; border: 1px dashed var(--border-2); border-radius: 12px;
  background: var(--bg); color: var(--muted); font-size: 12.5px; cursor: pointer;
  transition: border-color .16s, color .16s, background .16s;
}
.upload-box:hover { border-color: var(--blue); color: var(--blue); background: rgba(22, 119, 255, .03); }
.thumb-wrap { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.thumb-wrap img {
  width: 88px; height: 88px; object-fit: cover; border-radius: 11px; border: 1px solid var(--border);
}
.thumb-empty {
  width: 88px; height: 88px; border-radius: 11px; border: 1px dashed var(--border-2);
  display: grid; place-items: center; font-size: 11px; color: var(--dim); background: var(--bg);
}

/* ---------------- 滚动条 ---------------- */
.side-nav::-webkit-scrollbar, .table-wrap::-webkit-scrollbar { width: 6px; height: 6px; }
.side-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 3px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1024px) {
  .adm-main { padding: 0 22px 48px; }
  .adm-head { margin: 0 -22px 20px; padding: 0 22px; height: 66px; }
  .adm-head h1 { font-size: 18px; }
}

@media (max-width: 960px) {
  .adm { grid-template-columns: 1fr; }
  .side {
    position: sticky; top: 0; height: auto; flex-direction: row; align-items: center;
    gap: 10px; padding: 10px 12px; overflow-x: auto;
  }
  .side-brand { border: 0; padding: 0; margin: 0; flex: none; }
  .brand-txt i { display: none; }
  .brand-txt span { font-size: 13px; max-width: 84px; }
  .side-nav { flex-direction: row; gap: 6px; overflow: visible; padding: 0; }
  .side-group { display: none; }
  .nav-item { height: 34px; padding: 0 12px; white-space: nowrap; }
  .nav-item.on::before { display: none; }
  .side-foot { display: none; }
  .m-only { display: inline-flex; }
  .m-only button { border: 0; background: none; padding: 0; }
  .adm-main { padding: 0 16px 40px; }
  .adm-head { margin: 0 -16px 16px; padding: 0 16px; height: 60px; }
  .adm-sub { display: none; }
  .adm-head h1 { font-size: 17px; }
  .grid-2 { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
  .table { min-width: 680px; }
  .table th, .table td { white-space: nowrap; }
  .table td .cell-input { background: var(--bg); border-color: var(--border); }
}

@media (max-width: 560px) {
  .stat-card { padding: 13px 14px; gap: 10px; }
  .sc-ico { width: 32px; height: 32px; border-radius: 9px; }
  .sc-body b { font-size: 20px; }
  .card { padding: 15px 16px; border-radius: 14px; }
  .adm-user .u-name { display: none; }
}

.m-only { display: none; }

/* ---------------- 快捷操作 ---------------- */
.quick-actions .card-head { margin-bottom: 12px; }
.qa-row { display: flex; flex-wrap: wrap; gap: 10px; }
.qa {
  display: inline-flex; align-items: center; justify-content: center;
  height: 40px; padding: 0 18px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  font-size: 13px; font-family: inherit; text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.qa:hover {
  border-color: var(--blue); color: var(--blue);
  background: rgba(22, 119, 255, .05);
  box-shadow: 0 1px 2px rgba(22, 119, 255, .1);
}
.qa:active { transform: translateY(.5px); }

/* 表格输入框：带一点底色，避免"看不见" */
.table td .cell-input { background: rgba(15, 23, 42, .025); }
.table td .cell-input:hover { background: var(--bg); }
.table select.cell-input { min-width: 104px; padding-right: 26px; }

/* ---------------- 下拉框统一外观 ---------------- */
.table select.cell-input, .form select, .inv-bar select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-color: var(--bg);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 30px;
  color: var(--text);
}
.table select.cell-input:hover, .form select:hover { border-color: var(--border-2); }

/* 表格里的删除按钮更克制 */
.table .btn.danger {
  border-color: transparent; background: transparent; color: var(--dim);
}
.table tbody tr:hover .btn.danger { color: #dc2626; }
.table .btn.danger:hover { background: rgba(220, 38, 38, .08); border-color: rgba(220, 38, 38, .3); }
