:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  --bg: #eef3ff;
  --card: #ffffff;
  --line: #dfe6fb;
  --text: #1b2559;
  --sub: #5d6690;
  --primary: #4b63ff;
  --primary-dark: #3548d7;
  --danger: #e03c5a;
  --shadow: 0 8px 26px rgba(59, 88, 196, 0.12);
}

body.dark {
  --bg: #0d1530;
  --card: #121d3d;
  --line: #2a376b;
  --text: #e8edff;
  --sub: #aeb9e5;
  --primary: #6c85ff;
  --danger: #ff5f7d;
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 5% -10%, rgba(75, 99, 255, 0.18), transparent 60%),
    radial-gradient(1000px 480px at 95% 0%, rgba(80, 195, 255, 0.16), transparent 60%),
    var(--bg);
}

.topbar {
  background: linear-gradient(120deg, #1b2f8e, #2946c7 45%, #3568ff);
  color: #fff;
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 10px 24px rgba(25, 42, 120, 0.32);
  position: sticky;
  top: 0;
  z-index: 9;
}

.topbar h1 {
  margin: 0;
  font-size: 21px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-dot {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(130deg, #9fd8ff, #d6f0ff);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.2);
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 12px;
  opacity: 0.9;
}

.container {
  max-width: 1380px;
  margin: 26px auto 34px;
  padding: 0 14px;
}

.app-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 220px 1fr;
}

.main-panels {
  min-width: 0;
}

.side-menu {
  position: sticky;
  top: 84px;
  align-self: start;
}

.side-menu h3 {
  margin-bottom: 12px;
}

.side-menu a {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  background: rgba(100, 123, 255, 0.08);
  margin-bottom: 8px;
  transition: all 0.18s ease;
}

.side-menu a:hover {
  background: rgba(100, 123, 255, 0.18);
  transform: translateX(2px);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.glass {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.88));
  backdrop-filter: blur(6px);
}

.grid-form {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: end;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--sub);
  font-size: 14px;
}

input,
select,
button {
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  background: var(--card);
  transition: all 0.2s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: #7f94ff;
  box-shadow: 0 0 0 3px rgba(75, 99, 255, 0.14);
}

button {
  background: linear-gradient(120deg, var(--primary), #6c85ff);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.3px;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(75, 99, 255, 0.3);
}

button:active {
  transform: translateY(0);
  box-shadow: none;
}

button.danger {
  background: linear-gradient(120deg, var(--danger), #f0647a);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  box-shadow: none;
}

.ghost-btn:hover {
  box-shadow: none;
  transform: none;
  background: rgba(255, 255, 255, 0.27);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 10px 0 14px;
}

.kpi-item {
  border-radius: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(107, 134, 255, 0.15), rgba(94, 213, 255, 0.08));
}

.kpi-item p {
  margin: 0;
  color: var(--sub);
}

.kpi-item h3 {
  margin: 8px 0 0;
  font-size: 24px;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 190px;
}

.bar-row {
  display: grid;
  grid-template-columns: 100px 1fr 64px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.bar-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(110, 130, 255, 0.15);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #5d79ff, #57cdf5);
}

.bar-empty {
  color: var(--sub);
  font-size: 13px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1000px;
  overflow: hidden;
  border-radius: 12px;
}

th,
td {
  border: 1px solid var(--line);
  padding: 8px;
  text-align: center;
  font-size: 13px;
}

th {
  background: #eef2ff;
  color: #2d3f9a;
}

tbody tr:nth-child(even) {
  background: #fafcff;
}

tbody tr:hover {
  background: #f0f5ff;
}

.hidden {
  display: none;
}

.hint {
  color: var(--sub);
  font-size: 13px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-top: 12px;
  background: linear-gradient(180deg, #fafcff, #f4f8ff);
}

.session-info {
  font-size: 13px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 8px 10px;
  border-radius: 10px;
}

h2,
h3 {
  margin-top: 0;
}

hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 14px 0;
}

@media (max-width: 860px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .brand-sub {
    display: none;
  }

  .container {
    margin-top: 14px;
  }

  .app-grid {
    grid-template-columns: 1fr;
  }

  .side-menu {
    position: static;
  }

  .card {
    padding: 14px;
    border-radius: 12px;
  }

  .session-info {
    width: 100%;
  }

  .header-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
}
