/* ==================== 全局样式 ==================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #1f2937;
  background: #f0f2f5;
}

/* ==================== 登录页 ==================== */
.login-page {
  position: relative;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.login-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #0c1e3e 0%, #1e3a8a 50%, #2563eb 100%);
  z-index: 0;
}

.login-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(56, 189, 248, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(99, 102, 241, 0.15) 0%, transparent 40%);
}

.login-card {
  position: relative;
  z-index: 1;
  width: 420px;
  padding: 40px;
  background: rgba(255, 255, 255, 0.97);
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.3);
}

.login-title {
  text-align: center;
  margin-bottom: 32px;
}

.login-title .logo {
  font-size: 56px;
  margin-bottom: 8px;
}

.login-title h1 {
  font-size: 22px;
  color: #1e3a8a;
  margin-bottom: 4px;
}

.login-title p {
  color: #6b7280;
  font-size: 12px;
}

.login-tips {
  margin-top: 24px;
  padding: 12px;
  background: #f3f4f6;
  border-radius: 8px;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.7;
}

/* ==================== 主布局 ==================== */
.main-layout {
  height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, #0c1e3e 0%, #1e3a8a 100%) !important;
  color: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo .logo {
  font-size: 32px;
}

.logo-title {
  font-size: 15px;
  font-weight: 600;
}

.logo-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 2px;
}

.sidebar-menu {
  flex: 1;
  background: transparent !important;
  border-right: none !important;
  padding: 12px 0;
  overflow-y: auto;
}

.sidebar-menu .el-menu-item {
  color: rgba(255, 255, 255, 0.85) !important;
  margin: 4px 12px;
  border-radius: 6px;
  height: 44px;
  line-height: 44px;
}

.sidebar-menu .el-menu-item:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
}

.sidebar-menu .el-menu-item.is-active {
  background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%) !important;
  color: #fff !important;
}

/* ==================== 侧边栏子菜单样式 ==================== */
.sidebar-menu .el-sub-menu__title {
  color: rgba(255, 255, 255, 0.85) !important;
  margin: 4px 12px;
  border-radius: 6px;
  height: 44px;
  line-height: 44px;
}

.sidebar-menu .el-sub-menu__title:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
}

.sidebar-menu .el-sub-menu__title span {
  color: inherit !important;
}

.sidebar-menu .el-sub-menu__icon-arrow {
  color: rgba(255, 255, 255, 0.5) !important;
}

.sidebar-menu .el-sub-menu .el-menu-item {
  padding-left: 48px !important;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85) !important;
  background: transparent !important;
  margin: 4px 12px;
  border-radius: 6px;
  height: 44px;
  line-height: 44px;
}

.sidebar-menu .el-sub-menu .el-menu-item:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
}

.sidebar-menu .el-sub-menu .el-menu-item.is-active {
  background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%) !important;
  color: #fff !important;
}

/* 子菜单弹出层背景完全透明，继承侧边栏渐变色 */
.sidebar-menu .el-sub-menu .el-menu {
  background: transparent !important;
}

.sidebar-menu .el-menu.el-menu--inline {
  background: transparent !important;
}

.sidebar-user {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
}

.user-info .name {
  font-size: 13px;
  color: #fff;
}

.user-info .role {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 2px;
}

/* ==================== 顶栏 ==================== */
.topbar {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px !important;
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.time-text {
  color: #6b7280;
  font-size: 13px;
}

/* ==================== 主内容区 ==================== */
.main-content {
  padding: 20px;
  background: #f0f2f5;
  overflow: auto;
}

.page-card {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  margin-bottom: 16px;
}

.page-card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==================== 大屏 ==================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.dashboard-stat {
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #fff;
  padding: 20px;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.dashboard-stat.critical { background: linear-gradient(135deg, #991b1b, #dc2626); }
.dashboard-stat.high { background: linear-gradient(135deg, #9a3412, #ea580c); }
.dashboard-stat.medium { background: linear-gradient(135deg, #854d0e, #ca8a04); }
.dashboard-stat.low { background: linear-gradient(135deg, #166534, #16a34a); }

.dashboard-stat::before {
  content: "";
  position: absolute;
  top: -20px;
  right: -20px;
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}

.dashboard-stat .stat-label {
  font-size: 13px;
  opacity: 0.85;
  margin-bottom: 8px;
}

.dashboard-stat .stat-value {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 4px;
}

.dashboard-stat .stat-unit {
  font-size: 14px;
  opacity: 0.8;
  margin-left: 4px;
}

.dashboard-stat .stat-extra {
  font-size: 12px;
  opacity: 0.75;
  margin-top: 8px;
}

.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.chart-container {
  height: 320px;
}

.chart-title {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}

/* ==================== 表格样式 ==================== */
.alert-table {
  font-size: 13px;
}

.risk-tag {
  font-weight: 600;
}

.risk-tag.critical { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.risk-tag.high { background: #ffedd5; color: #9a3412; border-color: #fdba74; }
.risk-tag.medium { background: #fef3c7; color: #854d0e; border-color: #fcd34d; }
.risk-tag.low { background: #dcfce7; color: #166534; border-color: #86efac; }

/* ==================== 分析详情 ==================== */
.analysis-dimension {
  background: #f9fafb;
  border-left: 4px solid #2563eb;
  padding: 16px;
  border-radius: 4px;
  margin-bottom: 12px;
}

.analysis-dimension h4 {
  color: #1e3a8a;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.analysis-dimension .score {
  font-size: 24px;
  font-weight: 700;
  color: #2563eb;
}

/* ==================== 报告章节 ==================== */
.report-section {
  background: #fff;
  border-radius: 6px;
  padding: 16px 20px;
  margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.report-section h3 {
  color: #1e3a8a;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #2563eb;
  display: inline-block;
  font-size: 15px;
}

.report-section pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  line-height: 1.8;
  color: #374151;
}

/* ==================== 处置按钮组 ==================== */
.disposition-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.disposition-suggestion {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 8px;
  background: #fafafa;
}

.disposition-suggestion.p1 { border-left: 4px solid #dc2626; }
.disposition-suggestion.p2 { border-left: 4px solid #ea580c; }
.disposition-suggestion.p3 { border-left: 4px solid #ca8a04; }

/* ==================== 上传区 ==================== */
.upload-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  padding: 40px;
  text-align: center;
  background: #f9fafb;
  transition: all 0.3s;
  cursor: pointer;
}

.upload-zone:hover {
  border-color: #2563eb;
  background: #eff6ff;
}

.upload-zone .upload-icon {
  font-size: 48px;
  color: #94a3b8;
  margin-bottom: 12px;
}

/* ==================== 知识库 ==================== */
.kb-card {
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid #e5e7eb;
}

.kb-card:hover {
  border-color: #2563eb;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
  transform: translateY(-2px);
}

.kb-card h4 {
  color: #1e3a8a;
  margin-bottom: 4px;
}

.kb-card .kb-meta {
  font-size: 12px;
  color: #6b7280;
  margin-top: 8px;
}

/* ==================== 帮助页 ==================== */
.help-content {
  background: #fff;
  border-radius: 8px;
  padding: 24px 32px;
  line-height: 1.8;
}

.help-content h2 {
  color: #1e3a8a;
  border-left: 4px solid #2563eb;
  padding-left: 12px;
  margin: 24px 0 12px;
}

.help-content pre {
  background: #f3f4f6;
  padding: 12px;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 13px;
}

/* ==================== 响应式 ==================== */
@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .charts-row {
    grid-template-columns: 1fr;
  }
}

/* ==================== 自动告警分析页 ==================== */
.stat-mini-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 16px;
  text-align: center;
  transition: box-shadow 0.2s;
}

.stat-mini-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.stat-mini-value {
  font-size: 24px;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.4;
}

.stat-mini-label {
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
}

.analysis-detail-section {
  margin-bottom: 16px;
}

.analysis-dimension {
  background: #f9fafb;
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 12px;
}

.analysis-dimension h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 14px;
  color: #1f2937;
}

.analysis-dimension .score {
  color: #2563eb;
  font-weight: 600;
}

.disposition-suggestion {
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 8px;
  border: 1px solid #e5e7eb;
}

.disposition-suggestion.p1 {
  border-left: 4px solid #dc2626;
  background: #fef2f2;
}

.disposition-suggestion.p2 {
  border-left: 4px solid #f59e0b;
  background: #fffbeb;
}

.disposition-suggestion.p3 {
  border-left: 4px solid #6b7280;
  background: #f9fafb;
}

/* ==================== 已确认告警行样式（灰色置底） ==================== */
.el-table .alert-row-ack {
  background-color: #f3f4f6 !important;
}
.el-table .alert-row-ack:hover > td.el-table__cell {
  background-color: #e5e7eb !important;
}
.el-table .alert-row-ack td.el-table__cell {
  color: #9ca3af !important;
}
.el-table .alert-row-ack td.el-table__cell .el-tag {
  opacity: 0.5;
}
.el-table .alert-row-ack td.el-table__cell .risk-tag {
  opacity: 0.4;
}

/* ==================== 9.2.5 嵌入表格合计行样式 ==================== */
.el-table .device-summary-row td.el-table__cell {
  background: #eff6ff !important;
  font-weight: 700;
  border-top: 2px solid #2563eb !important;
  border-bottom: 2px solid #2563eb !important;
}
.el-table .device-summary-row td.el-table__cell .el-tag {
  font-size: 14px;
  font-weight: 700;
}
.el-table .device-summary-row:hover td.el-table__cell {
  background: #dbeafe !important;
}

/* ==================== 9.2.6 弹窗明细样式 ==================== */
.popup-detail-dialog .el-dialog__body {
  padding: 12px 20px;
}
.popup-detail-dialog .alert-table {
  font-size: 13px;
}
