:root {
  --bg: #ecf1e8;
  --bg-strong: #f8f6ef;
  --surface: rgba(255, 253, 247, 0.92);
  --surface-strong: #fffdf8;
  --line: rgba(31, 48, 39, 0.12);
  --text: #182119;
  --muted: #5d6c61;
  --accent: #d26635;
  --accent-dark: #96431d;
  --success: #2d7c57;
  --error: #b73b33;
  --warning: #a76a16;
  --shadow: 0 26px 60px rgba(32, 47, 35, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(210, 102, 53, 0.16), transparent 24%),
    radial-gradient(circle at bottom right, rgba(45, 124, 87, 0.12), transparent 20%),
    linear-gradient(180deg, var(--bg-strong) 0%, var(--bg) 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

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

img {
  display: block;
  max-width: 100%;
}

.hidden {
  display: none !important;
}

.page-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 24px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: linear-gradient(135deg, rgba(255, 253, 247, 0.96), rgba(245, 238, 220, 0.96));
  box-shadow: var(--shadow);
}

.hero-copy-block {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1,
.panel h2,
.preview-head h3,
.location-box h3 {
  margin: 0;
}

.hero-copy {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(360px, 460px) 1fr;
  gap: 24px;
}

.single-flow {
  display: grid;
  gap: 28px;
}

.phone-stage {
  display: flex;
  justify-content: center;
}

.phone-shell {
  width: min(100%, 430px);
  padding: 14px;
  border-radius: 38px;
  background: linear-gradient(180deg, #1d231e 0%, #2a312b 100%);
  box-shadow:
    0 34px 80px rgba(23, 31, 25, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.phone-notch {
  width: 132px;
  height: 24px;
  margin: 0 auto 12px;
  border-radius: 999px;
  background: #121612;
}

.phone-panel {
  padding: 18px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.98), rgba(247, 242, 231, 0.96));
}

.phone-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.phone-kicker,
.section-kicker {
  margin: 0 0 6px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}

.insight-stack {
  display: grid;
  gap: 24px;
}

.hidden-panels {
  display: none;
}

.results-column {
  display: grid;
  gap: 24px;
}

.panel {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.app-form,
.report-list,
.result-detections {
  display: grid;
  gap: 16px;
}

.field-group {
  display: grid;
  gap: 8px;
}

.field-group label {
  font-weight: 700;
}

.field-help,
.mini-text,
.location-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.two-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

input,
select,
textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid rgba(24, 33, 25, 0.12);
  border-radius: 14px;
  background: var(--surface-strong);
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(210, 102, 53, 0.18);
  border-color: rgba(210, 102, 53, 0.5);
}

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, background 140ms ease;
}

.button:hover {
  transform: translateY(-1px);
  background: var(--accent-dark);
}

.button:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.button.ghost {
  background: rgba(24, 33, 25, 0.08);
  color: var(--text);
}

.button.compact {
  min-height: 36px;
  padding: 0 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 800;
}

.badge.muted {
  background: rgba(24, 33, 25, 0.08);
  color: var(--muted);
}

.badge.success {
  background: rgba(45, 124, 87, 0.14);
  color: var(--success);
}

.badge.warning {
  background: rgba(167, 106, 22, 0.14);
  color: var(--warning);
}

.badge.error {
  background: rgba(183, 59, 51, 0.12);
  color: var(--error);
}

.preview-card,
.location-box,
.result-summary-card,
.report-card,
.detection-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-strong);
}

.preview-card {
  padding: 16px;
}

.preview-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.preview-empty {
  display: grid;
  place-items: center;
  min-height: 240px;
  border: 1px dashed rgba(24, 33, 25, 0.14);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
  padding: 16px;
}

.preview-image {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border-radius: 16px;
  border: 1px solid rgba(24, 33, 25, 0.1);
  background: #f3f0e6;
}

.location-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px;
}

.feedback {
  min-height: 24px;
  margin: 0;
  font-weight: 700;
  color: var(--muted);
}

.feedback.error {
  color: var(--error);
}

.feedback.success {
  color: var(--success);
}

.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.empty-state {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.35);
}

.result-summary-card {
  padding: 18px;
  display: grid;
  gap: 12px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.summary-item {
  padding: 14px;
  border-radius: 14px;
  background: rgba(24, 33, 25, 0.04);
}

.summary-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.86rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.result-links,
.report-links,
.report-meta,
.detection-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.result-links a,
.report-links a {
  color: var(--accent-dark);
  font-weight: 800;
}

.detection-card,
.report-card {
  padding: 18px;
  display: grid;
  gap: 12px;
}

.detection-card h3,
.report-card h3 {
  margin: 0;
  font-size: 1.04rem;
}

.severity-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.severity-chip.leve {
  background: rgba(45, 124, 87, 0.12);
  color: var(--success);
}

.severity-chip.media {
  background: rgba(167, 106, 22, 0.14);
  color: var(--warning);
}

.severity-chip.grave {
  background: rgba(183, 59, 51, 0.12);
  color: var(--error);
}

.history-panel .report-list {
  max-height: 880px;
  overflow: auto;
  padding-right: 4px;
}

.map-page .page-shell {
  padding-bottom: 32px;
}

.map-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
}

.map-sidebar {
  display: grid;
  gap: 16px;
  align-content: start;
}

.map-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-strong);
}

.map-card h3 {
  margin: 0 0 12px;
}

.legend-list,
.mini-stack {
  display: grid;
  gap: 10px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
}

.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(24, 33, 25, 0.08);
}

.legend-dot.leve {
  background: #2f8a5b;
}

.legend-dot.media {
  background: #d98324;
}

.legend-dot.grave {
  background: #c73b30;
}

.map-feedback {
  color: var(--muted);
  line-height: 1.5;
}

.map-stage {
  position: relative;
  display: grid;
  gap: 12px;
}

.leaflet-map {
  min-height: 580px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(24, 33, 25, 0.1);
  background: rgba(255, 255, 255, 0.38);
}

.map-panel {
  padding-bottom: 18px;
}

.popup-card {
  display: grid;
  gap: 6px;
  min-width: 220px;
}

.popup-card span,
.popup-card a {
  font-size: 0.92rem;
}

.popup-card a {
  color: var(--accent-dark);
  font-weight: 800;
}

@media (max-width: 980px) {
  .hero,
  .dashboard-grid,
  .location-box {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 680px) {
  .page-shell {
    width: min(100% - 20px, 100%);
    padding-top: 20px;
  }

  .hero,
  .panel {
    padding: 18px;
    border-radius: 20px;
  }

  .phone-shell {
    padding: 10px;
    border-radius: 30px;
  }

  .phone-panel {
    border-radius: 22px;
  }

  .two-columns,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .form-actions,
  .hero-actions {
    flex-direction: column;
  }

  .button,
  .button.ghost {
    width: 100%;
  }

  .map-layout {
    grid-template-columns: 1fr;
  }
}
