/* ── Variables ── */
:root {
  --color-bg: #f4f6f9;
  --color-surface: #ffffff;
  --color-border: #dde3ec;
  --color-text: #1a1f2e;
  --color-text-muted: #6b7280;
  --color-primary: #4bb543;
  --color-primary-hover: #3a9b30;
  --color-score-low: #dc2626;
  --color-badge-bg: #f0fdf4;
  --color-badge-text: #166534;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ── Reset ── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  overflow-x: clip;
}

/* ── Body ── */
body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: clip;
}

/* ── Header (main pages: index, criminalidade) ── */
header {
  background:
    linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.45)),
    url("/bg.png") center / cover no-repeat,
    var(--color-primary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  overflow-x: hidden;
}

.header-top {
  padding: 0.75rem 0 0;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
  min-height: 3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* ── Tab bar ── */
.header-tabs {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  gap: 0.2rem;
  padding: 0 1rem;
  margin-top: 0.5rem;
  position: relative;
  overflow-x: auto;
  scrollbar-width: none;
}

.header-tabs::-webkit-scrollbar {
  display: none;
}

.tab-link[hidden] {
  display: none;
}

.tab-link {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition:
    color 0.15s,
    border-color 0.15s;
  white-space: nowrap;
  line-height: 1.4;
}

.tab-link:hover {
  color: rgba(255, 255, 255, 0.9);
}

.tab-link.active {
  color: #fff;
  border-bottom-color: #fff;
}

header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

header .subtitle {
  font-size: 0.8rem;
  opacity: 0.8;
  margin-top: 0.1rem;
}

/* ── Suporte panel ── */
.suporte-wrap {
  position: relative;
}

.suporte-panel {
  position: fixed;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  padding: 1rem;
  min-width: 200px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.12s ease,
    visibility 0.12s;
}

.suporte-panel.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.suporte-panel-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
}

.btn-suporte-action {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 0.85rem;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.12s,
    border-color 0.12s;
}

.btn-suporte-action:hover {
  background: var(--color-badge-bg);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-card h2 {
  font-size: 1.1rem;
  margin-bottom: 0.4rem;
}

.modal-card p {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  margin-bottom: 1.1rem;
}

.modal-error {
  background: #fee2e2;
  color: var(--color-score-low);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
  margin-bottom: 0.85rem;
}

.modal-card input[type="password"] {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  outline: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.modal-card input[type="password"]:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(75, 181, 67, 0.15);
}

.btn-confirm {
  width: 100%;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.55rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-confirm:hover {
  background: var(--color-primary-hover);
}

.btn-cancel-modal {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.45rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-size: 0.82rem;
  cursor: pointer;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  z-index: 400;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-width: 300px;
  animation: slide-in 0.2s ease;
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toast-success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.toast-error {
  background: #fee2e2;
  color: var(--color-score-low);
  border: 1px solid #fca5a5;
}

/* ── Responsive ── */
@media (max-width: 700px) {
  header h1 {
    font-size: 1.1rem;
    white-space: nowrap;
  }

  header .subtitle {
    display: none;
  }

  .tab-link {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px 6px 0 0;
    border-bottom: none;
    color: rgba(255, 255, 255, 0.75);
  }

  .tab-link:hover {
    background: rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.95);
  }

  .tab-link.active {
    background: var(--color-bg);
    color: var(--color-primary);
    border-bottom: none;
  }
}
