﻿:root {
  --brand: #2a6dff;
  --brand-hover: #1f5de0;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #1f2937;
  --muted: #667085;
  --border: #e2e8f0;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --radius-sm: 8px;
  --radius-md: 12px;
  --shadow-card: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-soft: 0 2px 10px rgba(15, 23, 42, 0.05);
  --font: "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

#app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

#app.app-login {
  max-width: none;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.brand {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nav button {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav button:hover,
.nav button.active {
  color: var(--brand);
  border-color: rgba(42, 109, 255, 0.4);
  background: rgba(42, 109, 255, 0.08);
}

.userbox {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 20px;
  margin-bottom: 20px;
}

.panel h2 {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 600;
  color: #0f172a;
}

.kpi-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.kpi-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fafcff;
  padding: 14px;
  box-shadow: var(--shadow-soft);
}

.kpi-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.kpi-value {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1.1;
  color: #0f172a;
}

.panel h3,
.panel h4,
.modal h3,
.modal h4 {
  color: #0f172a;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 992px) {
  #app {
    padding: 16px;
  }

  .grid2 {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  padding: 0 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* 统一美化 checkbox */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  flex: 0 0 16px;
  max-width: 16px;
  min-width: 16px;
  height: 16px;
  padding: 0;
  box-sizing: border-box;
  margin: 0;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
  vertical-align: middle;
}

input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  flex: 0 0 16px;
  max-width: 16px;
  min-width: 16px;
  height: 16px;
  padding: 0;
  box-sizing: border-box;
  margin: 0;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  background: #fff;
  display: inline-block;
  cursor: pointer;
  transition: all 0.18s ease;
  vertical-align: middle;
}

input[type="checkbox"]::before {
  content: "";
  width: 10px;
  height: 10px;
  transform: scale(0);
  transition: transform 0.14s ease-in-out;
  box-shadow: inset 1em 1em #fff;
  clip-path: polygon(14% 44%, 0 59%, 44% 100%, 100% 24%, 84% 8%, 43% 62%);
}

input[type="radio"]::before {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  margin: 3px;
  border-radius: 50%;
  background: #fff;
  transform: scale(0);
  transition: transform 0.14s ease-in-out;
}

input[type="checkbox"]:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

input[type="radio"]:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

input[type="checkbox"]:checked {
  border-color: var(--brand);
  background: var(--brand);
}

input[type="radio"]:checked {
  border-color: var(--brand);
  background: var(--brand);
}

input[type="checkbox"]:checked::before {
  transform: scale(1);
}

input[type="radio"]:checked::before {
  transform: scale(1);
}

input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(42, 109, 255, 0.18);
}

input[type="radio"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(42, 109, 255, 0.18);
}

input[type="checkbox"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

input[type="radio"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

input,
select {
  height: 40px;
}

textarea {
  min-height: 96px;
  padding: 10px 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(42, 109, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(42, 109, 255, 0.14);
}

.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.row > div {
  flex: 1;
  min-width: 160px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 88px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}

.btn-ghost {
  background: #fff;
  border-color: var(--border);
  color: #334155;
}

.btn-ghost:hover:not(:disabled) {
  border-color: #cbd5e1;
  background: var(--surface-soft);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
}

.btn-sm {
  height: 34px;
  min-width: auto;
  padding: 0 10px;
  font-size: 13px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 13px;
  vertical-align: middle;
}

th {
  background: #f8fafc;
  color: #475467;
  font-weight: 600;
}

tbody tr:hover td {
  background: #f9fbff;
}

tbody tr:last-child td {
  border-bottom: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(42, 109, 255, 0.12);
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
}

.badge.low {
  background: #f1f5f9;
  color: #64748b;
}

.badge.medium {
  background: #fff7ed;
  color: #ea580c;
}

.badge.high {
  background: #ecfdf3;
  color: #16a34a;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.error {
  color: #dc2626;
  margin-top: 8px;
  font-size: 13px;
}

.login-stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 18%, rgba(99, 102, 241, 0.26) 0%, transparent 42%),
    radial-gradient(circle at 82% 82%, rgba(59, 130, 246, 0.2) 0%, transparent 40%),
    linear-gradient(140deg, #050914 0%, #0a1020 38%, #160f2d 100%);
}

.login-stage::before,
.login-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.login-stage::before {
  background:
    radial-gradient(520px circle at 78% 24%, rgba(116, 94, 255, 0.28), transparent 68%),
    radial-gradient(460px circle at 18% 72%, rgba(0, 180, 255, 0.16), transparent 70%);
  filter: blur(2px);
}

.login-stage::after {
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.022) 0px,
    rgba(255, 255, 255, 0.022) 1px,
    transparent 1px,
    transparent 2px
  );
  opacity: 0.35;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(100%, 460px);
  margin: 0 auto;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.78), rgba(30, 41, 59, 0.56));
  box-shadow:
    0 28px 70px rgba(2, 6, 23, 0.55),
    0 1px 0 rgba(255, 255, 255, 0.12) inset;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: 28px;
  animation: loginCardEnter 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.login-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #7c86ff, #53b8ff);
  color: #f8fbff;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  text-align: center;
  
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.6px;
  box-shadow: 0 12px 30px rgba(82, 146, 255, 0.36);
}

.login-brand h1 {
  margin: 0;
  color: #f8fafc;
  font-size: 29px;
  line-height: 1.2;
  letter-spacing: 0.2px;
}

.app-login .muted {
  color: rgba(226, 232, 240, 0.76);
}

.app-login .tabs {
  display: flex;
  gap: 8px;
  padding: 5px;
  margin-bottom: 16px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 12px;
}

.app-login .tabs button {
  flex: 1;
  height: 38px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(203, 213, 225, 0.85);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.22s ease;
}

.app-login .tabs button.active {
  color: #f8fbff;
  background: linear-gradient(130deg, rgba(96, 165, 250, 0.38), rgba(129, 140, 248, 0.36));
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.28);
}

.login-pane {
  animation: paneFadeIn 0.26s ease;
}

.app-login label {
  color: rgba(226, 232, 240, 0.84);
  margin-bottom: 7px;
}

.app-login input {
  border-color: rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.5);
  color: #f8fafc;
}

.app-login input::placeholder {
  color: rgba(148, 163, 184, 0.72);
}

.app-login input:focus {
  border-color: rgba(96, 165, 250, 0.65);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2), 0 0 26px rgba(56, 189, 248, 0.2);
}

.app-login .error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(248, 113, 113, 0.45);
  background: rgba(127, 29, 29, 0.26);
  color: #fecaca;
}

#login-err:empty {
  display: none;
}

.app-login .btn {
  border-radius: 10px;
}

.app-login .btn-primary {
  position: relative;
  border: none;
  font-weight: 600;
  background: linear-gradient(135deg, #4f7dff 0%, #4ac4ff 100%);
  color: #f8fbff;
  box-shadow: 0 12px 30px rgba(59, 130, 246, 0.36);
}

.app-login .btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow: 0 18px 34px rgba(59, 130, 246, 0.42);
}

.app-login .btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.app-login .btn.is-loading {
  pointer-events: none;
}

.app-login .btn.is-loading .btn-label {
  opacity: 0.88;
}

.app-login .btn.is-loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

.hidden {
  display: none !important;
}

@keyframes loginCardEnter {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes paneFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bar-label {
  width: 120px;
  flex-shrink: 0;
  color: #475467;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-track {
  flex: 1;
  height: 20px;
  border-radius: 999px;
  background: #edf2f7;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2a6dff 0%, #4e8bff 100%);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal {
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 14px 48px rgba(15, 23, 42, 0.16);
  padding: 20px;
}

.modal h3 {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 600;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-list label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
  color: #334155;
}

.pager {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.toast-wrap {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  min-width: 220px;
  max-width: 420px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
  box-shadow: var(--shadow-card);
  font-size: 13px;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(-8px);
  transition: all 0.2s ease;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.toast-success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.toast.toast-error {
  border: 2px solid #ef4444;
  background: #fef2f2;
  color: #991b1b;
  box-shadow: 0 10px 26px rgba(220, 38, 38, 0.28);
}

.toast.toast-warning {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.toast.toast-info {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.toast-icon {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex: 0 0 18px;
  margin-top: 1px;
  background: rgba(255, 255, 255, 0.65);
}

.toast-text {
  flex: 1;
  word-break: break-word;
}
