/* ============================================================
   QMAIGEO · 设计系统 v2（高级UI重构）
   设计令牌 + 组件升级，兼容现有页面全部 class。
   品牌：靛蓝渐变 / 中性灰阶 / 语义色；卡片分层 / 微交互 / 响应式。
   ============================================================ */

/* ---------- 设计令牌 ---------- */
:root {
  /* 品牌色阶 */
  --brand-50:  #eef3ff;
  --brand-100: #dfe8ff;
  --brand-200: #c1d2ff;
  --brand-400: #7a9bff;
  --brand-500: #3a6cf7;
  --brand-600: #2f54eb;
  --brand-700: #2547c9;
  --brand-gradient: linear-gradient(135deg, #3a6cf7 0%, #2f54eb 55%, #5a5cf0 100%);
  /* 中性灰阶 */
  --ink-900: #0f172a;
  --ink-700: #334155;
  --ink-600: #475569;
  --ink-500: #64748b;
  --ink-400: #94a3b8;
  --ink-300: #cbd5e1;
  --ink-200: #e2e8f0;
  --ink-100: #f1f5f9;
  --ink-50:  #f8fafc;
  /* 语义色 */
  --green:  #22c55e;
  --green-bg: #ecfdf5;
  --red:    #ef4444;
  --red-bg: #fef2f2;
  --amber:  #f59e0b;
  --amber-bg: #fffbeb;
  --info:   #3b82f6;
  --info-bg: #eff6ff;
  /* 间距刻度 */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px;
  /* 圆角 */
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 18px;
  /* 阴影层级 */
  --shadow-sm: 0 1px 2px rgba(15,23,42,.05);
  --shadow-md: 0 4px 14px rgba(15,23,42,.07);
  --shadow-lg: 0 12px 32px rgba(15,23,42,.12);
  /* 字体 */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --num-font: "SF Pro Display", "Segoe UI", "PingFang SC", sans-serif;
  --transition: .18s cubic-bezier(.4,0,.2,1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font);
  background: var(--ink-100);
  color: var(--ink-900);
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); }

/* ============================================================
   登录页
   ============================================================ */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1000px 520px at 12% -10%, rgba(90,92,240,.28), transparent 60%),
    radial-gradient(900px 600px at 110% 110%, rgba(58,108,247,.22), transparent 55%),
    linear-gradient(160deg, #eef3ff 0%, #f6f8fd 45%, #eef2ff 100%);
  padding: var(--sp-5);
  position: relative; overflow: hidden;
}
/* 装饰光斑 */
.login-wrap::before, .login-wrap::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(60px); opacity: .5;
}
.login-wrap::before { width: 340px; height: 340px; background: rgba(122,155,255,.28); top: -80px; right: -60px; }
.login-wrap::after { width: 420px; height: 420px; background: rgba(90,92,240,.18); bottom: -120px; left: -80px; }
.login-box {
  position: relative; z-index: 2;
  width: 384px; max-width: 100%;
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.9);
  border-radius: var(--r-xl);
  padding: 34px 30px;
  box-shadow: var(--shadow-lg);
}
.brand-lockup { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0;
  background: var(--brand-gradient);
  box-shadow: 0 6px 16px rgba(47,84,235,.4);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 19px; letter-spacing: .5px;
}
.login-box h1 { font-size: 22px; font-weight: 700; letter-spacing: -.3px; color: var(--ink-900); }
.login-box .sub { color: var(--ink-500); font-size: 13px; margin: 2px 0 22px; }
.login-box .dev-tip {
  background: var(--amber-bg); border: 1px solid #fde68a; border-radius: var(--r-sm);
  padding: 9px 11px; font-size: 12px; color: #92400e; margin-bottom: 18px; line-height: 1.5;
}

/* ============================================================
   表单
   ============================================================ */
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-600); margin-bottom: 7px; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; border: 1px solid var(--ink-200); border-radius: var(--r-sm);
  padding: 10px 12px; font-size: 14px; color: var(--ink-900);
  background: #fff; outline: none; transition: border-color var(--transition), box-shadow var(--transition);
  font-family: var(--font);
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(58,108,247,.16);
}

/* ============================================================
   按钮
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: var(--r-sm); padding: 10px 18px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  background: var(--brand-gradient); color: #fff;
  box-shadow: 0 3px 10px rgba(47,84,235,.22);
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition), background var(--transition);
  white-space: nowrap; line-height: 1.2;
}
.btn:hover { opacity: 1; box-shadow: 0 6px 18px rgba(47,84,235,.32); transform: translateY(-1px); }
.btn:active { transform: translateY(0); box-shadow: 0 2px 6px rgba(47,84,235,.2); }
.btn.ghost {
  background: #fff; border: 1px solid var(--ink-200); color: var(--ink-700);
  box-shadow: none; font-weight: 500;
}
.btn.ghost:hover { border-color: var(--brand-400); color: var(--brand-600); box-shadow: var(--shadow-sm); }
.btn.danger { background: linear-gradient(135deg,#f87171,#ef4444); box-shadow: 0 3px 10px rgba(239,68,68,.2); }
.btn.danger:hover { box-shadow: 0 6px 16px rgba(239,68,68,.3); }
.btn.sm { padding: 5px 11px; font-size: 12.5px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ============================================================
   主界面布局
   ============================================================ */
.layout { display: flex; min-height: 100vh; background: var(--ink-100); }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: 216px;
  background: linear-gradient(180deg, #101828 0%, #1a2130 100%);
  color: var(--ink-300);
  padding: var(--sp-5) 0;
  flex-shrink: 0;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 700; color: #fff;
  padding: 0 var(--sp-5) var(--sp-4);
  border-bottom: 1px solid rgba(255,255,255,.07);
  margin-bottom: var(--sp-4); letter-spacing: -.2px;
}
.sidebar .brand::before {
  content: "G"; width: 26px; height: 26px; flex-shrink: 0; border-radius: 7px;
  background: var(--brand-gradient); color: #fff; font-size: 13px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.sidebar a {
  position: relative;
  display: block; color: var(--ink-300);
  padding: 11px var(--sp-5); font-size: 14px; font-weight: 500;
  border-left: 3px solid transparent;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}
.sidebar a:hover { color: #fff; background: rgba(255,255,255,.05); }
.sidebar a.active {
  color: #fff; background: rgba(58,108,247,.16);
  border-left-color: var(--brand-400);
}
.sidebar a.active::after {
  content: ""; position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 5px; height: 5px; border-radius: 50%; background: var(--brand-400);
}
.sidebar .logout {
  margin-top: auto; padding: 11px var(--sp-5); font-size: 13px;
  color: var(--ink-400); cursor: pointer; transition: color var(--transition);
  border-top: 1px solid rgba(255,255,255,.06);
}
.sidebar .logout:hover { color: #fff; }

/* ---------- 主内容 ---------- */
.main { flex: 1; padding: var(--sp-6); overflow: auto; min-width: 0; }
.page-title {
  font-size: 21px; font-weight: 700; letter-spacing: -.3px; color: var(--ink-900);
  margin-bottom: var(--sp-4); display: flex; align-items: center; gap: 10px;
}
.page-title::before {
  content: ""; width: 5px; height: 20px; border-radius: 3px;
  background: var(--brand-gradient);
}

/* ============================================================
   卡片
   ============================================================ */
.card {
  background: #fff;
  border: 1px solid var(--ink-100);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card h3 { font-size: 15px; font-weight: 650; color: var(--ink-900); margin-bottom: var(--sp-3); }
.card h3::after { content: ""; display: block; width: 28px; height: 3px; border-radius: 2px; background: var(--brand-gradient); margin-top: 6px; opacity: .85; }

/* ---------- 网格 ---------- */
.grid { display: grid; gap: var(--sp-3); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) { .grid-3, .grid-4, .grid-2 { grid-template-columns: 1fr; } }

/* ---------- 统计卡 ---------- */
.stat {
  position: relative; overflow: hidden;
  background: #fff; border: 1px solid var(--ink-100);
  border-radius: var(--r-lg); padding: var(--sp-4);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}
.stat::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--brand-gradient); opacity: .9;
}
.stat:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat .num {
  font-size: 28px; font-weight: 750; letter-spacing: -.5px;
  font-family: var(--num-font);
  background: linear-gradient(135deg, #2f54eb, #5a5cf0);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.stat .label { color: var(--ink-500); font-size: 12px; font-weight: 500; margin-top: 3px; }

/* ============================================================
   表格
   ============================================================ */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--ink-100); }
thead th {
  background: var(--ink-50); color: var(--ink-500); font-weight: 600; font-size: 12.5px;
  letter-spacing: .2px; white-space: nowrap;
}
tbody tr:nth-child(even) { background: rgba(248,250,252,.5); }
tbody tr:hover td { background: var(--brand-50); }
tbody tr { transition: background var(--transition); }

/* ============================================================
   徽章
   ============================================================ */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.5;
}
.badge.green { background: var(--green-bg); color: #16a34a; }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.gray { background: var(--ink-100); color: var(--ink-500); }
.badge.blue { background: var(--info-bg); color: var(--info); }

/* ============================================================
   提示 / 空态
   ============================================================ */
.tip {
  background: var(--info-bg); border: 1px solid #bfdbfe; border-left: 3px solid var(--info);
  border-radius: var(--r-sm); padding: 11px 13px; font-size: 13px;
  color: #1e40af; margin-bottom: var(--sp-4); line-height: 1.6;
}
.empty { color: var(--ink-400); text-align: center; padding: 28px 0; font-size: 13px; }

/* ============================================================
   登录页登录按钮全宽 / 图片库缩略图统一
   ============================================================ */
#loginBtn { width: 100%; margin-top: 4px; padding: 12px; font-size: 15px; letter-spacing: 2px; }
img { max-width: 100%; }

/* ============================================================
   设计系统 v2.1 —— 主题切换 / 图标 / 进度 / 空态插画
   ============================================================ */

/* ---------- 主题切换按钮（置于侧栏底部） ---------- */
.theme-toggle {
  display: flex; align-items: center; gap: 9px; width: 100%;
  background: none; border: none; cursor: pointer;
  padding: 11px 18px; color: var(--ink-400); font-size: 13px;
  transition: color var(--transition), background var(--transition);
  text-align: left;
}
.theme-toggle:hover { color: #fff; background: rgba(255,255,255,.05); }
.theme-toggle svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ---------- 侧栏导航图标 ---------- */
.sidebar a, .admin-sidebar a { display: flex; align-items: center; gap: 10px; }
.sidebar a svg, .admin-sidebar a svg {
  width: 17px; height: 17px; flex-shrink: 0; opacity: .85;
  stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.sidebar a.active svg, .admin-sidebar a.active svg { opacity: 1; }

/* ---------- 进度条 ---------- */
.progress { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.progress .track {
  flex: 1; height: 8px; border-radius: 999px;
  background: var(--ink-100); overflow: hidden;
}
.progress .bar {
  height: 100%; border-radius: 999px;
  background: var(--brand-gradient);
  transition: width .5s cubic-bezier(.4,0,.2,1);
}
.progress .val { font-size: 12px; color: var(--ink-500); font-weight: 600; min-width: 40px; text-align: right; }

/* ---------- 空态插画 ---------- */
.empty.art {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 34px 12px; color: var(--ink-400); font-size: 13px;
}
.empty.art .art-svg { width: 56px; height: 56px; opacity: .55; }

/* ============================================================
   深色模式（body[data-theme="dark"] 覆盖设计令牌 + 硬编码浅色）
   ============================================================ */
body[data-theme="dark"] {
  background: #0b1220;
  color: var(--ink-900);
  --ink-900: #e2e8f0;
  --ink-700: #cbd5e1;
  --ink-600: #94a3b8;
  --ink-500: #64748b;
  --ink-400: #94a3b8;
  --ink-300: #334155;
  --ink-200: #1e293b;
  --ink-100: #0f172a;
  --ink-50:  #111827;
  --green-bg: #052e16; --red-bg: #450a0a; --amber-bg: #451a03; --info-bg: #172554;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 4px 14px rgba(0,0,0,.45);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
}
/* 卡片与统计卡：深色底 + 深色边框 */
body[data-theme="dark"] .card,
body[data-theme="dark"] .stat,
body[data-theme="dark"] .adm-card { background: #111827; border-color: #1e293b; }
body[data-theme="dark"] .card h3, body[data-theme="dark"] .adm-card h3 { color: #f1f5f9; }
body[data-theme="dark"] .stat .label, body[data-theme="dark"] .stat .num { }
body[data-theme="dark"] table thead th { background: #0f172a; color: #94a3b8; }
body[data-theme="dark"] th, body[data-theme="dark"] td { border-bottom-color: #1e293b; }
body[data-theme="dark"] tbody tr:nth-child(even) { background: rgba(255,255,255,.02); }
body[data-theme="dark"] tbody tr:hover td { background: rgba(58,108,247,.12); }
body[data-theme="dark"] .tip { border-color: #1e3a8a; color: #bfdbfe; }
body[data-theme="dark"] .form-row input, body[data-theme="dark"] .form-row select,
body[data-theme="dark"] .form-row textarea { background: #0f172a; border-color: #1e293b; color: #e2e8f0; }
body[data-theme="dark"] .btn.ghost { background: #1e293b; border-color: #334155; color: #cbd5e1; }
body[data-theme="dark"] .progress .track { background: #1e293b; }
body[data-theme="dark"] .modal .box { background: #111827; border: 1px solid #1e293b; }
body[data-theme="dark"] .login-wrap {
  background:
    radial-gradient(1000px 520px at 12% -10%, rgba(90,92,240,.25), transparent 60%),
    radial-gradient(900px 600px at 110% 110%, rgba(58,108,247,.18), transparent 55%),
    linear-gradient(160deg, #0b1220 0%, #101828 45%, #0f172a 100%);
}
body[data-theme="dark"] .login-box { background: rgba(17,24,39,.88); border-color: rgba(30,41,59,.8); }
body[data-theme="dark"] .login-box .sub { color: #94a3b8; }
body[data-theme="dark"] .empty, body[data-theme="dark"] .ver { color: #64748b; }
body[data-theme="dark"] .dev-tip { background: #451a03; border-color: #92400e; color: #fcd34d; }
body[data-theme="dark"] .site--footer, body[data-theme="dark"] footer { border-top-color: #1e293b; color: #64748b; }

/* 平滑主题过渡 */
body { transition: background .25s, color .25s; }
.card, .stat, .adm-card, table thead th { transition: background .25s, border-color .25s; }

