.severity-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  letter-spacing: 0.3px;
  color: white;
}
.severity-P0 { background: #dc2626; }
.severity-P1 { background: #ea580c; }
.severity-P2 { background: #ca8a04; }
.severity-P3 { background: #64748b; }

body { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; }
.font-mono { font-family: "SF Mono", Menlo, Consolas, monospace; }

/* Report type badges */
.report-type-badge {
  display: inline-block;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 9999px;
  color: white;
}
.report-type-daily { background: #3b82f6; }
.report-type-weekly { background: #10b981; }
.report-type-monthly { background: #8b5cf6; }

/* Lifecycle badges */
.lifecycle-new { display: inline-block; padding: 1px 8px; font-size: 11px; font-weight: 600; border-radius: 4px; background: #10b981; color: white; }
.lifecycle-worse { display: inline-block; padding: 1px 8px; font-size: 11px; font-weight: 600; border-radius: 4px; background: #dc2626; color: white; }
.lifecycle-stable { display: inline-block; padding: 1px 8px; font-size: 11px; font-weight: 600; border-radius: 4px; background: #94a3b8; color: white; }
.lifecycle-better { display: inline-block; padding: 1px 8px; font-size: 11px; font-weight: 600; border-radius: 4px; background: #3b82f6; color: white; }

/* TOC active state */
.toc-active {
  color: #2563eb !important;
  font-weight: 600;
  border-left: 2px solid #2563eb;
  margin-left: -13px;
  padding-left: 11px;
}

/* Report prose styles */
.report-prose { line-height: 1.75; color: #334155; }
.report-prose h1 { font-size: 1.75rem; font-weight: 700; margin: 1.5rem 0 1rem; color: #0f172a; }
.report-prose h2 { font-size: 1.375rem; font-weight: 700; margin: 2rem 0 0.75rem; padding-bottom: 0.5rem; border-bottom: 1px solid #e2e8f0; color: #0f172a; }
.report-prose h3 { font-size: 1.125rem; font-weight: 600; margin: 1.5rem 0 0.5rem; color: #1e293b; }
.report-prose h4 { font-size: 1rem; font-weight: 600; margin: 1.25rem 0 0.5rem; color: #334155; }
.report-prose p { margin: 0.75rem 0; }
.report-prose ul, .report-prose ol { margin: 0.75rem 0; padding-left: 1.5rem; }
.report-prose ul { list-style-type: disc; }
.report-prose ol { list-style-type: decimal; }
.report-prose li { margin: 0.25rem 0; }
.report-prose blockquote {
  border-left: 4px solid #3b82f6;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  background: #f8fafc;
  color: #475569;
  border-radius: 0 4px 4px 0;
}
.report-prose table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.875rem; }
.report-prose table th { background: #f1f5f9; padding: 0.5rem 0.75rem; text-align: left; font-weight: 600; border: 1px solid #e2e8f0; }
.report-prose table td { padding: 0.5rem 0.75rem; border: 1px solid #e2e8f0; }
.report-prose table tr:hover td { background: #f8fafc; }
.report-prose table { display: block; overflow-x: auto; }
.report-prose code { background: #f1f5f9; padding: 0.125rem 0.375rem; border-radius: 4px; font-size: 0.85em; }
.report-prose pre { background: #1e293b; color: #e2e8f0; padding: 1rem; border-radius: 8px; overflow-x: auto; margin: 1rem 0; }
.report-prose pre code { background: none; padding: 0; color: inherit; }
.report-prose a { color: #2563eb; text-decoration: underline; }
.report-prose hr { border: none; border-top: 1px solid #e2e8f0; margin: 2rem 0; }
.report-prose strong { font-weight: 700; color: #0f172a; }

/* Print styles */
@media print {
  .print\:hidden { display: none !important; }
  .report-prose { box-shadow: none; padding: 0; }
  body { background: white; }
}

/* ==========================================================================
   报告仪表盘 — 补充样式
   ========================================================================== */

/* --- 1. 右侧抽屉相关 --- */
body.drawer-open {
  overflow: hidden;
}

/* 情绪分布水平条 */
.emotion-bar {
  display: flex;
  height: 20px;
  border-radius: 9999px;
  overflow: hidden;
}
.emotion-bar > div {
  transition: width 0.4s ease;
}

/* 证据引用块 */
.evidence-block {
  border-left: 4px solid #cbd5e1;
  border-radius: 0 8px 8px 0;
  padding: 0.5rem 0.75rem;
  background: #f8fafc;
  margin-bottom: 0.75rem;
}
.evidence-block.grade-A { border-left-color: #10b981; background: rgba(16,185,129,0.05); }
.evidence-block.grade-B { border-left-color: #3b82f6; background: rgba(59,130,246,0.05); }

/* --- 2. KPI 卡片增强 --- */
.kpi-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.kpi-card .kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  background: linear-gradient(135deg, #1e293b 0%, #475569 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* P0 告警脉冲动画 */
@keyframes pulse-border {
  0%, 100% { border-color: #fecaca; }
  50% { border-color: #ef4444; }
}
.kpi-card-p0 {
  animation: pulse-border 2s ease-in-out infinite;
}

/* --- 3. 图表容器 --- */
.chart-container {
  background: #fff;
  border-radius: 0.75rem;
  padding: 1.25rem;
  border: 1px solid #f1f5f9;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.chart-container h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.75rem;
}
.chart-container canvas {
  width: 100% !important;
}

/* --- 4. 问题卡片（周报/月报卡片网格） --- */
.issue-card {
  border-left: 4px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 1rem;
  background: #fff;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}
.issue-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}
.issue-card[data-severity="P0"] { border-left-color: #EF4444; }
.issue-card[data-severity="P1"] { border-left-color: #F97316; }
.issue-card[data-severity="P2"] { border-left-color: #EAB308; }
.issue-card[data-severity="P3"] { border-left-color: #9CA3AF; }

.issue-card .badge {
  display: inline-block;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  color: white;
}

/* --- 5. 问题列表表格（日报） --- */
.issue-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.issue-table-wrap table tbody tr {
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.issue-table-wrap table tbody tr:hover {
  background-color: #f8fafc;
}

/* --- 6. 告警条样式 --- */
.alert-bar {
  border-left: 4px solid;
  border-radius: 0.5rem;
  padding: 1rem;
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}
.alert-bar:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.alert-bar-p0 {
  border-left-color: #EF4444;
  background: #fef2f2;
}
.alert-bar-p1 {
  border-left-color: #F97316;
  background: #fff7ed;
}

@keyframes alert-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
.alert-bar-p0 .severity-badge {
  animation: alert-pulse 2s ease-in-out infinite;
}

/* --- 7. 骨架屏动画 --- */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

/* --- 8. 响应式适配 --- */
@media (max-width: 640px) {
  /* KPI 卡片 2 列 */
  .kpi-grid-mobile {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  /* 图表区域单列 */
  .chart-grid-mobile {
    grid-template-columns: 1fr !important;
  }
  /* 表格横向滚动 */
  .issue-table-wrap {
    margin-left: -1rem;
    margin-right: -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }
  /* 抽屉宽度 100vw */
  .drawer-panel {
    width: 100vw !important;
  }
}

@media (max-width: 1024px) {
  /* 平板：周报/月报 KPI 卡片改 3 列 */
  .kpi-grid-tablet {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  .drawer-panel {
    width: 85vw !important;
  }
}

@media print {
  /* 打印时隐藏抽屉、导航栏、交互按钮 */
  nav,
  .drawer-panel,
  .drawer-overlay,
  button,
  .print\:hidden {
    display: none !important;
  }
  body {
    background: white !important;
  }
  .chart-container {
    box-shadow: none;
    border: 1px solid #e2e8f0;
  }
}

/* --- 9. 过渡动画 --- */
/* Tab 切换淡入淡出 */
.tab-fade-enter {
  opacity: 0;
  transform: translateY(4px);
}
.tab-fade-enter-active {
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.tab-fade-enter-to {
  opacity: 1;
  transform: translateY(0);
}

/* 卡片入场交错动画 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.card-stagger {
  animation: fadeInUp 0.4s ease forwards;
  opacity: 0;
}
.card-stagger:nth-child(1) { animation-delay: 0.05s; }
.card-stagger:nth-child(2) { animation-delay: 0.10s; }
.card-stagger:nth-child(3) { animation-delay: 0.15s; }
.card-stagger:nth-child(4) { animation-delay: 0.20s; }
.card-stagger:nth-child(5) { animation-delay: 0.25s; }
.card-stagger:nth-child(6) { animation-delay: 0.30s; }
.card-stagger:nth-child(7) { animation-delay: 0.35s; }
.card-stagger:nth-child(8) { animation-delay: 0.40s; }
.card-stagger:nth-child(9) { animation-delay: 0.45s; }

/* --- 10. 报告列表页卡片 --- */
.report-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.report-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(0,0,0,0.10);
}

/* 报告类型 badge 颜色 */
.report-badge-daily {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}
.report-badge-weekly {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}
.report-badge-monthly {
  background: #f5f3ff;
  color: #7c3aed;
  border: 1px solid #c4b5fd;
}

/* Tab 筛选栏选中态 */
.filter-tab {
  transition: all 0.2s ease;
  border-radius: 9999px;
  padding: 0.375rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
}
.filter-tab.active {
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
