/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 14px; background: #f0f2f5; color: #1d2129; }

/* ── Login ────────────────────────────────────────────────── */
.login-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(135deg, #0d1b4b 0%, #1677ff 100%);
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  background: #fff; border-radius: 16px;
  padding: 48px 44px 40px;
  width: 400px; max-width: 92vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  text-align: center;
}
.login-logo { margin-bottom: 16px; display: flex; justify-content: center; }
.login-title { font-size: 22px; font-weight: 700; color: #1d2129; margin-bottom: 4px; }
.login-subtitle { font-size: 13px; color: #86909c; margin-bottom: 28px; }
.login-form { text-align: left; }
.login-field { margin-bottom: 16px; }
.login-field label { display: block; font-size: 13px; color: #4e5969; margin-bottom: 6px; font-weight: 500; }
.login-field input {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid #e5e6eb; border-radius: 8px;
  font-size: 14px; outline: none; transition: border-color .2s;
}
.login-field input:focus { border-color: #1677ff; box-shadow: 0 0 0 3px rgba(22,119,255,.12); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 40px; }
.toggle-pw {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: #86909c; padding: 2px;
}
.toggle-pw:hover { color: #1677ff; }
.login-error { color: #f53f3f; font-size: 13px; margin-bottom: 12px; padding: 8px 12px; background: #fff2f0; border-radius: 6px; border: 1px solid #ffccc7; }
.login-btn {
  width: 100%; height: 44px; background: #1677ff; color: #fff;
  border: none; border-radius: 8px; font-size: 16px; font-weight: 600;
  cursor: pointer; transition: background .2s; margin-top: 4px;
}
.login-btn:hover { background: #0958d9; }
.login-btn:active { background: #003eb3; }

/* ── Navbar ───────────────────────────────────────────────── */
.navbar {
  height: 56px; background: #001529;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.navbar-left { display: flex; align-items: center; gap: 12px; }
.navbar-title { font-size: 18px; font-weight: 700; color: #fff; }
.navbar-tag {
  font-size: 12px; color: rgba(255,255,255,.65);
  background: rgba(255,255,255,.1); border-radius: 4px;
  padding: 2px 8px; margin-left: 4px;
}
.navbar-right { display: flex; align-items: center; gap: 12px; }
.navbar-user { font-size: 13px; color: rgba(255,255,255,.8); }
.btn-logout {
  height: 30px; padding: 0 14px; font-size: 13px;
  background: rgba(255,255,255,.12); color: rgba(255,255,255,.9);
  border: 1px solid rgba(255,255,255,.2); border-radius: 6px;
  cursor: pointer; transition: background .2s;
}
.btn-logout:hover { background: rgba(255,255,255,.22); }

/* ── User menu (avatar + dropdown) ──────────────────────────── */
.user-menu { position: relative; display: flex; align-items: center; gap: 8px; cursor: pointer; }

.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #1677ff, #69b1ff);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
  cursor: pointer; user-select: none; flex-shrink: 0;
  transition: opacity .2s;
}
.user-avatar:hover { opacity: .85; }
.user-avatar.user-avatar-lg {
  width: 44px; height: 44px; font-size: 18px;
}

.user-dropdown {
  display: none; position: absolute; right: 0; top: calc(100% + 10px);
  width: 200px; background: #fff; border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,21,41,.18), 0 2px 8px rgba(0,0,0,.08);
  z-index: 2000; overflow: hidden;
}
.user-dropdown.show { display: block; }

.user-dropdown-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 12px;
}
.user-dropdown-name {
  font-size: 14px; font-weight: 600; color: #1d2129;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-dropdown-divider { height: 1px; background: #f2f3f5; margin: 0 12px; }

.user-dropdown-item {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 16px; font-size: 13px; color: #4e5969;
  cursor: pointer; transition: background .15s;
}
.user-dropdown-item:hover { background: #f5f7fa; color: #1677ff; }
.user-dropdown-item svg { flex-shrink: 0; color: inherit; }

/* ── Filter bar ───────────────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  background: #fff; padding: 16px 24px;
  border-bottom: 1px solid #e5e6eb;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.filter-group { display: flex; align-items: center; gap: 8px; }
.filter-group label { font-size: 13px; color: #4e5969; font-weight: 500; white-space: nowrap; }
.filter-input {
  height: 34px; padding: 0 10px; border: 1px solid #e5e6eb;
  border-radius: 6px; font-size: 13px; outline: none;
  color: #1d2129; transition: border-color .2s;
}
.filter-input:focus { border-color: #1677ff; }
.filter-sep { color: #86909c; font-size: 13px; }
.quick-btns { display: flex; gap: 4px; }
.quick-btn {
  height: 30px; padding: 0 12px; font-size: 13px;
  background: #f2f3f5; color: #4e5969; border: 1px solid #e5e6eb;
  border-radius: 6px; cursor: pointer; transition: all .2s;
}
.quick-btn:hover { color: #1677ff; border-color: #1677ff; background: #e8f3ff; }
.quick-btn.active { color: #1677ff; border-color: #1677ff; background: #e8f3ff; font-weight: 600; }
.btn-query {
  height: 34px; padding: 0 20px; font-size: 14px; font-weight: 600;
  background: #1677ff; color: #fff; border: none;
  border-radius: 6px; cursor: pointer; transition: background .2s;
  margin-left: auto;
}
.btn-query:hover { background: #0958d9; }

/* ── KPI cards ────────────────────────────────────────────── */
.kpi-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  padding: 20px 24px 0;
}
@media (max-width: 1100px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }
.kpi-card {
  background: #fff; border-radius: 10px;
  padding: 20px 20px 18px;
  display: flex; gap: 16px; align-items: flex-start;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  transition: box-shadow .2s;
}
.kpi-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12); }
.kpi-icon {
  width: 48px; height: 48px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.kpi-icon-blue   { background: #e8f3ff; color: #1677ff; }
.kpi-icon-green  { background: #e8ffea; color: #00b42a; }
.kpi-icon-orange { background: #fff7e8; color: #ff7d00; }
.kpi-icon-purple { background: #f0e8ff; color: #7816ff; }
.kpi-body { flex: 1; min-width: 0; }
.kpi-label { font-size: 13px; color: #86909c; margin-bottom: 6px; }
.kpi-value { font-size: 28px; font-weight: 700; color: #1d2129; line-height: 1.1; }
.kpi-sub { font-size: 12px; color: #86909c; margin-top: 4px; }

/* ── Chart grid ───────────────────────────────────────────── */
.chart-row {
  display: flex; gap: 16px; padding: 16px 24px 0;
  flex-wrap: wrap;
}
.chart-card {
  background: #fff; border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  overflow: hidden;
}
.chart-card-half { flex: 1 1 calc(50% - 8px); min-width: 320px; }
.chart-card-quarter { flex: 1 1 calc(25% - 12px); min-width: 240px; }
.chart-header {
  padding: 16px 20px 0;
  display: flex; align-items: center; justify-content: space-between;
}
.chart-title { font-size: 15px; font-weight: 600; color: #1d2129; }
.chart-body { height: 280px; padding: 8px 4px 4px; }

/* ── Table ────────────────────────────────────────────────── */
.table-card {
  background: #fff; border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  margin: 16px 24px 24px; overflow: hidden;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { background: #f7f8fa; }
th {
  padding: 12px 16px; text-align: left;
  font-size: 13px; font-weight: 600; color: #4e5969;
  border-bottom: 1px solid #e5e6eb; white-space: nowrap;
}
td {
  padding: 12px 16px; font-size: 13px; color: #1d2129;
  border-bottom: 1px solid #f2f3f5;
}
tbody tr:hover { background: #f7f8fa; }
tbody tr:last-child td { border-bottom: none; }
.table-empty { text-align: center; color: #86909c; padding: 32px; }
