/* ===== Abas (navegação principal) ===== */
.tabs {
  display: flex;
  gap: var(--space-1);
  margin-left: auto;
  overflow-x: auto;
}

.tabs__btn {
  appearance: none;
  background: transparent;
  border: none;
  position: relative;
  padding: var(--space-2) var(--space-3);
  min-height: 44px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--duration-fast), color var(--duration-fast);
  white-space: nowrap;
}
.tabs__btn:hover { background: var(--surface-sunken); color: var(--text); }
.tabs__btn[aria-selected="true"] { color: var(--accent-text); background: var(--surface-sunken); }
.tabs__btn[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: var(--space-3);
  right: var(--space-3);
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--navy-gradient);
}
.tabs__btn .badge-em-breve {
  margin-left: var(--space-1);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--link-text);
  background: var(--border);
  border-radius: 999px;
  padding: 2px 6px;
}

/* ===== Cartão genérico ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-4);
}

/* ===== Botões ===== */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  min-height: 44px;
  padding: 0 var(--space-4);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  transition: background var(--duration-fast), border-color var(--duration-fast), transform var(--duration-fast);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: translateY(1px); }

.btn--primary { background: var(--navy-gradient); color: var(--text-on-navy); box-shadow: var(--shadow); }
.btn--primary:hover:not(:disabled) { box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.btn--primary:active:not(:disabled) { box-shadow: var(--shadow); }

.btn--secondary { background: var(--surface); color: var(--accent-text); border-color: var(--border); }
.btn--secondary:hover:not(:disabled) { background: var(--surface-sunken); border-color: var(--blue-400); }

.btn--ghost { background: transparent; color: var(--link-text); padding: 0 var(--space-2); min-height: 32px; }
.btn--ghost:hover { background: var(--surface-sunken); }

.btn--block { width: 100%; }

/* ===== Alternador de tema (claro/escuro) ===== */
.theme-toggle {
  appearance: none;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--duration-fast), color var(--duration-fast), border-color var(--duration-fast), transform var(--duration-fast);
}
.theme-toggle:hover { background: var(--surface-sunken); color: var(--accent-text); border-color: var(--blue-400); transform: rotate(-8deg); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ===== Stepper vertical ===== */
.stepper { display: flex; flex-direction: column; gap: var(--space-3); }

.step {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--space-3);
  transition: border-color var(--duration-base), box-shadow var(--duration-base);
}
.step[data-state="locked"] { opacity: 0.55; }
.step[data-state="active"] { border-color: var(--blue-400); box-shadow: var(--shadow-lift); }
.step[data-state="done"] { border-color: var(--success); }

.step__head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  font-size: 14px;
}

.step__number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  background: var(--surface-sunken);
  color: var(--text-muted);
  font-size: 13px;
}
.step[data-state="active"] .step__number { background: var(--blue-400); color: #fff; }
.step[data-state="done"] .step__number { background: var(--success); color: #fff; }

.step__body { margin-top: var(--space-3); }

/* Segmented control */
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
  padding: 4px;
}
.segmented__option {
  appearance: none;
  border: none;
  background: transparent;
  min-height: 36px;
  padding: 0 var(--space-3);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}
.segmented__option[aria-pressed="true"] { background: var(--surface); color: var(--accent-text); box-shadow: var(--shadow); }

.field { margin-top: var(--space-3); }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: var(--space-1); color: var(--text-muted); }
.field input[type="text"] {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}
.field input[type="text"]:focus-visible { box-shadow: var(--focus-ring); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-2);
  padding: 6px var(--space-2);
  border-radius: 999px;
  background: var(--navy-gradient);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow);
}

/* ===== Dropzone ===== */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--duration-base), background var(--duration-base), transform var(--duration-base);
  background: var(--surface-sunken);
}
.dropzone:hover,
.dropzone:focus-visible { border-color: var(--blue-400); transform: translateY(-1px); }
.dropzone[data-dragging="true"] { border-color: var(--blue-600); background: var(--surface); transform: scale(1.01); }

.dropzone__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--link-text);
  box-shadow: var(--shadow);
  margin-bottom: var(--space-2);
}
.dropzone__title { font-weight: 600; font-size: 14px; }
.dropzone__hint { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.dropzone[data-state="loading"] .dropzone__title::after { content: "…"; }

.dropzone[data-state="valid"] {
  border-style: solid;
  border-color: var(--success);
  background: var(--success-bg);
  text-align: left;
}
.dropzone[data-state="invalid"] {
  border-style: solid;
  border-color: var(--danger);
  background: var(--danger-bg);
  text-align: left;
}

.dropzone__summary { display: flex; align-items: flex-start; gap: var(--space-2); }
.dropzone__summary-icon { flex: none; margin-top: 2px; }
.dropzone__summary-text { font-size: 13px; }
.dropzone__summary-text strong { display: block; font-size: 14px; }

.dropzone__actions { margin-top: var(--space-2); }

.help-link { font-size: 12px; margin-top: var(--space-2); display: flex; gap: var(--space-3); }

/* ===== Cards de escolha (saída) ===== */
.choice-group { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-2); }
.choice-group__label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.choice-row { display: flex; gap: var(--space-2); flex-wrap: wrap; }

.choice-card {
  flex: 1 1 140px;
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  background: var(--surface);
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast), background var(--duration-fast);
}
.choice-card:hover { border-color: var(--blue-400); }
.choice-card input { position: absolute; opacity: 0; }
.choice-card[data-checked="true"] { border-color: var(--blue-400); box-shadow: var(--focus-ring); background: var(--surface-sunken); }
.choice-card__title { font-size: 13px; font-weight: 600; }

/* Multi-select de estados por região */
.region-select { margin-top: var(--space-3); border-top: 1px solid var(--border); padding-top: var(--space-3); }
.region-select__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-2); }
.region-group { margin-bottom: var(--space-2); }
.region-group__title { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; }
.region-group__list { display: flex; flex-wrap: wrap; gap: 6px; }
.uf-toggle {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  cursor: pointer;
  transition: background var(--duration-fast), color var(--duration-fast), border-color var(--duration-fast), transform var(--duration-fast);
}
.uf-toggle:hover { border-color: var(--blue-400); transform: translateY(-1px); }
.uf-toggle[aria-pressed="true"] { background: var(--navy-gradient); color: #fff; border-color: var(--navy-900); }

/* ===== Toast ===== */
.toast-region {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: 50;
  max-width: 360px;
}
.toast {
  background: var(--navy-900);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-size: 13px;
  box-shadow: var(--shadow);
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  animation: toast-in var(--duration-base) ease-out;
}
.toast[data-variant="success"] { background: var(--success); }
.toast[data-variant="error"] { background: var(--danger); }
.toast[data-variant="warning"] { background: var(--warning); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Privacidade — selo ===== */
.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 12px;
  color: var(--text-muted);
  margin-top: var(--space-3);
}

/* ===== Painel Censo (Power BI embutido, harness Q13) ===== */
.powerbi-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 1140 / 541.25;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-sunken);
  box-shadow: var(--shadow);
}
.powerbi-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ===== Placeholder "Em breve" / vazio ===== */
.empty-state {
  text-align: center;
  padding: var(--space-6) var(--space-4);
  color: var(--text-muted);
}
.empty-state h2 { color: var(--text); }

/* ===== Ajuda (accordion) ===== */
.help-item { border-bottom: 1px solid var(--border); }
.help-item__q {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: var(--space-3) 0;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  min-height: 44px;
  align-items: center;
}
.help-item__a { padding: 0 0 var(--space-3); color: var(--text-muted); font-size: 14px; display: none; }
.help-item[data-open="true"] .help-item__a { display: block; }
.help-item[data-open="true"] .help-item__chevron { transform: rotate(180deg); }
.help-item__chevron { transition: transform var(--duration-base); flex: none; }

/* ===== Progresso de geração ===== */
.progress-bar { height: 8px; border-radius: 999px; background: var(--surface-sunken); overflow: hidden; }
.progress-bar__fill { height: 100%; background: var(--blue-400); transition: width var(--duration-base); }

@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
}
