/* =============================================================
   管理后台 · 面板样式（折叠汉堡侧栏）
   独立文件，与 user.css 完全不同，互不复用
   视觉：深蓝沉稳商务风
   ============================================================= */

:root {
  --adm-side-w: 250px;
  --adm-side-collapsed: 72px;
  --adm-top-h: 62px;
  --adm-side-bg: #10132B;
  --adm-side-bg-2: #171B3C;
  --adm-txt: rgba(255,255,255,.82);
  --adm-txt-dim: rgba(255,255,255,.45);
}

.admin-shell { display: flex; min-height: 100vh; background: #F4F6FA; }
[data-theme="dark"] .admin-shell { background: var(--bg); }

/* ---------- 侧栏 ---------- */
.admin-sidebar {
  width: var(--adm-side-w); flex: none;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--adm-side-bg) 0%, #0C0F24 100%);
  transition: width var(--norm);
  z-index: 200; overflow: hidden;
}

.asb-head {
  height: var(--adm-top-h); flex: none;
  display: flex; align-items: center; gap: 11px; padding: 0 18px;
  border-bottom: 1px solid rgba(255,255,255,.07); overflow: hidden;
}
.asb-mark {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  background: linear-gradient(135deg, #4F7CF7 0%, #7C5CE7 55%, #00C2FF 100%);
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 4px 16px rgba(79,124,247,.42);
}
.asb-mark svg { width: 20px; height: 20px; }
.asb-text { min-width: 0; white-space: nowrap; transition: opacity var(--fast); color: #fff; }
.asb-text b { display: block; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.asb-text span { display: block; font-size: 11px; color: rgba(255,255,255,.4); }

.asb-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 12px 20px; }
.asb-nav::-webkit-scrollbar { width: 0; }

.a-group { margin-bottom: 4px; }
.a-group-title {
  padding: 14px 12px 6px; font-size: 10.5px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.32);
  white-space: nowrap; transition: opacity var(--fast);
}

.a-item {
  display: flex; align-items: center; gap: 12px; height: 42px;
  padding: 0 12px; margin-bottom: 2px; border-radius: 9px;
  color: var(--adm-txt); font-size: 13.8px; font-weight: 500;
  transition: background var(--fast), color var(--fast);
  position: relative; white-space: nowrap;
}
.a-item svg.ico { width: 18px; height: 18px; flex: none; opacity: .85; }
.a-item .txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; transition: opacity var(--fast); }
.a-item .chev { width: 13px; height: 13px; flex: none; color: rgba(255,255,255,.35); transition: transform var(--fast); }
.a-item .badge {
  min-width: 19px; height: 19px; padding: 0 6px; border-radius: 999px;
  background: #F0455A; color: #fff; font-size: 11px; font-weight: 600;
  display: grid; place-items: center; flex: none; transition: opacity var(--fast);
}
.a-item .badge.soft { background: rgba(79,124,247,.22); color: #8FB0FF; }
.a-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.a-item.active {
  background: linear-gradient(90deg, rgba(79,124,247,.28), rgba(124,92,231,.14));
  color: #fff; font-weight: 600;
}
.a-item.active svg.ico { opacity: 1; color: #8FB0FF; }
.a-item.active::before {
  content: ''; position: absolute; left: -12px; top: 9px; bottom: 9px;
  width: 3px; border-radius: 0 3px 3px 0; background: #4F7CF7;
}
.a-item.open .chev { transform: rotate(90deg); }

.a-sub { display: none; padding: 2px 0 6px; }
.a-sub.open { display: block; }
.a-sub a {
  display: flex; align-items: center; gap: 10px; height: 34px;
  padding: 0 12px 0 26px; border-radius: 8px;
  font-size: 13px; color: rgba(255,255,255,.5); white-space: nowrap;
  transition: all var(--fast); position: relative;
}
.a-sub a::before {
  content: ''; width: 4px; height: 4px; border-radius: 50%;
  background: rgba(255,255,255,.25); flex: none; transition: all var(--fast);
}
.a-sub a:hover { color: #fff; background: rgba(255,255,255,.06); }
.a-sub a.active { color: #8FB0FF; }
.a-sub a.active::before { background: #4F7CF7; transform: scale(1.3); }

.asb-foot { flex: none; padding: 12px; border-top: 1px solid rgba(255,255,255,.07); }
.asb-user {
  display: flex; align-items: center; gap: 10px; padding: 9px;
  border-radius: 9px; overflow: hidden; transition: background var(--fast);
}
.asb-user:hover { background: rgba(255,255,255,.07); }
.asb-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none; object-fit: cover;
  background: linear-gradient(135deg, #4F7CF7, #00C2FF);
  display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 13.5px;
}
.asb-meta { min-width: 0; flex: 1; white-space: nowrap; transition: opacity var(--fast); }
.asb-meta b { display: block; font-size: 13.5px; color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.asb-meta span { display: block; font-size: 11.5px; color: rgba(255,255,255,.4); }

/* 收起态 */
body.sb-collapsed .admin-sidebar { width: var(--adm-side-collapsed); }
body.sb-collapsed .asb-text,
body.sb-collapsed .a-group-title,
body.sb-collapsed .a-item .txt,
body.sb-collapsed .a-item .chev,
body.sb-collapsed .a-item .badge,
body.sb-collapsed .asb-meta { opacity: 0; pointer-events: none; }
body.sb-collapsed .a-item { justify-content: center; padding: 0; }
body.sb-collapsed .asb-head { justify-content: center; padding: 0; }
body.sb-collapsed .asb-foot { padding: 12px 8px; }
body.sb-collapsed .asb-user { justify-content: center; padding: 6px; }
body.sb-collapsed .a-sub { display: none !important; }
body.sb-collapsed .a-item.active::before { left: -8px; }
body.sb-collapsed .a-item::after {
  content: attr(data-tip);
  position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%);
  padding: 6px 11px; border-radius: 7px;
  background: rgba(22,24,46,.96); color: #fff; font-size: 12.5px; font-weight: 400;
  white-space: nowrap; opacity: 0; pointer-events: none; z-index: 300;
  transition: opacity var(--fast); box-shadow: var(--shadow-md);
}
body.sb-collapsed .a-item:hover::after { opacity: 1; }

/* ---------- 主区 ---------- */
.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.admin-topbar {
  height: var(--adm-top-h); flex: none;
  display: flex; align-items: center; gap: 14px; padding: 0 22px;
  background: rgba(255,255,255,.88);
  backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 150;
}
[data-theme="dark"] .admin-topbar { background: rgba(11,12,24,.88); }

.admin-topbar .burger:hover { background: var(--bg-sunken); color: var(--brand); }
.admin-topbar .burger svg { width: 20px; height: 20px; }

.adm-search {
  position: relative; width: 280px; max-width: 34vw;
}
.adm-search .input {
  height: 38px; border-radius: var(--r-full); padding-left: 38px;
  background: var(--bg-sunken); border-color: transparent; font-size: 13.5px;
}
.adm-search .input:focus { background: var(--surface); border-color: var(--brand); }
.adm-search > svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); }

.admin-content { flex: 1; padding: 26px 22px 40px; min-width: 0; }
.admin-content-inner { max-width: 1340px; }

/* ---------- 页面头 ---------- */
.adm-head { margin-bottom: 22px; }
.adm-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 5px; }
.adm-head .desc { color: var(--text-3); font-size: 14px; }
.adm-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.adm-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- 面板 ---------- */
.adm-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-xs);
}
.adm-panel-head {
  padding: 16px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.adm-panel-head h3 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 9px; }
.adm-panel-head h3 svg { width: 17px; height: 17px; color: #4F7CF7; }
.adm-panel-body { padding: 22px; }
.adm-panel-body.tight { padding: 0; }
.adm-panel + .adm-panel { margin-top: 20px; }
.adm-grid { display: grid; gap: 20px; }
.adm-grid.c2 { grid-template-columns: repeat(2, 1fr); }
.adm-grid.c3 { grid-template-columns: repeat(3, 1fr); }
.adm-grid.c4 { grid-template-columns: repeat(4, 1fr); }
.adm-grid.sidebar { grid-template-columns: 2fr 1fr; }

/* ---------- 数据卡 ---------- */
.adm-stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 20px 22px; position: relative; overflow: hidden;
  transition: transform var(--norm), box-shadow var(--norm);
}
.adm-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.adm-stat::after {
  content: ''; position: absolute; right: -18px; top: -18px;
  width: 90px; height: 90px; border-radius: 50%; opacity: .09;
}
.adm-stat.blue::after { background: #4F7CF7; }
.adm-stat.purple::after { background: #7C5CE7; }
.adm-stat.cyan::after { background: #00C2FF; }
.adm-stat.green::after { background: #12B886; }
.adm-stat.amber::after { background: #F59F0B; }
.adm-stat.red::after { background: #F0455A; }
.adm-stat .lbl { font-size: 13px; color: var(--text-3); margin-bottom: 8px; display: flex; align-items: center; gap: 7px; }
.adm-stat .lbl svg { width: 15px; height: 15px; }
.adm-stat .num { font-size: 27px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.adm-stat .sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.adm-stat .sub b { color: var(--success); font-weight: 600; }

/* ---------- 表格 ---------- */
.adm-tbl { width: 100%; font-size: 13.8px; }
.adm-tbl th {
  padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 600;
  color: var(--text-3); border-bottom: 1px solid var(--border);
  white-space: nowrap; background: var(--surface-2);
}
.adm-tbl td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.adm-tbl tbody tr:last-child td { border-bottom: none; }
.adm-tbl tbody tr { transition: background var(--fast); }
.adm-tbl tbody tr:hover { background: var(--surface-2); }
.adm-tbl .cell-main { font-weight: 500; }
.adm-tbl .cell-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.adm-tbl-wrap { overflow-x: auto; }

/* 工具条 */
.adm-toolbar {
  padding: 14px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.adm-toolbar .grow-line { flex: 1; }
.adm-toolbar .input, .adm-toolbar .select { height: 38px; width: auto; min-width: 150px; }
.adm-toolbar .input.sm { min-width: 200px; }

/* 拖拽排序 Handle */
.drag-handle { cursor: grab; color: var(--text-3); display: inline-flex; }
.drag-handle:active { cursor: grabbing; }
.drag-handle svg { width: 15px; height: 15px; }

/* 抽屉遮罩 */
.admin-overlay {
  position: fixed; inset: 0; z-index: 190;
  background: rgba(12,14,30,.5); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity var(--norm);
}
body.drawer-open .admin-overlay { opacity: 1; pointer-events: auto; }

/* ---------- 通用补充（与全局设计系统一致，管理后台增强） ---------- */
.adm-panel-foot {
  padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.more { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 500; color: var(--brand); white-space: nowrap; }
.more:hover { text-decoration: underline; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.06); }
.adm-toolbar + .adm-panel { margin-top: 20px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1280px) {
  .adm-grid.sidebar { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
  .adm-grid.c4 { grid-template-columns: repeat(2, 1fr); }
  .adm-grid.c3 { grid-template-columns: repeat(2, 1fr); }
  .adm-search { width: 180px; }
}
@media (max-width: 768px) {
  .admin-sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%); box-shadow: var(--shadow-lg);
    transition: transform var(--norm);
  }
  body.drawer-open .admin-sidebar { transform: none; }
  body.sb-collapsed .admin-sidebar { width: var(--adm-side-w); }
  body.sb-collapsed .asb-text,
  body.sb-collapsed .a-group-title,
  body.sb-collapsed .a-item .txt,
  body.sb-collapsed .a-item .chev,
  body.sb-collapsed .a-item .badge,
  body.sb-collapsed .asb-meta { opacity: 1; pointer-events: auto; }
  body.sb-collapsed .a-item { justify-content: flex-start; padding: 0 12px; }
  body.sb-collapsed .asb-head { justify-content: flex-start; padding: 0 18px; }
  body.sb-collapsed .a-item::after { display: none; }
  body.sb-collapsed .a-sub.open { display: block; }
  .admin-content { padding: 18px 14px 32px; }
  .adm-grid.c2, .adm-grid.c3, .adm-grid.c4 { grid-template-columns: 1fr; }
  .adm-panel-body, .adm-panel-head { padding-left: 16px; padding-right: 16px; }
  .admin-topbar { padding: 0 14px; }
  .adm-search { display: none; }
}
