
:root {
  --teal: #2990A1;
  --teal-dark: #1F6E7B;
  --teal-light: #E5F1F3;
  --black: #1B1B1B;
  --gray: #555;
  --gray-light: #888;
  --light: #F4F6F7;
  --border: #DDE2E5;
  --s1: #C62828;
  --s2: #EF6C00;
  --s3: #F9A825;
  --s4: #558B2F;
  --good: #2E7D32;
  --fair: #F9A825;
  --shadow: 0 1px 3px rgba(0,0,0,.06);
  --shadow-lg: 0 4px 12px rgba(0,0,0,.08);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, Helvetica, sans-serif;
  color: var(--black);
  margin: 0;
  background: #fafbfc;
  line-height: 1.55;
}

/* ============ TOP BAR ============ */
.topbar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 12px 32px;
  display: flex;
  align-items: center;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.topbar img.logo { width: 44px; height: auto; }
.topbar .brand {
  flex: 0 0 auto;
  border-right: 1px solid var(--border);
  padding-right: 18px;
}
.topbar .brand .name { font-weight: 700; font-size: 14px; color: var(--teal-dark); }
.topbar .brand .sub { font-size: 11px; color: var(--gray); }
.topbar nav { flex: 1; display: flex; gap: 4px; flex-wrap: wrap; }
.topbar nav a {
  padding: 8px 14px;
  border-radius: 6px;
  color: var(--gray);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
}
.topbar nav a:hover { background: var(--light); color: var(--teal-dark); }
.topbar nav a.active { background: var(--teal-light); color: var(--teal-dark); }
.topbar .actions { display: flex; gap: 8px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: white;
  color: var(--gray);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.btn:hover { background: var(--light); color: var(--teal-dark); border-color: var(--teal); }
.btn.primary { background: var(--teal); color: white; border-color: var(--teal); }
.btn.primary:hover { background: var(--teal-dark); color: white; }

/* ============ PAGE BANNER ============ */
.page-banner {
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%);
  color: white;
  padding: 32px 40px;
}
.page-banner h1 { margin: 0; font-size: 26px; font-weight: 700; }
.page-banner .sub { font-size: 14px; opacity: .92; margin-top: 6px; }
.page-banner .breadcrumb { font-size: 12px; opacity: .8; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .08em; }

/* ============ CONTENT ============ */
main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 40px 60px 40px;
}
main h2 {
  color: var(--teal);
  border-bottom: 2px solid var(--teal);
  padding-bottom: 6px;
  font-size: 22px;
  margin-top: 36px;
}
main h3 { color: var(--teal-dark); font-size: 17px; margin-top: 24px; }
table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 13px;
  background: white;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
th { background: var(--teal); color: white; text-align: left; padding: 10px 12px; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }

/* ============ CARDS ============ */
.system-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 18px;
  margin: 24px 0;
}
.system-card {
  background: white;
  border-radius: 10px;
  padding: 24px 26px;
  border-left: 6px solid;
  box-shadow: var(--shadow);
}
.system-card.good { border-color: var(--good); }
.system-card.fair { border-color: var(--fair); }
.system-card h4 { margin: 0 0 8px 0; font-size: 16px; color: var(--teal-dark); }
.system-card .rating { font-size: 28px; font-weight: 700; margin: 10px 0 4px 0; }
.system-card.good .rating { color: var(--good); }
.system-card.fair .rating { color: var(--fair); }
.system-card .life { font-size: 13px; color: var(--gray); margin-bottom: 10px; }
.system-card .findings-count { font-size: 12px; color: var(--gray); }
.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 24px 0;
}
.card {
  background: white;
  border-radius: 10px;
  padding: 18px 20px;
  border-left: 5px solid;
  box-shadow: var(--shadow);
}
.card.s1 { border-color: var(--s1); }
.card.s2 { border-color: var(--s2); }
.card.s3 { border-color: var(--s3); }
.card.s4 { border-color: var(--s4); }
.card .count { font-size: 32px; font-weight: 700; line-height: 1; color: var(--black); }
.card .label { font-size: 11px; color: var(--gray); text-transform: uppercase; letter-spacing: .08em; margin-top: 6px; font-weight: 600; }

/* ============ BADGES ============ */
.severity-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  color: white;
  letter-spacing: .04em;
}
.severity-badge.s1 { background: var(--s1); }
.severity-badge.s2 { background: var(--s2); }
.severity-badge.s3 { background: var(--s3); }
.severity-badge.s4 { background: var(--s4); }
.confidence-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  background: var(--light);
  color: var(--black);
  border: 1px solid var(--border);
}
.system-banner {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 12px;
}
.system-banner.modbit { background: var(--good); }
.system-banner.tile { background: var(--fair); }

/* ============ FINDINGS ============ */
.finding {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 18px 0;
  overflow: hidden;
  border-left: 6px solid;
  box-shadow: var(--shadow);
}
.finding.s1 { border-left-color: var(--s1); }
.finding.s2 { border-left-color: var(--s2); }
.finding.s3 { border-left-color: var(--s3); }
.finding.s4 { border-left-color: var(--s4); }
.finding-header {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fbfcfd;
  gap: 12px;
  flex-wrap: wrap;
}
.finding-header .left { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.finding-header .id { font-weight: 700; color: var(--teal-dark); font-size: 14px; }
.finding-header .title { font-weight: 600; font-size: 14px; }
.finding-header .badges { display: flex; gap: 6px; flex-wrap: wrap; }
.finding-body { padding: 16px 20px; }
.finding-body p { margin: 8px 0; font-size: 13px; }
.finding-body .label { font-weight: 700; color: var(--teal-dark); }
.finding-photos {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 20px;
  background: #f9fafb;
  border-top: 1px solid var(--border);
}
.finding-photos img {
  width: 130px;
  height: 100px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: transform .15s;
}
.finding-photos img:hover { transform: scale(1.04); }
.finding-photos figure { margin: 0; display: flex; flex-direction: column; align-items: center; }
.finding-photos figcaption { font-size: 11px; color: var(--gray); margin-top: 4px; }

/* ============ PHOTO GALLERY ============ */
.gallery-filter {
  background: white;
  padding: 14px 18px;
  border-radius: 8px;
  margin: 20px 0;
  box-shadow: var(--shadow);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.gallery-filter label { font-size: 12px; font-weight: 600; color: var(--gray); margin-right: 4px; }
.filter-pill {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 14px;
  background: var(--light);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray);
  user-select: none;
}
.filter-pill.active { background: var(--teal); color: white; border-color: var(--teal); }
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.photo-tile {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.photo-tile img { width: 100%; height: 150px; object-fit: cover; display: block; cursor: pointer; }
.photo-tile .pcap { padding: 10px 12px; font-size: 11px; color: var(--gray); }
.photo-tile .pid { font-weight: 700; color: var(--teal-dark); font-size: 12px; }

/* ============ CALLOUTS ============ */
.callout {
  background: #E3F2FD;
  border-left: 4px solid #1976D2;
  padding: 14px 18px;
  margin: 20px 0;
  font-size: 13px;
  border-radius: 6px;
}
.callout.owner { background: #FFF8E1; border-left-color: #F9A825; }
.callout.good { background: #E8F5E9; border-left-color: var(--good); }
.callout h4 { margin: 0 0 8px 0; color: var(--teal-dark); }

/* ============ INSURER SUMMARY ============ */
.insurer-summary {
  background: white;
  border: 2px solid var(--teal);
  border-radius: 10px;
  padding: 24px 28px;
  margin: 24px 0;
  box-shadow: var(--shadow-lg);
}
.insurer-summary h3 {
  margin-top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.insurer-summary h3 .label {
  font-size: 11px;
  background: var(--teal);
  color: white;
  padding: 3px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
}
.insurer-summary table { margin: 12px 0; box-shadow: none; }
.insurer-summary table th { background: var(--light); color: var(--black); }

/* ============ FOOTER ============ */
footer {
  background: white;
  border-top: 1px solid var(--border);
  padding: 24px 40px;
  margin-top: 60px;
  font-size: 12px;
  color: var(--gray);
  text-align: center;
}
footer .tagline { font-weight: 700; color: var(--teal); }
footer .legal { margin-top: 12px; max-width: 800px; margin-left: auto; margin-right: auto; }

/* ============ DRAWINGS VIEWER ============ */
.drawing-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 20px 0;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.drawing-card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.drawing-card-header h4 { margin: 0; color: var(--teal-dark); font-size: 15px; }
.drawing-card-header .sheet { font-size: 12px; font-weight: 700; background: var(--teal); color: white; padding: 3px 10px; border-radius: 4px; }
.drawing-card-body { padding: 16px 20px; }
.drawing-card-body img { width: 100%; height: auto; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.drawing-card-body p { font-size: 13px; color: var(--gray); margin-top: 12px; }

/* ============ DOWNLOAD CENTER ============ */
.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.download-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--black);
  display: flex;
  flex-direction: column;
  transition: all .15s;
}
.download-card:hover { box-shadow: var(--shadow-lg); border-color: var(--teal); transform: translateY(-2px); }
.download-card h4 { margin: 0 0 6px 0; color: var(--teal-dark); font-size: 15px; }
.download-card .fmt { font-size: 11px; font-weight: 600; color: var(--gray-light); text-transform: uppercase; letter-spacing: .04em; }
.download-card .desc { font-size: 13px; color: var(--gray); margin-top: 8px; }
.download-card .size { font-size: 11px; color: var(--gray-light); margin-top: auto; padding-top: 12px; }

/* ============ LIGHTBOX ============ */
.lightbox {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.92);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.lightbox.active { display: flex; }
.lightbox img { max-width: 95vw; max-height: 90vh; object-fit: contain; }
.lightbox .lb-close {
  position: fixed; top: 16px; right: 24px;
  color: white; font-size: 32px;
  cursor: pointer; background: none; border: none;
}
.lightbox .lb-caption {
  position: fixed; bottom: 16px; left: 0; right: 0;
  text-align: center; color: white; font-size: 13px;
  padding: 0 40px;
}

/* ============ PRINT ============ */
@media print {
  .topbar, footer, .gallery-filter, .actions, .btn { display: none !important; }
  main { padding: 0; max-width: 100%; }
  .page-banner { background: white; color: var(--black); padding: 16px 0; border-bottom: 2px solid var(--teal); }
  .page-banner h1, .page-banner .sub, .page-banner .breadcrumb { color: var(--black); }
  .finding, .system-card, .card, .insurer-summary, .drawing-card { box-shadow: none; break-inside: avoid; }
  body { background: white; }
  .photo-gallery, .system-cards { grid-template-columns: repeat(3, 1fr); }
}

/* ============ MOBILE ============ */
@media (max-width: 768px) {
  .topbar { flex-wrap: wrap; padding: 12px 16px; }
  .topbar .brand { border-right: none; padding-right: 0; }
  main { padding: 20px 16px 40px 16px; }
  .summary-cards { grid-template-columns: repeat(2, 1fr); }
  .page-banner { padding: 24px 20px; }
  .page-banner h1 { font-size: 20px; }
}
