* {
  box-sizing: border-box;
  font-family: Arial, Helvetica, sans-serif;
}

html,
body {
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: #f4f6f9;
  color: #222;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* Dashboard: usa largura da janela (evita tabela espremida em colunas estreitas) */
.container.dashboard-layout {
  max-width: none;
  width: 100%;
  padding: 24px clamp(16px, 3vw, 56px);
  box-sizing: border-box;
}

.header {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  position: relative;
}

.global-header {
  margin-bottom: 24px;
}

.brand {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  min-width: 0;
  width: 100%;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.logo {
  height: 180px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
  margin: 0 auto;
}

.brand h1 {
  display: none;
}

.header-actions {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

h1,
h2 {
  margin: 0 0 12px;
}

h2 {
  font-size: 20px;
  color: #19224a;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

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

.full {
  grid-column: 1 / -1;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
  font-size: 14px;
  color: #19224a;
}

.label-with-help {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.help-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #19224a;
  color: #fff;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
}

.help-tooltip-content {
  position: absolute;
  top: 30px;
  left: 0;
  z-index: 20;
  width: 240px;
  background: #fff;
  border: 1px solid #dbe2ea;
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: all 0.2s ease;
}

.help-tooltip:hover .help-tooltip-content,
.help-tooltip:focus-within .help-tooltip-content {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.help-example-image {
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  margin-bottom: 8px;
}

.help-tooltip-text {
  display: block;
  font-size: 12px;
  line-height: 1.4;
  color: #334155;
}

input,
select,
textarea,
button {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 16px;
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #19224a;
  box-shadow: 0 0 0 3px rgba(25, 34, 74, 0.08);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.btn {
  background: #19224a;
  color: white;
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 15px;
  transition: opacity 0.2s ease;
}

.btn:hover {
  opacity: 0.95;
}

.btn-secondary {
  background: #475569;
  color: white;
  padding: 10px 16px;
  border-radius: 8px;
}

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

.alert.success {
  background: #dcfce7;
  color: #166534;
}

.alert.error {
  background: #fee2e2;
  color: #991b1b;
}

.form-hint {
  font-size: 14px;
  color: #64748b;
  margin: 0 0 12px;
  line-height: 1.45;
}

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

.checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: normal;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
}

.checkbox-item input {
  width: auto;
  min-height: auto;
  margin-top: 2px;
}

.checkbox-item span {
  line-height: 1.3;
  word-break: break-word;
}

.consent-box {
  display: grid;
  gap: 12px;
}

.consent-item {
  align-items: center;
}

.consent-item a {
  color: #19224a;
  font-weight: bold;
  text-decoration: underline;
}

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

.grid-dashboard,
.grid-dashboard > .card,
.filters-grid,
.filters-grid > div,
.card,
.chart-box {
  min-width: 0;
}

.filters-card {
  margin-bottom: 20px;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
}

.filter-actions {
  display: flex;
  align-items: end;
}

.dashboard-header {
  justify-content: center;
}

.dashboard-header .brand {
  justify-content: center;
}

.chart-box {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 320px;
  overflow: hidden;
}

.chart-box-pie {
  height: 340px;
}

.chart-box-horizontal {
  height: 420px;
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

table th,
table td {
  padding: 10px;
  border-bottom: 1px solid #ddd;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

table th {
  background: #f8fafc;
  white-space: nowrap;
  color: #19224a;
}

/* Tabela de relatórios: largura mínima + colunas curtas sem quebra por letra */
#reportsTable {
  min-width: 1280px;
  table-layout: auto;
}

#reportsTable td,
#reportsTable th {
  word-break: normal;
  overflow-wrap: anywhere;
}

#reportsTable td:nth-child(1),
#reportsTable td:nth-child(2),
#reportsTable td:nth-child(3),
#reportsTable td:nth-child(5),
#reportsTable td:nth-child(6),
#reportsTable td:nth-child(7),
#reportsTable td:nth-child(10) {
  white-space: nowrap;
}

#reportsTable td:nth-child(4) {
  min-width: 11rem;
}

#reportsTable td:nth-child(8),
#reportsTable td:nth-child(9) {
  min-width: 16rem;
  max-width: 36rem;
  white-space: normal;
  line-height: 1.45;
}

canvas {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
}

.legal-page .logo {
  height: 120px;
}

.legal-card p {
  margin: 0 0 14px;
  line-height: 1.6;
  color: #334155;
}

.main-footer {
  margin-top: 24px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 18px;
  padding-bottom: 18px;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-links a {
  color: #19224a;
  text-decoration: none;
}

/* Tablets */
@media (max-width: 992px) {
  .container {
    padding: 18px;
  }

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

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

  .logo {
    height: 120px;
  }

  .legal-page .logo {
    height: 80px;
  }

  .chart-box {
    height: 300px;
  }

  .chart-box-pie {
    height: 320px;
  }

  .chart-box-horizontal {
    height: 380px;
  }
}

/* Celulares */
@media (max-width: 768px) {
  .container {
    padding: 14px;
  }

  .header {
    justify-content: center;
    align-items: center;
  }

  .brand {
    width: 100%;
    justify-content: center;
    align-items: center;
  }

  .logo {
    height: 64px;
  }

  .legal-page .logo {
    height: 64px;
  }

  .header-actions {
    position: static;
    transform: none;
    width: 100%;
  }

  .header-actions .btn,
  .header-actions .btn-secondary,
  .header .btn,
  .header .btn-secondary {
    width: 100%;
  }

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

  .card {
    padding: 16px;
  }

  h2 {
    font-size: 18px;
  }

  .chart-box {
    height: 220px;
  }

  .chart-box-pie {
    height: 260px;
  }

  .chart-box-horizontal {
    height: 300px;
  }

  .filter-actions {
    width: 100%;
  }

  .filter-actions .btn {
    width: 100%;
  }

  .table-wrapper {
    margin-top: 8px;
  }

  table {
    min-width: 760px;
  }

  .help-tooltip-content {
    left: auto;
    right: 0;
    width: 220px;
  }
}

/* Celulares menores */
@media (max-width: 480px) {
  .container {
    padding: 12px;
  }

  .card {
    padding: 14px;
    border-radius: 10px;
  }

  .logo {
    height: 48px;
  }

  .legal-page .logo {
    height: 48px;
  }

  input,
  select,
  textarea,
  button,
  .btn {
    font-size: 16px;
  }

  label {
    font-size: 13px;
  }

  .chart-box {
    height: 210px;
  }

  .chart-box-pie {
    height: 240px;
  }

  .chart-box-horizontal {
    height: 280px;
  }

  table {
    min-width: 680px;
  }

  table th,
  table td {
    font-size: 13px;
    padding: 8px;
  }
}



/* Estilos da Home (Estilo Calm) */
.home-body { background-color: #F7F9F9; color: #2C3E50; font-family: 'Helvetica Neue', sans-serif; margin: 0; }
.hero-section { text-align: center; padding: 100px 20px; background: linear-gradient(180deg, #E3F2FD 0%, #F7F9F9 100%); }
.hero-title { font-size: 3.5rem; font-weight: 700; line-height: 1.2; margin-bottom: 20px; color: #1A252F; }
.hero-subtitle { font-size: 1.5rem; color: #546E7A; margin-bottom: 40px; }
.hero-actions { display: flex; justify-content: center; gap: 20px; }
.btn-large { padding: 15px 40px; font-size: 1.1rem; border-radius: 30px; }

/* Seção de Vídeo */
.video-section { max-width: 1280px; margin: 0 auto 80px; padding: 0 20px; text-align: center; }
.video-container { border-radius: 16px; overflow: hidden; box-shadow: 0 20px 40px rgba(0,0,0,0.1); margin-bottom: 40px; }
.video-container video { width: 100%; display: block; }
.info-block h2 { font-size: 2rem; color: #2C3E50; margin-bottom: 15px; }
.info-block p { font-size: 1.2rem; color: #546E7A; line-height: 1.6; }

/* Estilos de Autenticação (Login/Register) */
.auth-page {
  background-color: #F7F9F9;
}

.auth-body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 320px);
}
.auth-container { max-width: 400px; width: 100%; padding: 40px; text-align: center; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); }
.auth-brand { margin-bottom: 20px; display: flex; justify-content: center; }
.auth-container h2 { margin-bottom: 30px; color: #2C3E50; }
.auth-form { text-align: left; }
.auth-form div { margin-bottom: 20px; }
.auth-form input { width: 100%; padding: 12px; border: 1px solid #DCE1E3; border-radius: 8px; box-sizing: border-box; }
/* Checkboxes não podem herdar width:100% — senão viram “barra” larga e quebram o layout */
.auth-form input[type="checkbox"] {
  width: auto;
  min-height: auto;
  padding: 0;
  margin: 4px 0 0;
  flex-shrink: 0;
  border: none;
  border-radius: 4px;
  accent-color: #19224a;
  align-self: flex-start;
}
.auth-form .consent-box {
  margin-bottom: 20px;
}
.auth-form .consent-box .checkbox-item {
  align-items: flex-start;
}
.auth-form .consent-box .checkbox-item span {
  flex: 1;
  min-width: 0;
  line-height: 1.45;
}
.auth-form .consent-box .checkbox-item span a {
  white-space: nowrap;
}
.full-width { width: 100%; }
.auth-link { margin-top: 20px; font-size: 0.9rem; color: #546E7A; }
.auth-link a { color: #3498DB; text-decoration: none; font-weight: bold; }

/* Botão Google e Divisor */
.btn-google { display: flex; align-items: center; justify-content: center; background-color: #FFF; color: #333; border: 1px solid #DCE1E3; width: 100%; padding: 12px; border-radius: 8px; font-weight: bold; text-decoration: none; transition: background 0.2s; }
.btn-google:hover { background-color: #F8F9FA; }
.google-icon { width: 20px; height: 20px; margin-right: 10px; }
.divider { display: flex; align-items: center; text-align: center; margin: 25px 0; color: #95A5A6; font-size: 0.9rem; }
.divider::before, .divider::after { content: ''; flex: 1; border-bottom: 1px solid #DCE1E3; }
.divider span { padding: 0 10px; }

/* Página de manutenção (home temporária) */
.maintenance-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.maintenance-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 20px 80px;
}

.maintenance-card {
  max-width: 520px;
  width: 100%;
  text-align: center;
  padding: 40px 32px;
}

.maintenance-label {
  margin: 0 0 12px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #3498DB;
  font-weight: bold;
}

.maintenance-title {
  margin: 0 0 16px;
  font-size: clamp(1.5rem, 4vw, 2rem);
  color: #1A252F;
  line-height: 1.25;
}

.maintenance-message {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.6;
  color: #546E7A;
}

@media (max-width: 768px) {
  .footer-content {
    flex-direction: column;
    justify-content: center;
    text-align: center;
  }

  .footer-links {
    flex-wrap: wrap;
    justify-content: center;
  }
}
