/* ─── Report Document Styles ─────────────────────────────────────────────────
   Scoped to .report-document — does not affect the rest of the app UI.
   Uses .report-page blocks to simulate A4 pages in the browser.
   @media print hides all app chrome and renders only the report content.
──────────────────────────────────────────────────────────────────────────── */

/* ── Document wrapper ─────────────────────────────────────────────────────── */
.report-document {
  max-width: 794px;
  margin: 24px auto;
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 13px;
  line-height: 1.6;
  color: #1a1a1a;
  background: #f4f4f5;
}

/* ── Individual page block ────────────────────────────────────────────────── */
.report-page {
  background: #ffffff;
  padding: 64px 72px;
  margin-bottom: 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,.12);
  position: relative;
  overflow: hidden;
}

/* ── Watermark CONFIDENCIAL ───────────────────────────────────────────────── */
.report-page::before {
  content: "CONFIDENCIAL";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-35deg);
  font-size: 80px;
  font-weight: 900;
  letter-spacing: .18em;
  color: rgba(220, 38, 38, .04);
  pointer-events: none;
  white-space: nowrap;
  z-index: 0;
}

.report-page > * { position: relative; z-index: 1; }

/* ── Cover page ───────────────────────────────────────────────────────────── */
.report-cover {
  min-height: 900px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-top: 6px solid #dc2626;
}

.report-cover .cover-logo { height: 44px; object-fit: contain; }

.report-cover .cover-title-block { margin-top: 80px; }
.report-cover .cover-type { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: #6b7280; margin-bottom: 8px; }
.report-cover h1 { font-size: 30px; font-weight: 700; margin: 0 0 8px; color: #111827; line-height: 1.25; }
.report-cover .cover-client { font-size: 18px; color: #374151; margin-bottom: 4px; }
.report-cover .cover-project { font-size: 14px; color: #6b7280; }

.report-cover .cover-meta-block { margin-top: 40px; }
.report-cover .cover-meta-table { width: 100%; border-collapse: collapse; }
.report-cover .cover-meta-table td { padding: 6px 0; font-size: 12px; vertical-align: top; }
.report-cover .cover-meta-table td:first-child { color: #6b7280; width: 160px; }
.report-cover .cover-meta-table td:last-child { color: #111827; font-weight: 600; }

.report-cover .cover-class-banner {
  margin-top: 32px;
  padding: 10px 20px;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  color: #dc2626;
  letter-spacing: .1em;
  text-align: center;
}

.report-cover .cover-footer { color: #9ca3af; font-size: 11px; border-top: 1px solid #e5e7eb; padding-top: 16px; }

/* ── Section header ───────────────────────────────────────────────────────── */
.report-section-header {
  border-bottom: 2px solid #dc2626;
  margin-bottom: 24px;
  padding-bottom: 8px;
}
.report-section-header h2 {
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #111827;
  margin: 0;
}
.report-section-header .section-number {
  font-size: 11px;
  color: #9ca3af;
  margin-bottom: 2px;
}

/* ── Page footer ──────────────────────────────────────────────────────────── */
.report-page-footer {
  margin-top: 40px;
  padding-top: 10px;
  border-top: 1px solid #e5e7eb;
  font-size: 10px;
  color: #9ca3af;
  display: flex;
  justify-content: space-between;
}

/* ── Severity badges ──────────────────────────────────────────────────────── */
.sev-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-family: system-ui, sans-serif;
  white-space: nowrap;
}
.sev-critical   { background: #7f1d1d; color: #fef2f2; }
.sev-high       { background: #dc2626; color: #fff; }
.sev-medium     { background: #d97706; color: #fff; }
.sev-low        { background: #2563eb; color: #fff; }
.sev-informational, .sev-info { background: #6b7280; color: #fff; }
.sev-unknown    { background: #d1d5db; color: #374151; }

/* ── Executive summary cards ──────────────────────────────────────────────── */
.report-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.report-summary-card {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 14px 12px;
  text-align: center;
}
.report-summary-card .card-value {
  font-size: 28px;
  font-weight: 700;
  display: block;
  line-height: 1;
  margin-bottom: 4px;
  font-family: system-ui, sans-serif;
}
.report-summary-card .card-label {
  font-size: 11px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-family: system-ui, sans-serif;
}
.report-summary-card.card-critical { border-color: #7f1d1d; }
.report-summary-card.card-critical .card-value { color: #7f1d1d; }
.report-summary-card.card-high { border-color: #dc2626; }
.report-summary-card.card-high .card-value { color: #dc2626; }
.report-summary-card.card-medium { border-color: #d97706; }
.report-summary-card.card-medium .card-value { color: #d97706; }
.report-summary-card.card-low { border-color: #2563eb; }
.report-summary-card.card-low .card-value { color: #2563eb; }
.report-summary-card.card-info { border-color: #6b7280; }
.report-summary-card.card-info .card-value { color: #6b7280; }
.report-summary-card.card-total .card-value { color: #111827; }

/* ── Finding block ────────────────────────────────────────────────────────── */
.finding-block {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin-bottom: 20px;
  overflow: hidden;
}

.finding-block-header {
  padding: 10px 16px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.finding-code { font-family: "Courier New", monospace; font-size: 12px; font-weight: 700; color: #374151; background: #e5e7eb; padding: 2px 6px; border-radius: 3px; }
.finding-title { font-weight: 700; font-size: 13px; flex: 1; min-width: 120px; }

.finding-block-body { padding: 14px 16px; }
.finding-block-body dl { display: grid; grid-template-columns: 140px 1fr; gap: 4px 12px; margin: 0; }
.finding-block-body dt { font-weight: 600; font-size: 12px; color: #6b7280; font-family: system-ui, sans-serif; }
.finding-block-body dd { margin: 0; font-size: 12px; word-break: break-word; }

/* ── Recommendation block ─────────────────────────────────────────────────── */
.recommendation-block {
  margin-top: 12px;
  padding: 10px 14px;
  background: #eff6ff;
  border-left: 4px solid #2563eb;
  border-radius: 0 4px 4px 0;
  font-size: 12px;
}
.recommendation-block strong { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #2563eb; margin-bottom: 4px; font-family: system-ui, sans-serif; }

/* ── Evidence block ───────────────────────────────────────────────────────── */
.evidence-block {
  margin-top: 10px;
  padding: 10px 14px;
  background: #f8fafc;
  border-left: 4px solid #64748b;
  border-radius: 0 4px 4px 0;
  font-size: 12px;
}
.evidence-block strong { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #64748b; margin-bottom: 4px; font-family: system-ui, sans-serif; }
.evidence-block pre { background: #1e2130; color: #e2e8f0; padding: 10px; border-radius: 4px; font-size: 11px; white-space: pre-wrap; word-break: break-all; margin: 6px 0 0; max-height: 180px; overflow: auto; }
.evidence-caption { font-size: 11px; color: #64748b; font-style: italic; margin-top: 4px; font-family: system-ui, sans-serif; }

/* ── Target group ─────────────────────────────────────────────────────────── */
.target-group {
  margin-bottom: 24px;
}
.target-group-header {
  background: #1e2130;
  color: #e2e8f0;
  padding: 8px 14px;
  border-radius: 4px 4px 0 0;
  font-family: "Courier New", monospace;
  font-size: 12px;
  word-break: break-all;
}

/* ── Scope table ──────────────────────────────────────────────────────────── */
.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-family: system-ui, sans-serif;
  margin-top: 12px;
}
.report-table th {
  background: #f3f4f6;
  padding: 7px 10px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #6b7280;
  border-bottom: 1px solid #d1d5db;
}
.report-table td { padding: 7px 10px; border-bottom: 1px solid #f3f4f6; vertical-align: top; }
.report-table tr:last-child td { border-bottom: none; }
.report-table tr:nth-child(even) td { background: #f9fafb; }

/* ── Priority sections ────────────────────────────────────────────────────── */
.priority-block { margin-bottom: 20px; }
.priority-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 6px 12px;
  border-radius: 4px 4px 0 0;
  font-family: system-ui, sans-serif;
}
.priority-immediate { background: #7f1d1d; color: #fff; }
.priority-short     { background: #dc2626; color: #fff; }
.priority-medium    { background: #d97706; color: #fff; }
.priority-low-prio  { background: #2563eb; color: #fff; }
.priority-content   { border: 1px solid #e5e7eb; border-top: none; padding: 12px; border-radius: 0 0 4px 4px; font-size: 12px; }
.priority-content ul { margin: 4px 0; padding-left: 18px; }
.priority-content li { margin-bottom: 4px; }

/* ── Tool runs table ──────────────────────────────────────────────────────── */
.tool-status-ok   { color: #16a34a; font-weight: 700; }
.tool-status-fail { color: #dc2626; font-weight: 700; }
.tool-status-skip { color: #9ca3af; }

/* ── Legal / methodology text ─────────────────────────────────────────────── */
.report-legal-text { font-size: 12px; line-height: 1.8; color: #374151; }
.report-legal-text p { margin-bottom: 14px; }
.report-method-list { font-size: 12px; }
.report-method-list li { margin-bottom: 8px; line-height: 1.6; }

/* ── Conclusion ───────────────────────────────────────────────────────────── */
.conclusion-text { font-size: 13px; line-height: 1.8; }
.conclusion-text p { margin-bottom: 14px; }
.conclusion-sign {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
  font-size: 12px;
  color: #6b7280;
}

/* ── Print styles ─────────────────────────────────────────────────────────── */
@media print {
  html, body { background: white !important; }
  body * { visibility: hidden !important; }
  #reportPreviewContainer,
  #reportPreviewContainer * { visibility: visible !important; }
  #reportPreviewContainer {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    padding: 0 !important;
  }
  .report-document { margin: 0 auto !important; background: white !important; max-width: 100% !important; }
  .report-page {
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 32px 48px !important;
    page-break-after: always !important;
    break-after: page !important;
  }
  .report-cover { page-break-after: always !important; break-after: page !important; }
  .finding-block { page-break-inside: avoid !important; break-inside: avoid !important; }
  .evidence-block pre { max-height: none !important; overflow: visible !important; }
  .no-print { display: none !important; visibility: hidden !important; }
}
