/* ============================================================
 * 后台管理样式（Arco Design 风格：深色侧边栏 / 主色 #165DFF / 圆角卡片）
 * 类名与既有页面完全兼容，仅换视觉
 * ============================================================ */
:root {
  --primary: #165DFF;
  --primary-hover: #4080FF;
  --primary-light: #E8F3FF;
  --red: #F53F3F;
  --red-light: #FFECE8;
  --green: #00B42A;
  --green-light: #E8FFEA;
  --orange: #FF7D00;
  --orange-light: #FFF7E8;
  --purple: #722ED1;
  --purple-light: #F5E8FF;
  --cyan: #0FC6C2;
  --muted: #86909C;
  --ink: #1D2129;
  --ink-2: #4E5969;
  --line: #E5E6EB;
  --bg: #F7F8FA;
  --card: #FFFFFF;
  --side-bg: #1D2129;
  --side-hover: #2A2E37;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

a { color: inherit; text-decoration: none; }

/* ================= 布局骨架 ================= */
.admin-wrap { display: flex; min-height: 100vh; }

/* ---- 侧边栏（深色） ---- */
.admin-side {
  width: 220px; flex: none; background: var(--side-bg);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side-logo {
  display: flex; align-items: center; gap: 11px;
  height: 64px; padding: 0 18px; border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.side-logo-ico {
  width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), #4080FF); color: #fff; font-size: 17px;
  box-shadow: 0 4px 10px rgba(22, 93, 255, .4);
}
.side-logo-txt strong { display: block; color: #fff; font-size: 15px; line-height: 1.3; }
.side-logo-txt small { display: block; color: #86909C; font-size: 11.5px; }

.side-nav { display: flex; flex-direction: column; gap: 2px; padding: 14px 12px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 11px; height: 44px; padding: 0 13px;
  border-radius: 9px; color: #C9CDD4; font-size: 14px;
  transition: background .15s, color .15s;
}
.nav-item i { width: 18px; text-align: center; font-size: 15px; flex: none; }
.nav-item:hover { background: var(--side-hover); color: #fff; }
.nav-item.on { background: var(--primary); color: #fff; font-weight: 500; box-shadow: 0 4px 10px rgba(22, 93, 255, .35); }

/* 角标：紧跟对应菜单项之后，用负 margin 拉回上一行右侧 */
.nav-badge {
  align-self: flex-end; margin-top: -40px; margin-right: 14px; margin-bottom: 6px;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--red); color: #fff; font-size: 12px; font-weight: 600;
  display: grid; place-items: center; line-height: 1;
}
.nav-badge.order { background: var(--orange); }
.nav-badge.wd { background: var(--red); }

.side-foot { border-top: 1px solid rgba(255, 255, 255, .08); padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.side-foot a {
  display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 13px;
  border-radius: 9px; color: #86909C; font-size: 13.5px; transition: background .15s, color .15s;
}
.side-foot a:hover { background: var(--side-hover); color: #fff; }

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

.admin-top {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; padding: 0 26px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top-title h1 { font-size: 17px; font-weight: 700; line-height: 1.3; }
.top-title small { font-size: 12px; color: var(--muted); }
.top-right { display: flex; align-items: center; gap: 14px; }
.admin-avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), #4080FF); color: #fff; font-size: 15px;
}
.admin-meta { text-align: right; }
.admin-meta strong { display: block; font-size: 13.5px; line-height: 1.3; }
.admin-meta small { display: block; font-size: 11.5px; color: var(--muted); }
.top-btn {
  width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center;
  color: var(--ink-2); transition: background .15s, color .15s;
}
.top-btn:hover { background: var(--bg); color: var(--red); }

.admin-content { padding: 22px 26px 40px; }

/* ================= 提示 toast ================= */
.toast {
  display: flex; align-items: center; gap: 9px; padding: 12px 16px; margin-bottom: 18px;
  border-radius: 9px; font-size: 13.5px; border: 1px solid transparent;
}
.toast-success { background: var(--green-light); border-color: #A9E8B4; color: #00801F; }
.toast-error   { background: var(--red-light); border-color: #FDCDBE; color: #CB2634; }
.toast-info    { background: var(--primary-light); border-color: #Bed4FF; color: #0E42D2; }

/* ================= 统计卡 ================= */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 20px; display: flex; align-items: center; gap: 14px;
  transition: box-shadow .2s, transform .2s;
}
.stat-card:hover { box-shadow: 0 6px 18px rgba(29, 33, 41, .08); transform: translateY(-2px); }
.stat-ico {
  width: 48px; height: 48px; border-radius: 12px; flex: none; display: grid; place-items: center;
  font-size: 20px; color: var(--c, var(--primary));
  background: #F2F3F5;
  background: color-mix(in srgb, var(--c, #165DFF) 10%, #fff);
}
.stat-info { min-width: 0; }
.stat-info strong { display: block; font-size: 21px; font-weight: 700; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-info span { font-size: 12.5px; color: var(--muted); }
.stat-foot { margin-left: auto; align-self: flex-end; font-size: 11.5px; color: var(--muted); text-align: right; max-width: 110px; line-height: 1.5; }

/* ================= 面板 ================= */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 20px; overflow: hidden; }
.panel-head {
  display: flex; align-items: center; gap: 10px; padding: 15px 20px;
  border-bottom: 1px solid var(--line);
}
.panel-head h3 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.panel-head h3 i { color: var(--primary); }
.panel-head .muted { margin-left: auto; }
.panel-body { padding: 20px; }

/* ================= 表格 ================= */
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; padding: 12px 14px; background: var(--bg); color: var(--ink-2);
  font-size: 12.5px; font-weight: 600; white-space: nowrap; border-bottom: 1px solid var(--line);
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #F8FAFF; }
.table .empty { text-align: center; color: var(--muted); padding: 40px 0; }
.muted { color: var(--muted); }
.price { color: var(--red); font-weight: 700; white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; color: var(--ink-2); }
.cell-title { font-weight: 600; }
.cell-sub { font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.card-content { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 3px 9px; }

/* 标签 */
.tag {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500;
  border-radius: 6px; padding: 2px 10px; white-space: nowrap;
}
.tag-0 { background: var(--primary-light); color: #0E42D2; }   /* 蓝：未售/待支付 */
.tag-1 { background: var(--purple-light); color: var(--purple); } /* 紫：物品 */
.tag-2 { background: var(--green-light); color: #00801F; }     /* 绿：正常/已售/上架 */
.tag-3 { background: var(--red-light); color: #CB2634; }       /* 红：禁用/已下架/已退 */

/* ================= 按钮 ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; cursor: pointer; font-size: 13.5px; font-weight: 500; font-family: inherit;
  border-radius: 8px; padding: 8px 16px; transition: all .15s; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #F75759; }
.btn-ghost { background: var(--bg); color: var(--ink-2); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-light); }
.btn-sm { padding: 5px 12px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; }

/* ================= 表单 ================= */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-row { margin-bottom: 16px; min-width: 0; }
.form-row label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.inp, .sel {
  width: 100%; height: 38px; padding: 0 12px; font-size: 13.5px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.inp:focus, .sel:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(22, 93, 255, .12); }
.inp::placeholder { color: #C9CDD4; }
.ta { height: auto; padding: 10px 12px; line-height: 1.7; resize: vertical; }
.form-actions { display: flex; gap: 10px; padding-top: 4px; }
.hint-text { font-size: 12.5px; color: var(--muted); line-height: 1.7; margin-top: 6px; }

/* ================= 工具栏 / 行内操作 ================= */
.toolbar { margin-bottom: 16px; }
.toolbar-form {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px;
}
.toolbar-form .sel { width: auto; min-width: 150px; height: 34px; font-size: 13px; }
.row-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.inline-form { display: inline-flex; align-items: center; gap: 6px; }

/* ================= 待办 ================= */
.todo-box { display: flex; flex-direction: column; gap: 4px; padding: 10px 20px; }
.todo-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 4px;
  border-bottom: 1px dashed var(--line); font-size: 13.5px;
}
.todo-item:last-child { border-bottom: none; }
.todo-item i:first-child { font-size: 16px; width: 20px; text-align: center; flex: none; }
.todo-item .btn { margin-left: auto; }

/* ================= 详情网格 ================= */
.detail-grid label { font-size: 11.5px; color: var(--muted); display: block; margin-bottom: 3px; }
.detail-grid .mono { font-weight: 600; }

/* ================= 登录页 ================= */
.login-body {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(160deg, #E8F3FF 0%, #F7F8FA 45%, #FFFFFF 100%);
}
.login-card {
  width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 12px 32px rgba(29, 33, 41, .1); padding: 40px 36px 32px;
}
.login-ico {
  width: 60px; height: 60px; border-radius: 16px; margin: 0 auto 18px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), #4080FF); color: #fff; font-size: 26px;
  box-shadow: 0 8px 18px rgba(22, 93, 255, .35);
}
.login-card h1 { text-align: center; font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.login-sub { text-align: center; font-size: 12.5px; color: var(--muted); margin-bottom: 26px; }
.fld { position: relative; margin-bottom: 14px; }
.fld i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: #C9CDD4; font-size: 14px; }
.fld .inp { padding-left: 38px; height: 42px; }
.login-card .btn-block { height: 42px; font-size: 15px; border-radius: 9px; }
.login-back { text-align: center; margin-top: 18px; font-size: 13px; }
.login-back a { color: var(--muted); transition: color .15s; }
.login-back a:hover { color: var(--primary); }

/* ================= 响应式 ================= */
@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .admin-side { width: 64px; }
  .side-logo-txt, .nav-item span, .side-foot a span { display: none; }
  .nav-item { justify-content: center; padding: 0; }
  .nav-badge { margin-top: -44px; margin-right: 6px; }
  .side-logo { justify-content: center; padding: 0; }
  .side-foot a { justify-content: center; }
  .admin-top { padding: 0 16px; }
  .admin-meta { display: none; }
  .admin-content { padding: 16px 14px 32px; }
  .form-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
