@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

body { font-family: 'Inter', system-ui, -apple-system, sans-serif; }

/* ---------- Card titles ---------- */
.card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.25rem;
}

/* ---------- Grade badge colors ---------- */
.grade-aplus { background: linear-gradient(135deg,#10b981,#047857); color:white; }
.grade-a     { background: linear-gradient(135deg,#22c55e,#15803d); color:white; }
.grade-b     { background: linear-gradient(135deg,#84cc16,#4d7c0f); color:white; }
.grade-c     { background: linear-gradient(135deg,#f59e0b,#b45309); color:white; }
.grade-f     { background: linear-gradient(135deg,#ef4444,#991b1b); color:white; }

/* Header tinting based on grade */
.report-header-aplus { background: linear-gradient(to right, rgba(16,185,129,0.06), transparent); }
.report-header-a     { background: linear-gradient(to right, rgba(34,197,94,0.06), transparent); }
.report-header-b     { background: linear-gradient(to right, rgba(132,204,22,0.06), transparent); }
.report-header-c     { background: linear-gradient(to right, rgba(245,158,11,0.08), transparent); }
.report-header-f     { background: linear-gradient(to right, rgba(239,68,68,0.10), transparent); border-top: 4px solid #dc2626; }

/* ---------- Severity chips (overview) ---------- */
.chip { display:inline-flex; align-items:center; gap:0.4rem; padding: 0.3rem 0.7rem; border-radius:9999px; font-size:0.75rem; font-weight:600; }
.chip-critical { background:#fee2e2; color:#991b1b; }
.chip-warning  { background:#fef3c7; color:#92400e; }
.chip-info     { background:#e0f2fe; color:#075985; }
.chip-ok       { background:#d1fae5; color:#065f46; }

/* ---------- Finding cards (severity grouped) ---------- */
.finding {
  border-radius: 0.75rem;
  border-width: 1px;
  padding: 1rem 1.1rem;
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}
.finding-critical {
  background: #fef2f2;
  border-color: #fca5a5;
  border-left-width: 6px;
  border-left-color: #dc2626;
  box-shadow: 0 1px 3px rgba(220,38,38,0.10);
}
.finding-warning {
  background: #fffbeb;
  border-color: #fcd34d;
  border-left-width: 6px;
  border-left-color: #d97706;
}
.finding-info {
  background: #f0f9ff;
  border-color: #bae6fd;
  border-left-width: 6px;
  border-left-color: #0284c7;
}
.finding-icon { flex-shrink:0; width:2rem; height:2rem; border-radius:0.5rem; display:grid; place-items:center; }
.finding-icon-critical { background:#dc2626; color:white; }
.finding-icon-warning  { background:#d97706; color:white; }
.finding-icon-info     { background:#0284c7; color:white; }

.finding-title { font-weight: 700; font-size:0.98rem; }
.finding-title-critical { color: #7f1d1d; }
.finding-title-warning  { color: #78350f; }
.finding-title-info     { color: #075985; }

.finding-fix {
  margin-top: 0.55rem;
  padding: 0.55rem 0.7rem;
  background: rgba(0,0,0,0.04);
  border-radius: 0.5rem;
  font-size: 0.82rem;
  color: #334155;
}
.finding-fix code { background:#0f172a; color:#a7f3d0; padding:0.1rem 0.35rem; border-radius:0.25rem; font-size:0.78rem; }

/* Group header above each severity */
.group-header {
  display:flex; align-items:center; gap:0.5rem;
  font-size: 0.8rem; font-weight:700; text-transform:uppercase; letter-spacing:0.05em;
  margin-top: 0.25rem; margin-bottom: 0.5rem;
}
.group-header-critical { color:#b91c1c; }
.group-header-warning  { color:#b45309; }
.group-header-info     { color:#0369a1; }

.group-bar { flex:1; height:1px; background: currentColor; opacity: 0.25; }

/* ---------- Protocol list ---------- */
.proto-row { display:flex; align-items:center; gap:0.6rem; padding:0.4rem 0.6rem; border-radius:0.5rem; }
.proto-yes { background:#ecfdf5; color:#065f46; }
.proto-bad { background:#fef2f2; color:#991b1b; }
.proto-no  { background:#f1f5f9; color:#64748b; }
.proto-icon { width:1.2rem; height:1.2rem; flex-shrink:0; }

/* ---------- Chain ---------- */
.chain-item { border:1px solid #e2e8f0; border-radius:0.6rem; padding:0.85rem; background:#f8fafc; position:relative; }
.chain-item.is-leaf { border-left: 4px solid #0ea5e9; }
.chain-item.is-root { border-left: 4px solid #10b981; }
.chain-num { font-weight:700; font-size:0.7rem; color:#64748b; }

/* ---------- Header data list ---------- */
.kv-row { display:flex; flex-direction:column; gap:0.15rem; padding-bottom:0.55rem; border-bottom:1px solid #f1f5f9; }
.kv-row:last-child { border-bottom:0; padding-bottom:0; }
@media (min-width: 640px) { .kv-row { flex-direction: row; gap: 0.75rem; } }
.kv-label { color:#0f172a; font-size:0.85rem; font-weight:600; }
@media (min-width: 640px) { .kv-label { width: 14rem; flex-shrink: 0; } }
.kv-hint { color:#94a3b8; font-size:0.7rem; font-weight:400; margin-top:0.1rem; line-height:1.3; }
.kv-value { flex:1; word-break: break-word; padding-top:0.05rem; }
.kv-mono  { font-family: ui-monospace,SFMono-Regular,Menlo,monospace; font-size: 0.8rem; }

.tag-ok { color:#047857; font-weight:600; }
.tag-bad { color:#b91c1c; font-weight:600; }

/* ---------- AI summary panel ---------- */
.prose-summary { color:#1e293b; line-height:1.6; }
.prose-summary h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #6d28d9;
  margin-top: 1rem;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.prose-summary h4:first-child { margin-top:0; }
.prose-summary h4::before {
  content: '';
  width: 4px;
  height: 1.1rem;
  background: linear-gradient(to bottom, #8b5cf6, #3b82f6);
  border-radius: 2px;
}
.prose-summary p { margin-bottom: 0.6rem; font-size:0.95rem; }
.prose-summary ul { margin: 0.4rem 0 0.6rem 0.5rem; }
.prose-summary li {
  position: relative;
  padding-left: 1.4rem;
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
}
.prose-summary li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: #8b5cf6;
  font-weight: 700;
}
.prose-summary strong { color:#0f172a; font-weight:700; }
.prose-summary code { background:#f1f5f9; color:#1e293b; padding:0.05rem 0.3rem; border-radius:0.25rem; font-size:0.85em; }

/* ---------- Chat bot ---------- */
.chat-msg { padding:0.6rem 0.85rem; border-radius:1rem; max-width:85%; line-height:1.45; }
.chat-bot  { background:#fff; border:1px solid #e2e8f0; align-self:flex-start; border-top-left-radius:0.25rem; }
.chat-user { background:#0a6aa1; color:white; align-self:flex-end; border-top-right-radius:0.25rem; }
.chat-row { display:flex; }
.chat-row.user { justify-content:flex-end; }

.chip-btn {
  background:#eff6ff; color:#0a6aa1; border:1px solid #bfdbfe;
  font-size:0.75rem; padding:0.3rem 0.65rem; border-radius:9999px;
  cursor:pointer; transition: all 0.15s;
}
.chip-btn:hover { background:#dbeafe; border-color:#0a6aa1; }

/* ---------- Print (PDF report) ---------- */
@media print {
  .no-print { display: none !important; }
  body { background: white !important; }
  main { padding: 0 !important; max-width: 100% !important; }
  .print-card { box-shadow: none !important; border: 1px solid #cbd5e1 !important; border-radius: 8px !important; page-break-inside: avoid; margin-bottom: 12px; }
  #modal, #chatPanel, #chatToggle { display: none !important; }
  .finding-critical { border: 2px solid #dc2626 !important; }
  header { border-bottom: 3px solid #0a6aa1 !important; position: static !important; }
  footer { display: none !important; }
}
@page { size: A4; margin: 14mm; }
