:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #0f766e;
  --danger: #b91c1c;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(160deg, #e7f0ff 0%, var(--bg) 50%, #f3f8f5 100%);
  color: var(--text);
}
.container {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px;
}
.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}
.sidebar {
  background: linear-gradient(180deg, #0f172a 0%, #10233d 100%);
  color: #e2e8f0;
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.sidebar-logo {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #14b8a6 0%, #0f766e 100%);
  color: #ecfeff;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.sidebar-title {
  font-size: 18px;
  font-weight: 700;
}
.sidebar-subtitle {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 4px;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nav-item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: rgba(148, 163, 184, 0.08);
  color: #cbd5e1;
  padding: 12px 14px;
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.22) 0%, rgba(15, 118, 110, 0.4) 100%);
  color: #f8fafc;
  border-color: rgba(45, 212, 191, 0.35);
}
.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.admin-main {
  padding: 28px;
}
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.view-section {
  display: none;
}
.view-section.active {
  display: block;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}
h1, h2, h3 { margin: 0 0 12px; }
label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 6px; }
input, select, textarea, button {
  font: inherit;
}
input, select, textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
}
button {
  border: 0;
  padding: 9px 14px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
}
button.secondary { background: #475569; }
button.danger { background: var(--danger); }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.col { flex: 1; min-width: 180px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); padding: 10px 8px; font-size: 14px; text-align: left; }
th { background: #f9fafb; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #d1fae5;
  color: #065f46;
  font-size: 12px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.stat-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
}
.stat-label {
  font-size: 13px;
  color: var(--muted);
}
.stat-value {
  font-size: 34px;
  font-weight: 700;
  color: #0f172a;
  margin-top: 10px;
}
.chart-card {
  padding: 20px;
}
.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.chart-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #475569;
  font-size: 13px;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #0f766e;
}
.line-chart {
  width: 100%;
  height: 320px;
  display: block;
}
.chart-label-row {
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  gap: 0;
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
}
.chart-label-row span {
  text-align: center;
}
.muted { color: var(--muted); }
.error { color: var(--danger); font-size: 13px; }
.link-btn {
  background: transparent;
  color: #0f172a;
  border: 1px solid var(--line);
  padding: 6px 10px;
}
.password-wrap {
  position: relative;
}
.password-wrap input {
  padding-right: 72px;
  position: relative;
  z-index: 1;
}
.toggle-password-btn {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  z-index: 3;
  pointer-events: auto;
  padding: 4px 10px;
  background: #e2e8f0;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
}

@media (max-width: 960px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    gap: 18px;
  }
  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .nav-item {
    width: auto;
  }
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .admin-main {
    padding: 16px;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .chart-head,
  .page-header,
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}
