:root {
  --brand: #0057bb;
  --text: #0b1a2b;
  --muted: #64748b;
  --bg: #ffffff;
  --border: #e5e7eb;
  --green: #16a34a;
  --red: #dc2626;
  --gray: #6b7280;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial;
  color: var(--text);
  background: var(--bg);
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

.app-header {
  background: var(--brand);
  color: #fff;
  padding: 16px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.app-header h1 { margin: 0; font-size: 20px; letter-spacing: 0.2px; }
.app-header .source { margin: 4px 0 0; font-size: 13px; opacity: 0.95; }
.app-header a { color: #fff; text-decoration: underline; }

#map { width: 100%; height: 70vh; position: relative; }

/* mapa sem box wrapper */

.legend {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: rgba(255, 255, 255, 0.98);
  padding: 10px 12px;
  border-radius: 8px;
  border-left: 4px solid var(--brand);
  box-shadow: 0 4px 16px rgba(2, 6, 23, 0.15);
  line-height: 1.5;
  font-size: 14px;
  z-index: 1200;
}

.legend.hidden { display: none; }

.legend-toggle {
  position: absolute;
  bottom: 20px;
  right: 20px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(2,6,23,0.15);
  z-index: 1300;
  display: none; /* visível apenas no mobile */
}
.legend-toggle:focus { outline: 2px solid #c7dcff; outline-offset: 2px; }

.legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}

.dot-green { background: var(--green); }
.dot-red   { background: var(--red); }
.dot-gray  { background: var(--gray); }

.popup h3 { margin: 0 0 6px; font-size: 16px; color: var(--brand); }
.popup .muted { color: var(--muted); font-size: 12px; }
.popup .status { font-weight: 600; }
.popup .tag { display: inline-block; padding: 2px 6px; border-radius: 4px; font-size: 12px; margin-left: 6px; }
.popup .tag.green { background: #dcfce7; color: #166534; }
.popup .tag.red   { background: #fee2e2; color: #991b1b; }
.popup .tag.gray  { background: #e5e7eb; color: #374151; }
.popup .history { margin-top: 8px; font-size: 13px; }

.app-footer {
  background: #fff;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding: 12px 0;
  font-size: 13px;
}
.app-footer a { color: var(--brand); text-decoration: none; }
.app-footer a:hover { text-decoration: underline; }
.app-footer .subtitle { margin-top: 4px; }

/* Responsivo (mobile-first) */
@media (max-width: 768px) {
  .app-header { padding: 12px 0; }
  .app-header h1 { font-size: 16px; line-height: 1.2; }
  .container { padding: 0 12px; }
  #map { height: 62vh; }
  .legend {
    top: 56px;
    right: 12px;
    bottom: auto;
    left: auto;
    font-size: 13px;
    padding: 8px 10px;
  }
  .legend .dot { width: 9px; height: 9px; }
  .popup h3 { font-size: 15px; }
  .popup .history { font-size: 12px; }
  .app-footer { font-size: 12px; }
  .legend-toggle { display: inline-block; top: 12px; right: 12px; bottom: auto; }
}

@media (max-width: 480px) {
  .app-header h1 { font-size: 14px; }
  #map { height: 60vh; }
  .legend { font-size: 12px; }
  .legend .dot { width: 8px; height: 8px; }
}
