/* 富柜潮玩 admin-lite · 现代简洁范式 */
:root {
  --sidebar-bg: #101828;
  --sidebar-ink: #cbd5e1;
  --sidebar-active: #4f46e5;
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #1a1a2e;
  --sub: #667085;
  --line: #eaecf0;
  --accent: #4f46e5;
  --accent-bg: #eef0fe;
  --ok: #039855;
  --ok-bg: #e7f8f0;
  --warn: #b54708;
  --warn-bg: #fef4e5;
  --danger: #d92d20;
  --danger-bg: #feebe9;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.55;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #101828 0%, #1d2440 55%, #2b2f5c 100%);
}
.login-card {
  width: 380px; max-width: calc(100vw - 40px); background: #fff; border-radius: 16px;
  padding: 34px 32px 28px; box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.login-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 26px; }
.login-logo, .brand-logo {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, #4f46e5, #7c6cf0); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 800;
}
.login-title { font-size: 17px; font-weight: 700; }
.login-sub { font-size: 12px; color: var(--sub); margin-top: 2px; }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 12.5px; color: var(--sub); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; height: 40px; border: 1px solid var(--line); border-radius: 9px;
  padding: 0 12px; font-size: 14px; outline: none; transition: border-color .15s, box-shadow .15s;
  background: #fff;
}
.field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.login-error {
  background: var(--danger-bg); color: var(--danger); border-radius: 8px;
  padding: 8px 12px; font-size: 12.5px; margin-bottom: 14px;
}
.login-foot { margin-top: 22px; color: rgba(255,255,255,.45); font-size: 12px; }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid transparent; border-radius: 9px; padding: 0 16px; height: 38px;
  font-size: 13.5px; font-weight: 600; transition: all .15s; background: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #4338ca; }
.btn-block { width: 100%; height: 42px; }
.btn-ghost { border-color: var(--line); color: var(--sub); background: #fff; }
.btn-ghost:hover { color: var(--ink); border-color: #d0d5dd; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; border-radius: 7px; }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-ok { background: var(--ok-bg); color: var(--ok); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex: none; background: var(--sidebar-bg); color: var(--sidebar-ink);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow: hidden;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 18px 18px 14px; }
.brand-logo { width: 36px; height: 36px; font-size: 16px; border-radius: 10px; }
.brand-name { font-size: 15px; font-weight: 700; color: #fff; line-height: 1.25; }
.brand-name span { display: block; font-size: 11px; font-weight: 400; color: #8a94a8; }
.nav { flex: 1; overflow-y: auto; padding: 4px 10px 20px; }
.nav::-webkit-scrollbar { width: 4px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

.nav-group { margin-bottom: 2px; }
.nav-group-head {
  width: 100%; display: flex; align-items: center; gap: 10px; border: none; background: none;
  color: var(--sidebar-ink); padding: 10px 10px; border-radius: 9px; font-size: 13.5px; font-weight: 600;
  transition: background .15s;
}
.nav-group-head:hover { background: rgba(255,255,255,.06); }
.nav-group-head .ico { width: 18px; text-align: center; font-size: 15px; flex: none; }
.nav-group-head .arrow { margin-left: auto; font-size: 10px; transition: transform .2s; opacity: .6; }
.nav-group.open .nav-group-head .arrow { transform: rotate(90deg); }
.nav-items {
  overflow: hidden; max-height: 0; transition: max-height .22s ease;
}
.nav-group.open .nav-items { max-height: 420px; }
.nav-item {
  display: block; width: 100%; text-align: left; border: none; background: none;
  color: #98a2b3; padding: 8px 10px 8px 38px; border-radius: 8px; font-size: 13px;
  transition: all .15s; position: relative;
}
.nav-item:hover { color: #e2e8f0; background: rgba(255,255,255,.05); }
.nav-item.active { color: #fff; background: var(--sidebar-active); font-weight: 600; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 22px;
  position: sticky; top: 0; z-index: 5;
}
.topbar-left { font-size: 13.5px; }
.crumb-group { color: var(--sub); }
.crumb-sep { color: #c0c6d0; margin: 0 7px; }
.crumb-page { font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.current-user { font-size: 13px; color: var(--sub); }
.content { padding: 20px 22px 40px; }

/* ---------- 卡片/表格 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-title { font-size: 15px; font-weight: 700; margin-right: auto; }
.card-body { padding: 16px 18px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar input, .toolbar select {
  height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; font-size: 13px; outline: none;
}
.toolbar input:focus, .toolbar select:focus { border-color: var(--accent); }

.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th {
  text-align: left; color: var(--sub); font-weight: 500; font-size: 12.5px;
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbfc;
}
table.grid td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid tr:last-child td { border-bottom: none; }
table.grid tr:hover td { background: #fafbff; }
.empty { text-align: center; color: var(--sub); padding: 40px 0; font-size: 13px; }

.pager { display: flex; align-items: center; gap: 12px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--sub); }

.tag { display: inline-block; border-radius: 6px; padding: 2px 9px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.t-ok { background: var(--ok-bg); color: var(--ok); }
.t-warn { background: var(--warn-bg); color: var(--warn); }
.t-danger { background: var(--danger-bg); color: var(--danger); }
.t-info { background: var(--accent-bg); color: var(--accent); }
.t-muted { background: #f2f4f7; color: var(--sub); }

.mono { font-family: Consolas, "Courier New", monospace; font-size: 12px; }
.muted { color: var(--sub); }
.nowrap { white-space: nowrap; }

/* ---------- 仪表盘 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat-card .label { font-size: 12.5px; color: var(--sub); }
.stat-card .value { font-size: 26px; font-weight: 800; margin-top: 6px; color: var(--ink); }
.stat-card .value.loading { color: #c0c6d0; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 99; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #101828; color: #fff; border-radius: 9px; padding: 10px 18px; font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: toast-in .2s ease;
}
.toast.ok { background: var(--ok); }
.toast.err { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; } }

/* ---------- 弹层 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal { background: #fff; border-radius: 14px; width: 480px; max-width: calc(100vw - 32px); max-height: 82vh; overflow: auto; box-shadow: 0 24px 64px rgba(0,0,0,.3); }
.modal-head { padding: 15px 20px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 15px; display: flex; }
.modal-close { margin-left: auto; border: none; background: none; font-size: 18px; color: var(--sub); }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 13px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

@media (max-width: 860px) {
  .sidebar { width: 64px; }
  .brand-name, .nav-group-head .txt, .nav-group-head .arrow { display: none; }
  .nav-item { padding-left: 10px; text-align: center; font-size: 12px; }
  .nav-group.open .nav-items { max-height: none; }
}
