:root {
  --sidebar-width: 240px;
  --primary: #4f46e5;
  --bg: #f1f5f9;
  --card-shadow: 0 1px 3px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: #1e293b;
}

.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #1e1b4b 0%, #312e81 100%);
  color: #fff;
  padding: 1.25rem 0;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 0 1.25rem 1.5rem;
  font-size: 1.15rem;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,.1);
  margin-bottom: .5rem;
}

.sidebar-brand i { font-size: 1.4rem; color: #a5b4fc; }

.sidebar .nav-link {
  color: rgba(255,255,255,.75);
  padding: .65rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  transition: all .2s;
  border-left: 3px solid transparent;
}

.sidebar .nav-link:hover { color: #fff; background: rgba(255,255,255,.08); }
.sidebar .nav-link.active { color: #fff; background: rgba(255,255,255,.12); border-left-color: #a5b4fc; }

.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2rem;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-title { margin: 0; font-size: 1.35rem; font-weight: 600; }

.content-area { padding: 1.5rem 2rem 2rem; }

.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--card-shadow);
  transition: transform .2s;
}

.stat-link {
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}

.stat-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
}

.stat-card.stat-link:hover { transform: translateY(-2px); }

.stat-card:hover { transform: translateY(-2px); }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: .85rem; color: #64748b; }

.card {
  border: none;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
}

.card-header {
  background: #fff;
  border-bottom: 1px solid #f1f5f9;
  font-weight: 600;
  padding: .85rem 1.25rem;
  border-radius: 12px 12px 0 0 !important;
}

.chart-card .card-body { padding: 1rem 1.25rem; }

.sparkline {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 24px;
  min-width: 56px;
}

.sparkline i {
  display: inline-block;
  width: 6px;
  background: rgba(79, 70, 229, .65);
  border-radius: 2px 2px 0 0;
}

.alert-item.level-critical { border-left: 4px solid #dc2626; }
.alert-item.level-high { border-left: 4px solid #ef4444; }
.alert-item.level-medium { border-left: 4px solid #f59e0b; }
.alert-item.level-low { border-left: 4px solid #3b82f6; }

.result-score { font-size: 3.5rem; font-weight: 800; line-height: 1; }

.hotword-cloud { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: baseline; }
.hotword-tag {
  display: inline-block; padding: .2rem .6rem; border-radius: 20px;
  background: #fef2f2; color: #dc2626; font-weight: 500;
}
.hotword-tag small { opacity: .6; margin-left: 2px; }

@media print {
  .sidebar, .top-bar, .btn { display: none !important; }
  .main-content { margin-left: 0 !important; }
}

.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4f46e5 100%);
}
.login-card {
  width: 100%; max-width: 400px; padding: 2rem;
  background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.table th { font-weight: 600; font-size: .85rem; color: #64748b; border-bottom-width: 1px; }
.table td { vertical-align: middle; font-size: .9rem; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .3s; width: 240px; z-index: 1050; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-brand span, .sidebar .nav-link { /* keep text visible when open */ }
  .main-content { margin-left: 0; }
  .content-area { padding: 1rem; }
  .sidebar-toggle { position: fixed; top: 12px; left: 12px; z-index: 1040; }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1045; }
  .sidebar-overlay.show { display: block; }
  .top-bar { padding-left: 3.5rem; }
}

.collect-cooldown-hint {
  border-left: 3px solid #f59e0b;
  background: #fffbeb;
  color: #92400e;
}

.collect-cooldown-hint .bi-hourglass-split {
  opacity: 0.85;
}

.collect-cooldown-hint-clickable:hover,
.collect-cooldown-badge[role="status"]:not(.d-none) {
  filter: brightness(0.97);
}
