/* ==========================================================================
   易豪科技 · 后台管理样式 admin.css
   风格与前台统一（蓝白科技风），采用工具化的侧边栏 + 内容区布局
   ========================================================================== */

:root {
  --primary: #1e88e5;
  --primary-dark: #0a66c2;
  --primary-deep: #0b3fa8;
  --cyan: #22d3ee;
  --ink: #0a1a33;
  --ink-2: #2f4360;
  --muted: #667a94;
  --line: #e4edf9;
  --line-soft: #eef4fc;
  --bg: #f4f8ff;
  --white: #fff;
  --danger: #e5484d;
  --success: #12b76a;
  --radius: 16px;
  --shadow-sm: 0 8px 24px rgba(16, 66, 128, 0.07);
  --shadow-md: 0 20px 50px rgba(16, 66, 128, 0.12);
  --font: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); line-height: 1.65; font-size: 15px; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
::selection { background: rgba(30,136,229,.18); }

/* ------------------------------ 布局 ------------------------------ */
.admin { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }

/* 侧边栏 */
.sidebar {
  background: #071022; color: #cbd7e8; padding: 26px 18px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; overflow-y: auto;
}
.sidebar__brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 20px; }
.sidebar__brand img { width: 42px; height: 42px; border-radius: 12px; background: #fff; padding: 5px; }
.sidebar__brand b { color: #fff; font-size: 16px; display: block; }
.sidebar__brand span { font-size: 10.5px; letter-spacing: .2em; color: #7dd3fc; font-weight: 700; }
.sidebar__nav { display: grid; gap: 6px; flex: 1; }
.sidebar__link {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 12px;
  font-size: 15px; font-weight: 600; color: #aebbd0; transition: background .25s, color .25s;
}
.sidebar__link svg { width: 19px; height: 19px; }
.sidebar__link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar__link.active { background: linear-gradient(135deg, var(--primary), var(--primary-deep)); color: #fff; box-shadow: 0 12px 28px rgba(30,136,229,.35); }
.sidebar__foot { padding-top: 18px; border-top: 1px solid rgba(255,255,255,.1); display: grid; gap: 8px; }
.sidebar__foot a { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 10px; font-size: 13.5px; color: #93a2ba; }
.sidebar__foot a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar__foot svg { width: 16px; height: 16px; }

/* 主区域 */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 72px; background: rgba(255,255,255,.86); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; padding: 0 30px;
}
.topbar h1 { font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.topbar__sub { font-size: 13px; color: var(--muted); font-weight: 500; }
.topbar__actions { display: flex; gap: 12px; align-items: center; }

.content { padding: 30px; flex: 1; }
.view { display: none; animation: viewIn .4s var(--ease); }
.view.active { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(12px); } }

/* ------------------------------ 按钮 ------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 20px; border-radius: 10px; font-size: 14px; font-weight: 700;
  transition: transform .25s var(--ease), box-shadow .25s, background .25s; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn--primary { color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); box-shadow: 0 10px 24px rgba(30,136,229,.28); }
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 16px 32px rgba(30,136,229,.36); }
.btn--ghost { color: var(--ink-2); background: #fff; border: 1.5px solid var(--line); }
.btn--ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn--danger { color: var(--danger); background: #fff; border: 1.5px solid #f6d5d6; }
.btn--danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn--sm { height: 34px; padding: 0 14px; font-size: 13px; border-radius: 8px; }
.btn--icon { width: 34px; height: 34px; padding: 0; }

/* ------------------------------ 卡片 / 概览 ------------------------------ */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 26px; }
.stat-card { padding: 24px; display: flex; align-items: center; gap: 18px; }
.stat-card__ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(150deg, #eff6ff, #fff); border: 1px solid #dbeafe; color: var(--primary); flex: none; }
.stat-card__ic svg { width: 24px; height: 24px; }
.stat-card b { font-size: 28px; font-weight: 900; display: block; line-height: 1.1; }
.stat-card span { font-size: 13px; color: var(--muted); font-weight: 600; }

.panel { padding: 26px; margin-bottom: 24px; }
.panel__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.panel__head h2 { font-size: 17px; font-weight: 800; }
.panel__head p { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ------------------------------ 表格 ------------------------------ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { text-align: left; padding: 15px 16px; border-bottom: 1px solid var(--line-soft); font-size: 14px; vertical-align: middle; }
th { font-size: 12.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; background: #fafcff; }
tbody tr { transition: background .2s; }
tbody tr:hover { background: #fafcff; }
td .title-cell { font-weight: 700; color: var(--ink); }
td .muted { color: var(--muted); font-size: 13px; }
.row-actions { display: flex; gap: 8px; }

.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 100px; background: #eff6ff; color: var(--primary-deep); }
.empty { text-align: center; padding: 54px 20px; color: var(--muted); }
.empty svg { width: 46px; height: 46px; color: #c3d4ea; margin-bottom: 12px; }

/* ------------------------------ 表单弹窗 ------------------------------ */
.modal { position: fixed; inset: 0; z-index: 120; display: none; align-items: flex-start; justify-content: center; padding: 40px 20px; overflow-y: auto; }
.modal.open { display: flex; }
.modal__bd { position: fixed; inset: 0; background: rgba(7,16,34,.5); backdrop-filter: blur(4px); animation: fade .3s; }
@keyframes fade { from { opacity: 0; } }
.modal__panel { position: relative; z-index: 2; width: min(680px, 100%); background: #fff; border-radius: 20px; box-shadow: var(--shadow-md); animation: pop .35s var(--ease); margin: auto 0; }
@keyframes pop { from { opacity: 0; transform: translateY(20px) scale(.98); } }
.modal__head { padding: 24px 28px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal__head h3 { font-size: 18px; font-weight: 800; }
.modal__close { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; color: var(--muted); background: var(--bg); transition: background .25s, color .25s; }
.modal__close:hover { background: var(--danger); color: #fff; }
.modal__close svg { width: 17px; height: 17px; }
.modal__body { padding: 26px 28px; }
.modal__foot { padding: 18px 28px 26px; display: flex; justify-content: flex-end; gap: 12px; }

.field { margin-bottom: 18px; }
.field > label { display: block; font-size: 13.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 8px; }
.field .hint { font-weight: 500; color: var(--muted); font-size: 12.5px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1.5px solid var(--line);
  background: #fafcff; font-family: inherit; font-size: 14.5px; color: var(--ink); outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px rgba(30,136,229,.12); }
.field textarea { resize: vertical; min-height: 96px; line-height: 1.7; }
.field--row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ------------------------------ 提示 ------------------------------ */
.toast { position: fixed; right: 26px; bottom: 26px; z-index: 300; display: flex; flex-direction: column; gap: 10px; }
.toast__i {
  background: #0a1a33; color: #fff; padding: 14px 20px; border-radius: 12px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-md); display: flex; align-items: center; gap: 10px;
  animation: toastIn .35s var(--ease);
}
.toast__i.ok { background: linear-gradient(135deg, #12b76a, #0a9c58); }
.toast__i.err { background: linear-gradient(135deg, #e5484d, #c0363a); }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } }

/* ============================== 登录页 ============================== */
.login {
  position: fixed; inset: 0; z-index: 400; display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow-y: auto;
  background:
    radial-gradient(900px 500px at 82% 8%, rgba(34, 211, 238, 0.18), transparent 60%),
    radial-gradient(800px 520px at 10% 90%, rgba(30, 136, 229, 0.20), transparent 62%),
    linear-gradient(150deg, #060e1f, #0b1f3f 90%);
}
.login::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(circle at 50% 40%, #000, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 50% 40%, #000, transparent 78%);
}
.login__card {
  position: relative; z-index: 2; width: min(420px, 100%);
  background: rgba(255, 255, 255, 0.98); border-radius: 22px; padding: 40px 36px;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.4); animation: loginIn .5s var(--ease);
}
@keyframes loginIn { from { opacity: 0; transform: translateY(24px) scale(.97); } }
.login__brand { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 28px; }
.login__brand img { width: 60px; height: 60px; border-radius: 16px; background: #fff; padding: 7px; box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.login__brand b { font-size: 21px; font-weight: 900; margin-top: 16px; color: var(--ink); letter-spacing: .01em; }
.login__brand span { font-size: 12.5px; color: var(--muted); margin-top: 4px; letter-spacing: .05em; }
.login__field { position: relative; margin-bottom: 16px; }
.login__field input {
  width: 100%; height: 50px; padding: 0 16px 0 46px; border-radius: 12px;
  border: 1.5px solid var(--line); background: #fafcff; font-family: inherit; font-size: 15px; color: var(--ink); outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.login__field input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px rgba(30,136,229,.12); }
.login__field .fic { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 19px; height: 19px; color: #9fb2ca; pointer-events: none; }
.login__field .toggle {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--muted);
}
.login__field .toggle:hover { background: var(--bg); color: var(--primary); }
.login__field .toggle svg { width: 17px; height: 17px; }
.login__err {
  display: none; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--danger);
  background: #fef2f2; border: 1px solid #fbd5d5; border-radius: 10px; padding: 10px 14px; margin-bottom: 16px;
}
.login__err.show { display: flex; animation: shake .4s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }
.login__btn { width: 100%; height: 50px; border-radius: 12px; font-size: 15.5px; font-weight: 800; margin-top: 6px; }
.login__hint { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 18px; line-height: 1.7; }
.login__hint code { background: var(--bg); padding: 2px 7px; border-radius: 6px; color: var(--primary-deep); font-weight: 700; }

/* 未登录时隐藏后台主体 */
body.locked .admin { display: none; }
body:not(.locked) .login { display: none; }

/* ------------------------------ 响应式 ------------------------------ */
@media (max-width: 980px) {
  .admin { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 12px; padding: 16px; }
  .sidebar__brand { border: none; padding: 0; margin: 0; }
  .sidebar__nav { display: flex; flex: none; width: 100%; overflow-x: auto; }
  .sidebar__link { white-space: nowrap; }
  .sidebar__foot { display: none; }
  .stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  .content { padding: 18px; }
  .topbar { padding: 0 16px; }
  .stats { grid-template-columns: 1fr; }
  .field--row { grid-template-columns: 1fr; }
  .modal { padding: 16px; }
  .modal__body, .modal__head, .modal__foot { padding-left: 18px; padding-right: 18px; }
}
