:root {
  --bg: #f4f7f6;
  --card: #ffffff;
  --line: #dfe7e3;
  --ink: #13221c;
  --muted: #5a6d65;
  --primary: #0f766e;
  --primary-soft: #e6f6f3;
  --accent: #ea580c;
  --danger: #dc2626;
  --shadow: 0 8px 24px rgba(15, 38, 30, 0.06);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
.hidden { display: none !important; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at 15% 15%, rgba(15, 118, 110, 0.14), transparent 40%), var(--bg);
}

.login-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.login-card h1 { margin: 10px 0 6px; font-size: 22px; }
.login-card p { margin: 0 0 18px; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.login-card label { display: block; font-size: 12.5px; font-weight: 700; color: var(--muted); margin: 10px 0 4px; }
.login-card input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px;
}

.error-text { color: var(--danger); font-size: 12.5px; margin-top: 8px; min-height: 18px; }

.brand-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.side-head h2 { margin: 10px 0 12px; font-size: 18px; }

.site-switcher {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  background: #f2f7f5;
  padding: 5px;
  border-radius: 13px;
}

.site-btn {
  border: none;
  background: transparent;
  padding: 9px 11px;
  border-radius: 9px;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}

.site-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.25);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}

.nav-btn {
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: 11px;
  text-align: left;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.nav-btn:hover, .nav-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.side-foot {
  border-top: 1px dashed var(--line);
  padding-top: 12px;
  font-size: 12.5px;
  color: var(--muted);
}

.content {
  padding: 22px 26px 48px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.site-pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 3px 10px;
  border-radius: 999px;
}

.topbar h1 { margin: 6px 0 0; font-size: 22px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.auto-badge { font-size: 12px; color: var(--muted); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.kpi-card small { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.kpi-card strong { display: block; font-size: 26px; margin: 6px 0 4px; color: var(--primary); }
.kpi-card span { font-size: 12px; color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.card h3 { margin: 0 0 12px; font-size: 16px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f4f8f6; color: #193b33; font-weight: 700; white-space: nowrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-soft { background: #ebf3ef; color: var(--ink); }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.badge-green { background: #dcfce7; color: #15803d; }
.badge-orange { background: #ffedd5; color: #c2410c; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-gray { background: #e2e8f0; color: #475569; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; font-size: 13.5px; font-family: inherit;
}

.bars-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 140px;
  padding-top: 12px;
}
.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 24px;
}
.bar-rect {
  width: 100%;
  max-width: 28px;
  background: linear-gradient(180deg, #14b8a6, #0f766e);
  border-radius: 6px 6px 0 0;
  min-height: 4px;
}
.bar-col small { font-size: 10.5px; color: var(--muted); }

#toast-box {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 99;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: #13221c;
  color: #fff;
  padding: 10px 14px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--line); }
  .form-grid { grid-template-columns: 1fr; }
}
