:root {
  --ink: #15211f;
  --muted: #62706d;
  --line: #d8dfdc;
  --paper: #fbfaf5;
  --panel: #ffffff;
  --green: #0f6b55;
  --green-soft: #e4f4ee;
  --amber: #b56a11;
  --amber-soft: #fff0d8;
  --red: #b73535;
  --red-soft: #ffe5e1;
  --blue: #245e8f;
  --blue-soft: #e4eff8;
  --shadow: 0 20px 55px rgba(37, 50, 47, .12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  min-height: 100%;
  margin: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

.app {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
  gap: 28px;
  align-items: stretch;
  min-height: 340px;
  padding: 34px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255,255,255,.92), rgba(255,255,255,.78)),
    url("https://images.unsplash.com/photo-1522083165195-3424ed129620?auto=format&fit=crop&w=1400&q=75") center/cover;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-copy {
  align-self: center;
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 18px;
  font-size: clamp(42px, 6vw, 82px);
  line-height: .96;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 24px;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 14px;
  font-size: 18px;
}

.lede {
  max-width: 690px;
  margin-bottom: 0;
  color: #33403d;
  font-size: 20px;
  line-height: 1.45;
}

.hero-panel {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 14px;
  min-height: 300px;
}

.mini-map {
  position: relative;
  overflow: hidden;
  min-height: 190px;
  border: 1px solid rgba(21,33,31,.2);
  background: rgba(255, 255, 255, .78);
  border-radius: 8px;
}

.mini-map span {
  position: absolute;
  display: block;
  background: rgba(15, 107, 85, .18);
  border: 1px solid rgba(15, 107, 85, .32);
}

.mini-map span:nth-child(1) { inset: 18px auto auto 22px; width: 48%; height: 34px; transform: rotate(-13deg); }
.mini-map span:nth-child(2) { inset: 74px 28px auto auto; width: 62%; height: 28px; transform: rotate(9deg); }
.mini-map span:nth-child(3) { inset: auto auto 48px 34px; width: 76%; height: 32px; transform: rotate(-7deg); }
.mini-map span:nth-child(4) { inset: 18px auto auto 58%; width: 30px; height: 78%; transform: rotate(5deg); }

.mini-map strong {
  position: absolute;
  right: 18px;
  bottom: 14px;
  font-size: 44px;
  color: rgba(21,33,31,.12);
}

.mini-score {
  padding: 18px;
  background: var(--ink);
  color: white;
  border-radius: 8px;
}

.mini-score p,
.mini-score span {
  margin: 0;
  color: rgba(255,255,255,.72);
}

.mini-score strong {
  display: block;
  margin: 4px 0;
  font-size: 34px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 18px;
  margin-top: 18px;
}

.input-panel,
.confirm-panel,
.report-section,
.score-band {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(37, 50, 47, .06);
}

.input-panel,
.confirm-panel {
  padding: 22px;
}

.panel-head,
.section-title,
.actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.upload-box {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-top: 22px;
  padding: 28px;
  border: 1px dashed #a8b5b1;
  background: #f7faf8;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
}

.upload-box input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.upload-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  background: var(--green);
  color: white;
  border-radius: 999px;
  font-size: 28px;
  line-height: 1;
}

.upload-box small {
  max-width: 440px;
  color: var(--muted);
}

.ocr-status {
  min-height: 26px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 14px;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 800;
}

textarea {
  display: block;
  width: 100%;
  min-height: 220px;
  resize: vertical;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  line-height: 1.45;
}

textarea:focus,
input:focus,
select:focus {
  outline: 3px solid rgba(15, 107, 85, .18);
  border-color: var(--green);
}

.actions {
  justify-content: flex-start;
  margin-top: 16px;
}

.compact-actions {
  margin-top: 18px;
}

.primary-btn,
.ghost-btn {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--ink);
  cursor: pointer;
  font-weight: 800;
}

.primary-btn {
  background: var(--ink);
  color: white;
}

.ghost-btn {
  background: white;
  color: var(--ink);
}

.ghost-btn.small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 14px;
}

.pill {
  display: inline-grid;
  min-height: 30px;
  place-items: center;
  padding: 0 10px;
  background: var(--blue-soft);
  color: var(--blue);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
  margin-top: 22px;
}

.form-grid label {
  display: grid;
  gap: 7px;
  color: #34413e;
  font-size: 13px;
  font-weight: 800;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

input,
select {
  min-width: 0;
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 8px;
  color: var(--ink);
}

.results {
  margin-top: 18px;
}

.empty-state {
  display: grid;
  min-height: 150px;
  place-items: center;
  padding: 22px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.72);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.score-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px;
}

.score-band p {
  margin-bottom: 0;
  color: var(--muted);
}

.score-ring {
  display: grid;
  width: 104px;
  height: 104px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 999px;
  background: conic-gradient(var(--green) var(--score, 40%), #edf1ef 0);
  color: var(--ink);
}

.score-ring span {
  align-self: end;
  font-size: 34px;
  font-weight: 900;
}

.score-ring small {
  align-self: start;
  margin-top: -12px;
  color: var(--muted);
  font-weight: 800;
}

.risk-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.risk-card {
  min-height: 160px;
  padding: 18px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 8px;
}

.risk-card strong {
  display: block;
  margin-bottom: 10px;
  font-size: 17px;
}

.risk-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.risk-card.high {
  border-color: #f0b2aa;
  background: var(--red-soft);
}

.risk-card.medium {
  border-color: #e7bf7d;
  background: var(--amber-soft);
}

.risk-card.low {
  border-color: #acd7c7;
  background: var(--green-soft);
}

.report-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
  gap: 14px;
  margin-top: 14px;
}

.report-section {
  padding: 20px;
}

.building-data {
  display: grid;
  gap: 12px;
  color: var(--muted);
}

.building-summary {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.building-summary strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 20px;
}

.building-summary p {
  margin-bottom: 0;
  line-height: 1.45;
}

.building-summary.high {
  border-color: #f0b2aa;
  background: var(--red-soft);
}

.building-summary.medium {
  border-color: #e7bf7d;
  background: var(--amber-soft);
}

.building-summary.low {
  border-color: #acd7c7;
  background: var(--green-soft);
}

.building-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.building-metric {
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #f8faf9;
  border-radius: 8px;
}

.building-metric strong {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
}

.building-metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.building-metric.high {
  border-color: #f0b2aa;
  background: var(--red-soft);
}

.building-metric.medium {
  border-color: #e7bf7d;
  background: var(--amber-soft);
}

.building-metric.low {
  border-color: #acd7c7;
  background: var(--green-soft);
}

.building-subsection {
  padding: 14px;
  border: 1px solid var(--line);
  background: #f8faf9;
  border-radius: 8px;
}

.building-subsection h4 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 15px;
}

.record-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.record-list li {
  padding: 10px;
  color: #34413e;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  line-height: 1.35;
}

.camera-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.camera-card {
  display: grid;
  gap: 8px;
  color: #34413e;
  text-decoration: none;
}

.camera-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e9efed;
}

.camera-card span {
  display: block;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
}

.source-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--green);
  font-weight: 900;
}

.data-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  padding: 12px;
  background: #f8faf9;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.data-row strong {
  color: var(--ink);
}

.message-box {
  min-height: 170px;
  padding: 14px;
  border: 1px solid var(--line);
  background: #f8faf9;
  border-radius: 8px;
  white-space: pre-wrap;
  line-height: 1.5;
}

.check-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  padding: 12px;
  border: 1px solid var(--line);
  background: #f8faf9;
  border-radius: 8px;
}

.source-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 920px) {
  .hero,
  .workspace,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 24px;
  }

  .risk-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .building-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .camera-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 580px) {
  .app {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

  .hero {
    min-height: auto;
    padding: 18px;
  }

  h1 {
    font-size: 42px;
  }

  .lede {
    font-size: 17px;
  }

  .hero-panel {
    min-height: 0;
  }

  .mini-map {
    min-height: 150px;
  }

  .form-grid,
  .risk-grid {
    grid-template-columns: 1fr;
  }

  .building-metrics {
    grid-template-columns: 1fr;
  }

  .score-band,
  .panel-head,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }
}
