/* ========================================================
   本地家园 - 管理后台样式
   ======================================================== */
:root {
  --color-primary: #1677FF;
  --color-primary-dark: #0958D9;
  --color-primary-light: #4096FF;
  --color-primary-bg: #E6F4FF;
  --color-secondary: #722ED1;
  --color-accent: #FF7A45;
  --color-danger: #FF4D4F;
  --color-success: #52C41A;
  --color-warning: #FAAD14;

  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;

  --sider-width: 224px;
  --header-height: 64px;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 2px rgba(15,23,42,0.06);
  --shadow-md: 0 4px 12px rgba(15,23,42,0.08);
  --shadow-lg: 0 8px 24px rgba(15,23,42,0.12);

  --font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
                 "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

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

html, body {
  font-family: var(--font-family);
  color: var(--gray-800);
  background: var(--gray-50);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { font-family: inherit; cursor: pointer; }

/* ===== 后台登录 ===== */
.login-page {
  background: linear-gradient(135deg, #0E2A4F 0%, #1E4A8C 50%, #2E5FBF 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 80% 20%, rgba(114,46,209,0.3) 0%, transparent 50%),
    radial-gradient(circle at 20% 80%, rgba(22,119,255,0.4) 0%, transparent 50%);
  pointer-events: none;
}
.login-page::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}
.login-card {
  position: relative;
  z-index: 2;
  background: #fff;
  border-radius: 16px;
  padding: 48px 40px;
  width: 420px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.4);
}
.login-card .logo-row {
  text-align: center;
  margin-bottom: 32px;
}
.login-card .logo-mark {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, #1677FF, #722ED1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 26px;
  font-weight: 900;
  margin: 0 auto 12px;
  box-shadow: 0 8px 24px rgba(22,119,255,0.35);
}
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-card .sub { color: var(--gray-500); font-size: 13px; }
.login-card .form-group { margin-bottom: 20px; }
.login-card label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--gray-700);
  font-weight: 500;
}
.login-card input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
}
.login-card input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(22,119,255,0.12);
}
.login-card .submit {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #1677FF, #4096FF);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  box-shadow: 0 6px 18px rgba(22,119,255,0.3);
}
.login-card .foot {
  margin-top: 24px;
  text-align: center;
  font-size: 12px;
  color: var(--gray-500);
}

/* ===== 后台主体 ===== */
.layout {
  display: grid;
  grid-template-columns: var(--sider-width) 1fr;
  grid-template-rows: var(--header-height) 1fr;
  grid-template-areas:
    "sider header"
    "sider main";
  min-height: 100vh;
}

.sider {
  grid-area: sider;
  background: #001529;
  color: rgba(255,255,255,0.65);
  display: flex;
  flex-direction: column;
}
.sider-logo {
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
}
.sider-logo .logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #1677FF, #722ED1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 4px 12px rgba(22,119,255,0.35);
}
.sider-menu {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}
.sider-group {
  padding: 12px 20px 6px;
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.sider-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  margin: 2px 0;
  color: rgba(255,255,255,0.65);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.sider-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.04);
}
.sider-link.active {
  color: #fff;
  background: var(--color-primary);
  font-weight: 600;
}
.sider-link .icon { width: 18px; text-align: center; font-size: 16px; }
.sider-link .badge {
  margin-left: auto;
  background: var(--color-danger);
  color: #fff;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
}

.topbar {
  grid-area: header;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}
.topbar-breadcrumb {
  font-size: 13px;
  color: var(--gray-500);
}
.topbar-breadcrumb strong { color: var(--gray-800); }
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar-actions .icon-btn {
  width: 36px;
  height: 36px;
  background: var(--gray-100);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  position: relative;
}
.topbar-actions .icon-btn .dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: var(--color-danger);
  border-radius: 50%;
}
.topbar-actions .admin-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
}
.topbar-actions .admin-chip:hover { background: var(--gray-100); }
.topbar-actions .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1677FF, #722ED1);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}

.main {
  grid-area: main;
  padding: 24px;
  overflow-y: auto;
}

/* ===== 卡片 ===== */
.card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--gray-200);
}
.card-head h2 {
  font-size: 16px;
  font-weight: 700;
}

/* ===== 数据卡 ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--color-primary);
}
.stat-card.green::before { background: var(--color-success); }
.stat-card.orange::before { background: var(--color-warning); }
.stat-card.purple::before { background: var(--color-secondary); }
.stat-card.red::before { background: var(--color-danger); }

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: #fff;
}
.stat-icon.blue { background: linear-gradient(135deg, #1677FF, #4096FF); }
.stat-icon.green { background: linear-gradient(135deg, #52C41A, #95DE64); }
.stat-icon.orange { background: linear-gradient(135deg, #FF7A45, #FFA940); }
.stat-icon.purple { background: linear-gradient(135deg, #722ED1, #B37FEB); }
.stat-icon.red { background: linear-gradient(135deg, #FF4D4F, #FF7875); }

.stat-body { flex: 1; }
.stat-label { font-size: 13px; color: var(--gray-500); }
.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--gray-800);
  margin-top: 4px;
  line-height: 1;
}
.stat-trend {
  font-size: 12px;
  color: var(--color-success);
  margin-top: 4px;
}
.stat-trend.down { color: var(--color-danger); }

/* ===== 图表区 ===== */
.chart-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.chart-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}
.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.chart-head h3 { font-size: 15px; font-weight: 700; }

/* 模拟图表 */
.chart-area {
  height: 280px;
  background: linear-gradient(180deg, #f0f7ff 0%, #fff 100%);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--gray-100);
}
.chart-svg { width: 100%; height: 100%; display: block; }

/* ===== 表格 ===== */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
}
.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
  background: transparent;
}
.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-outline {
  background: #fff;
  border-color: var(--gray-200);
  color: var(--gray-700);
}
.btn-outline:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-danger { background: var(--color-danger); color: #fff; }

.search-input {
  padding: 7px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 13px;
  width: 200px;
}
.select {
  padding: 7px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 13px;
  background: #fff;
  cursor: pointer;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  background: var(--gray-50);
  padding: 12px 16px;
  text-align: left;
  color: var(--gray-600);
  font-weight: 500;
  border-bottom: 1px solid var(--gray-200);
}
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-800);
}
.data-table tr:hover td { background: var(--gray-50); }
.data-table .checkbox { width: 16px; height: 16px; }

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}
.tag.green { background: #F6FFED; color: #389E0D; }
.tag.orange { background: #FFF7E6; color: #D46B08; }
.tag.red { background: #FFF1F0; color: #CF1322; }
.tag.blue { background: #E6F4FF; color: #0958D9; }
.tag.gray { background: var(--gray-100); color: var(--gray-600); }

.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 24px 0 4px;
}
.pagination .page {
  min-width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  padding: 0 10px;
}
.pagination .page.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* 排行榜 */
.rank-list { list-style: none; }
.rank-list li {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px dashed var(--gray-100);
  gap: 12px;
}
.rank-list li:last-child { border-bottom: none; }
.rank-list .rank-num {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: var(--gray-100);
  color: var(--gray-500);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.rank-list .rank-num.top1 { background: linear-gradient(135deg, #FFD666, #FFA940); color: #fff; }
.rank-list .rank-num.top2 { background: linear-gradient(135deg, #BFBFBF, #8C8C8C); color: #fff; }
.rank-list .rank-num.top3 { background: linear-gradient(135deg, #FFC069, #FA8C16); color: #fff; }
.rank-list .rank-name { flex: 1; font-size: 13px; }
.rank-list .rank-value { font-size: 13px; color: var(--color-danger); font-weight: 600; }

/* 表单 */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.form-item { margin-bottom: 0; }
.form-item.full { grid-column: 1 / -1; }
.form-item label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--gray-700);
  font-weight: 500;
}
.form-item label .required { color: var(--color-danger); margin-right: 4px; }
.form-item input,
.form-item select,
.form-item textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: inherit;
}
.form-item input:focus,
.form-item select:focus,
.form-item textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(22,119,255,0.1);
}
.form-item textarea { resize: vertical; min-height: 80px; }
