:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --color-bg: #f7f8fa;
  --color-surface: #ffffff;
  --color-surface-muted: #f9fafb;
  --color-surface-strong: #eef2ff;
  --color-border: #e5e7eb;
  --color-border-strong: #d1d5db;
  --color-text: #111827;
  --color-text-secondary: #6b7280;
  --color-text-tertiary: #9ca3af;
  --color-primary: #5b5bd6;
  --color-primary-hover: #4b4fc7;
  --color-primary-soft: rgba(91, 91, 214, 0.1);
  --color-success: #059669;
  --color-success-soft: #ecfdf5;
  --color-warning: #d97706;
  --color-warning-soft: #fff7ed;
  --color-danger: #dc2626;
  --color-danger-soft: #fef2f2;
  --color-info: #2563eb;
  --color-info-soft: #eff6ff;
  --color-sidebar: #111827;
  --color-sidebar-secondary: #374151;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 6px 18px rgba(17, 24, 39, 0.08);
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: var(--color-surface-muted);
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}

tbody tr:nth-child(even) {
  background: rgba(249, 250, 251, 0.7);
}

tbody tr:hover {
  background: rgba(238, 242, 255, 0.55);
}

body > footer,
.site-footer {
  padding: 20px 16px 28px;
  text-align: center;
  font-size: 12px;
  color: var(--color-text-tertiary);
}

body > footer a,
.site-footer a {
  color: var(--color-text-tertiary);
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  box-shadow: 0 8px 20px rgba(91, 91, 214, 0.22);
}

.card,
.panel,
.surface-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.panel-header,
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 18px 20px;
  border-bottom: 1px solid var(--color-border);
}

.panel-body {
  padding: 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 14px;
  font-weight: 600;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 10px 20px rgba(91, 91, 214, 0.16);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
}

.btn-secondary {
  border-color: var(--color-border);
  color: var(--color-text);
}

.btn-secondary:hover,
.btn-ghost:hover {
  background: var(--color-surface-muted);
}

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

.btn-danger:hover {
  background: #b91c1c;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
}

.btn-full {
  width: 100%;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: #fff;
  color: var(--color-text);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.textarea {
  min-height: 110px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.input-with-icon {
  position: relative;
}

.input-with-icon .input {
  padding-left: 42px;
}

.input-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  color: var(--color-text-tertiary);
  width: 16px;
  height: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-primary { background: var(--color-primary-soft); color: var(--color-primary); }
.badge-success { background: var(--color-success-soft); color: var(--color-success); }
.badge-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.badge-danger { background: var(--color-danger-soft); color: var(--color-danger); }
.badge-neutral { background: #f3f4f6; color: var(--color-text-secondary); }

.status-success {
  color: var(--color-success);
}

.status-danger {
  color: var(--color-danger);
}

.status-warning {
  color: var(--color-warning);
}

.stat-card {
  padding: 20px;
  min-height: 132px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-card__label {
  font-size: 13px;
  color: var(--color-text-secondary);
}

.stat-card__value {
  font-size: 30px;
  line-height: 1.05;
  font-weight: 700;
  color: var(--color-text);
}

.stat-card__meta {
  font-size: 13px;
  color: var(--color-text-secondary);
}

.empty-state {
  padding: 48px 16px;
  text-align: center;
  color: var(--color-text-secondary);
}

.empty-state svg,
.empty-state i {
  margin-bottom: 12px;
  color: #cbd5e1;
}

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

.table-actions {
  text-align: right;
}

.table-actions .btn,
.table-actions button {
  margin-left: 8px;
}

.page-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.grid-cards {
  display: grid;
  gap: 16px;
}

.hero-note {
  color: var(--color-text-secondary);
  font-size: 14px;
}

.login-shell {
  min-height: calc(100vh - 64px);
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(360px, 0.9fr);
}

.login-brand {
  position: relative;
  overflow: hidden;
  padding: 48px clamp(32px, 6vw, 72px);
  color: #fff;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.22), transparent 36%),
    radial-gradient(circle at bottom right, rgba(167, 139, 250, 0.28), transparent 34%),
    linear-gradient(135deg, #312e81 0%, #4338ca 42%, #5b5bd6 100%);
}

.login-brand::after {
  content: "";
  position: absolute;
  inset: auto -10% -22% auto;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  filter: blur(6px);
}

.login-brand__content {
  position: relative;
  z-index: 1;
  max-width: 560px;
}

.login-brand__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.login-brand h1 {
  margin: 18px 0 12px;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.08;
}

.login-brand p {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
}

.feature-list {
  display: grid;
  gap: 14px;
  margin-top: 36px;
}

.feature-item {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 14px;
  align-items: start;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}

.feature-item__icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.14);
}

.login-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.login-card {
  width: min(100%, 380px);
  padding: 32px;
}

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

.muted-link:hover {
  color: var(--color-primary);
}

.split-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.alert {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
}

.alert-danger {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.alert-info {
  background: var(--color-info-soft);
  color: var(--color-info);
}

.chart-wrap {
  position: relative;
  min-height: 280px;
}

.placeholder-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.placeholder-card {
  padding: 20px;
}

.page-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.page-hero h1,
.page-hero h2,
.page-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.page-subtitle,
.page-hero p {
  margin: 6px 0 0;
  color: var(--color-text-secondary);
  font-size: 14px;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(17, 24, 39, 0.48);
  backdrop-filter: blur(4px);
  z-index: 60;
}

.modal.show,
.modal.flex {
  display: flex;
}

.modal-panel {
  width: min(100%, 760px);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
}

.modal-panel--narrow {
  width: min(100%, 560px);
}

.tab-list {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-text-secondary);
  font-weight: 600;
}

.tab-btn.is-active,
.tab-btn.bg-slate-900 {
  background: var(--color-text);
  color: #fff;
  border-color: var(--color-text);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.selection-card {
  width: 100%;
  padding: 22px;
  text-align: left;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.selection-card:hover {
  transform: translateY(-2px);
  border-color: rgba(91, 91, 214, 0.4);
  box-shadow: var(--shadow-md);
}

.selection-card:disabled {
  opacity: 0.75;
}

.inline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hidden {
  display: none !important;
}

.block { display: block; }
.inline-flex { display: inline-flex; }
.flex { display: flex; }
.grid { display: grid; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1 1 0%; }
.flex-shrink-0 { flex-shrink: 0; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.w-full { width: 100%; }
.w-8 { width: 32px; }
.w-10 { width: 40px; }
.w-12 { width: 48px; }
.w-14 { width: 56px; }
.w-64 { width: 256px; }
.h-8 { height: 32px; }
.h-10 { height: 40px; }
.h-12 { height: 48px; }
.h-14 { height: 56px; }
.min-h-screen { min-height: 100vh; }
.min-w-0 { min-width: 0; }
.max-w-md { max-width: 448px; }
.max-w-2xl { max-width: 672px; }
.max-w-6xl { max-width: 1152px; }
.max-w-7xl { max-width: 1280px; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-4 { padding: 16px; }
.p-5 { padding: 20px; }
.p-6 { padding: 24px; }
.p-8 { padding: 32px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.px-5 { padding-left: 20px; padding-right: 20px; }
.px-6 { padding-left: 24px; padding-right: 24px; }
.py-1 { padding-top: 4px; padding-bottom: 4px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-2\.5 { padding-top: 10px; padding-bottom: 10px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }
.py-8 { padding-top: 32px; padding-bottom: 32px; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.space-y-1 > * + * { margin-top: 4px; }
.space-y-3 > * + * { margin-top: 12px; }
.space-y-4 > * + * { margin-top: 16px; }
.space-y-6 > * + * { margin-top: 24px; }
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }
.rounded-lg { border-radius: 10px; }
.rounded-xl { border-radius: 12px; }
.rounded-2xl { border-radius: 16px; }
.rounded-full { border-radius: 999px; }
.border { border: 1px solid var(--color-border); }
.border-t { border-top: 1px solid var(--color-border); }
.border-b { border-bottom: 1px solid var(--color-border); }
.border-r { border-right: 1px solid var(--color-border); }
.border-slate-100 { border-color: #f1f5f9; }
.border-slate-200,
.border-slate-300 { border-color: var(--color-border); }
.bg-white { background: #fff; }
.bg-slate-50,
.bg-slate-100 { background: var(--color-bg); }
.bg-slate-900 { background: var(--color-text); }
.bg-indigo-50 { background: rgba(91, 91, 214, 0.1); }
.bg-emerald-50 { background: #ecfdf5; }
.bg-amber-50 { background: #fff7ed; }
.bg-purple-50 { background: #f5f3ff; }
.bg-red-50,
.bg-rose-50 { background: #fef2f2; }
.bg-primary { background: var(--color-primary); }
.bg-dark { background: var(--color-sidebar); }
.text-white { color: #fff; }
.text-slate-400 { color: #94a3b8; }
.text-slate-500 { color: var(--color-text-secondary); }
.text-slate-600,
.text-slate-700 { color: #475569; }
.text-slate-800,
.text-slate-900 { color: var(--color-text); }
.text-indigo-600,
.text-primary { color: var(--color-primary); }
.text-blue-500,
.text-blue-600 { color: var(--color-info); }
.text-emerald-500,
.text-emerald-600 { color: var(--color-success); }
.text-amber-500,
.text-amber-600 { color: var(--color-warning); }
.text-red-500,
.text-red-600,
.text-rose-600 { color: var(--color-danger); }
.text-purple-500,
.text-purple-600 { color: #7c3aed; }
.text-xs { font-size: 12px; }
.text-sm { font-size: 14px; }
.text-base { font-size: 16px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }
.text-3xl { font-size: 30px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md,
.shadow-lg,
.shadow-xl,
.shadow-2xl { box-shadow: var(--shadow-md); }
.sticky { position: sticky; }
.fixed { position: fixed; }
.relative { position: relative; }
.absolute { position: absolute; }
.inset-0 { inset: 0; }
.top-0 { top: 0; }
.top-1 { top: 4px; }
.right-1 { right: 4px; }
.z-50 { z-index: 50; }
.transition,
.transition-all,
.transition-colors,
.transition-shadow,
.transition-transform {
  transition: all 0.18s ease;
}

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lg\:grid-cols-3 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.lg\:grid-cols-4 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.xl\:grid-cols-5 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.col-span-full { grid-column: 1 / -1; }
.md\:col-span-2 { grid-column: auto; }

.hover\:bg-white:hover { background: #fff; }
.hover\:bg-slate-50:hover,
.hover\:bg-slate-100:hover { background: var(--color-surface-muted); }
.hover\:bg-slate-800:hover { background: #1f2937; }
.hover\:text-white:hover { color: #fff; }
.hover\:text-slate-600:hover { color: #475569; }
.hover\:border-indigo-400:hover,
.hover\:border-indigo-500:hover { border-color: rgba(91, 91, 214, 0.45); }
.hover\:shadow-md:hover,
.hover\:shadow-lg:hover { box-shadow: var(--shadow-md); }
.hover\:-translate-y-1:hover,
.hover\:-translate-y-0\.5:hover { transform: translateY(-2px); }

.group:hover .group-hover\:bg-primary { background: var(--color-primary); }
.group:hover .group-hover\:text-white { color: #fff; }
.group:hover .group-hover\:bg-emerald-500 { background: var(--color-success); }
.group:hover .group-hover\:bg-amber-500 { background: var(--color-warning); }
.group:hover .group-hover\:bg-purple-500 { background: #7c3aed; }

.focus\:ring-2:focus,
.focus\:ring-primary:focus,
.focus\:ring-indigo-500:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.backdrop-blur-sm {
  backdrop-filter: blur(6px);
}

.bg-black\/50 {
  background: rgba(0, 0, 0, 0.5);
}

.bg-dark\/60 {
  background: rgba(17, 24, 39, 0.6);
}

.min-h-28 {
  min-height: 112px;
}

@media (max-width: 1024px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-brand {
    min-height: 320px;
  }

  .kpi-grid,
  .two-col-form {
    grid-template-columns: 1fr 1fr;
  }

  .lg\:grid-cols-3,
  .lg\:grid-cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .page-hero,
  .split-row {
    flex-direction: column;
    align-items: stretch;
  }

  .two-col-form,
  .kpi-grid,
  .grid-cols-2,
  .md\:grid-cols-2,
  .md\:grid-cols-5,
  .lg\:grid-cols-3,
  .lg\:grid-cols-4,
  .xl\:grid-cols-5 {
    grid-template-columns: 1fr;
  }

  .md\:col-span-2 {
    grid-column: auto;
  }

  .px-6 {
    padding-left: 16px;
    padding-right: 16px;
  }

  th,
  td {
    padding: 12px;
  }
}

@media (min-width: 769px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .md\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .md\:col-span-2 { grid-column: span 2 / span 2; }
}

@media (min-width: 1025px) {
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
  .xl\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}