.af-cnpj-root,
.af-cnpj-root * {
  box-sizing: border-box;
}

.af-cnpj-root {
  --af-cnpj-text: #0d263b;
  --af-cnpj-muted: #607486;
  --af-cnpj-border: #d8e3eb;
  --af-cnpj-soft: #f6f9fb;
  --af-cnpj-primary: #0b67a8;
  --af-cnpj-primary-dark: #084f82;
  --af-cnpj-success: #08b85a;
  --af-cnpj-success-dark: #07994c;
  --af-cnpj-danger-bg: #fee2e2;
  --af-cnpj-danger-text: #991b1b;
  --af-cnpj-info-bg: #e5f2fb;
  --af-cnpj-info-text: #0b5487;

  color: var(--af-cnpj-text);
  font-family: inherit;
}

.af-cnpj-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==================================================
   WIDGET DE CONSULTA
   ================================================== */

.af-cnpj-widget {
  width: 100%;
  padding: 17px 18px;

  border: 1px solid var(--af-cnpj-border);
  border-left: 4px solid var(--af-cnpj-success);
  border-radius: 10px;

  background:
    linear-gradient(
      135deg,
      #ffffff 0%,
      #f3f8fb 100%
    );

  box-shadow:
    0 5px 16px rgba(13, 38, 59, 0.08);
}

.af-cnpj-widget-title {
  margin: 0 0 13px;

  color: var(--af-cnpj-text);

  font-size: 17px;
  line-height: 1.25;
  font-weight: 700;
}

.af-cnpj-widget-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.af-cnpj-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

.af-cnpj-input {
  width: 100%;
  min-height: 44px;

  padding: 0 13px;

  border: 1px solid #bdccd8;
  border-radius: 6px;

  background: #ffffff;
  color: var(--af-cnpj-text);

  font-size: 14px;
  line-height: 1.2;

  outline: none;

  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.af-cnpj-input::placeholder {
  color: #7b8c99;
}

.af-cnpj-input:focus {
  border-color: var(--af-cnpj-primary);

  box-shadow:
    0 0 0 3px rgba(11, 103, 168, 0.12);
}

.af-cnpj-button,
.af-cnpj-secondary-button {
  min-height: 44px;

  padding: 0 16px;

  border: 1px solid var(--af-cnpj-success);
  border-radius: 6px;

  background: var(--af-cnpj-success);
  color: #ffffff;

  cursor: pointer;

  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;

  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    transform 0.15s ease;
}

.af-cnpj-button:hover,
.af-cnpj-button:focus {
  background: var(--af-cnpj-success-dark);
  border-color: var(--af-cnpj-success-dark);
  color: #ffffff;

  transform: translateY(-1px);
}

.af-cnpj-button:active {
  transform: translateY(0);
}

.af-cnpj-button:disabled {
  cursor: wait;
  opacity: 0.7;
  transform: none;
}

.af-cnpj-secondary-button {
  background: #ffffff;
  border-color: var(--af-cnpj-primary);
  color: var(--af-cnpj-primary);
}

.af-cnpj-secondary-button:hover,
.af-cnpj-secondary-button:focus {
  background: #eef6fb;
  border-color: var(--af-cnpj-primary-dark);
  color: var(--af-cnpj-primary-dark);
}

.af-cnpj-message {
  display: none;

  margin-top: 12px;
  padding: 11px 13px;

  border-radius: 7px;

  font-size: 13px;
  line-height: 1.4;
}

.af-cnpj-message.af-cnpj-message-error {
  display: block;
  background: var(--af-cnpj-danger-bg);
  color: var(--af-cnpj-danger-text);
}

.af-cnpj-message.af-cnpj-message-loading {
  display: block;
  background: var(--af-cnpj-info-bg);
  color: var(--af-cnpj-info-text);
}

/* ==================================================
   PÁGINA DE CONSULTA
   ================================================== */

.af-cnpj-page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 0;
}

.af-cnpj-search-panel,
.af-cnpj-report {
  margin-bottom: 24px;
  padding: 26px;

  border: 1px solid var(--af-cnpj-border);
  border-radius: 10px;

  background: #ffffff;

  box-shadow:
    0 8px 28px rgba(13, 38, 59, 0.055);
}

.af-cnpj-tool-title {
  margin: 0 0 16px;

  color: var(--af-cnpj-text);

  font-size: 28px;
  line-height: 1.2;
  font-weight: 700;
}

.af-cnpj-feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;

  margin-top: 24px;
}

.af-cnpj-feature-item {
  min-width: 0;

  padding: 15px;

  border: 1px solid var(--af-cnpj-border);
  border-radius: 8px;

  background: var(--af-cnpj-soft);
}

.af-cnpj-feature-item strong,
.af-cnpj-feature-item span {
  display: block;
}

.af-cnpj-feature-item strong {
  color: var(--af-cnpj-text);

  font-size: 14px;
  line-height: 1.3;
  font-weight: 700;
}

.af-cnpj-feature-item span {
  margin-top: 5px;

  color: var(--af-cnpj-muted);

  font-size: 13px;
  line-height: 1.45;
}

/* ==================================================
   RELATÓRIO PÚBLICO
   ================================================== */

.af-cnpj-public-page {
  max-width: 1120px;
  margin: 0 auto;
}

.af-cnpj-report-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;

  padding-bottom: 20px;

  border-bottom: 1px solid var(--af-cnpj-border);
}

.af-cnpj-company-name {
  margin: 0 0 10px;

  color: var(--af-cnpj-text);

  font-size: 28px;
  line-height: 1.25;
  font-weight: 700;
}

.af-cnpj-header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;

  color: var(--af-cnpj-muted);

  font-size: 14px;
  line-height: 1.45;
}

.af-cnpj-header-meta strong {
  color: var(--af-cnpj-text);
  font-weight: 600;
}

.af-cnpj-header-cnpj {
  color: var(--af-cnpj-primary);
  font-weight: 700;
}

.af-cnpj-source-badge {
  flex: 0 0 auto;

  padding: 8px 11px;

  border: 1px solid #cfe0ed;
  border-radius: 999px;

  background: #eef6fb;
  color: var(--af-cnpj-primary);

  font-size: 12px;
  line-height: 1;
  font-weight: 600;
  white-space: nowrap;
}

/* ==================================================
   RESUMO
   ================================================== */

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

  margin: 22px 0;
}

.af-cnpj-summary-item {
  min-width: 0;

  padding: 14px;

  border: 1px solid var(--af-cnpj-border);
  border-radius: 8px;

  background: var(--af-cnpj-soft);
}

.af-cnpj-summary-label,
.af-cnpj-detail-label {
  color: var(--af-cnpj-muted);

  font-size: 11px;
  line-height: 1.35;
  font-weight: 700;

  text-transform: uppercase;
  letter-spacing: 0.25px;
}

.af-cnpj-summary-value {
  margin-top: 6px;

  color: var(--af-cnpj-text);

  font-size: 14px;
  line-height: 1.45;
  font-weight: 600;

  overflow-wrap: anywhere;
}

/* ==================================================
   SEÇÕES E CAMPOS
   ================================================== */

.af-cnpj-section-title {
  margin: 30px 0 14px;
  padding-bottom: 9px;

  border-bottom: 1px solid var(--af-cnpj-border);

  color: var(--af-cnpj-primary);

  font-size: 18px;
  line-height: 1.3;
  font-weight: 700;

  text-transform: none;
  letter-spacing: 0;
}

.af-cnpj-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 24px;
}

.af-cnpj-detail-row {
  display: grid;
  grid-template-columns: 145px minmax(0, 1fr);
  gap: 12px;

  padding: 10px 0;

  border-bottom: 1px dotted #ccd8e1;
}

.af-cnpj-detail-row-full {
  grid-column: 1 / -1;
}

.af-cnpj-detail-value {
  min-width: 0;

  color: #20384b;

  font-size: 14px;
  line-height: 1.55;
  font-weight: 400;

  overflow-wrap: anywhere;
}

.af-cnpj-maps-link {
  color: var(--af-cnpj-primary);

  font-weight: 600;
  text-decoration: none;
}

.af-cnpj-maps-link:hover,
.af-cnpj-maps-link:focus {
  color: var(--af-cnpj-primary-dark);
  text-decoration: underline;
}

/* ==================================================
   CNAES SECUNDÁRIOS
   ================================================== */

.af-cnpj-cnae-list {
  display: grid;
  gap: 10px;

  margin: 0;
  padding: 0;

  list-style: none;

  counter-reset: af-cnpj-cnae;
}

.af-cnpj-cnae-item {
  counter-increment: af-cnpj-cnae;

  display: grid;
  grid-template-columns: 34px 105px minmax(0, 1fr);
  align-items: start;
  gap: 10px;

  padding: 12px 14px;

  border: 1px solid #dce6ed;
  border-left: 4px solid var(--af-cnpj-primary);
  border-radius: 7px;

  background: #f7fafc;

  transition:
    background-color 0.2s ease,
    border-color 0.2s ease;
}

.af-cnpj-cnae-item:hover {
  background: #eef5f9;
  border-color: #c8dae6;
  border-left-color: var(--af-cnpj-primary-dark);
}

.af-cnpj-cnae-item::before {
  content: counter(
    af-cnpj-cnae,
    decimal-leading-zero
  ) ".";

  color: #718392;

  font-size: 12px;
  line-height: 1.55;
  font-weight: 700;
}

.af-cnpj-cnae-code {
  color: var(--af-cnpj-primary);

  font-size: 13px;
  line-height: 1.5;
  font-weight: 700;
}

.af-cnpj-cnae-description {
  color: #20384b;

  font-size: 14px;
  line-height: 1.5;
  font-weight: 400;
}

/* ==================================================
   SÓCIOS
   ================================================== */

.af-cnpj-partners-grid {
  display: grid;
  grid-template-columns:
    repeat(
      auto-fit,
      minmax(240px, 1fr)
    );
  gap: 12px;

  margin-top: 14px;
}

.af-cnpj-partner-item,
.af-cnpj-empty {
  padding: 14px;

  border: 1px solid var(--af-cnpj-border);
  border-radius: 8px;

  background: var(--af-cnpj-soft);

  font-size: 14px;
  line-height: 1.5;
}

.af-cnpj-partner-item strong,
.af-cnpj-partner-item span {
  display: block;
}

.af-cnpj-partner-item strong {
  margin-bottom: 4px;

  color: var(--af-cnpj-text);
  font-weight: 700;
}

.af-cnpj-partner-item span {
  color: var(--af-cnpj-muted);
}

/* ==================================================
   RODAPÉ DO RELATÓRIO
   ================================================== */

.af-cnpj-footer {
  margin-top: 32px;
  padding-top: 22px;

  border-top: 1px solid var(--af-cnpj-border);
}

.af-cnpj-footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;

  margin-bottom: 20px;
}

.af-cnpj-link-box {
  color: var(--af-cnpj-text);

  font-size: 14px;
  line-height: 1.5;
}

.af-cnpj-consulta-link {
  margin-top: 8px;
  padding: 12px;

  border: 1px solid var(--af-cnpj-border);
  border-radius: 8px;

  background: var(--af-cnpj-soft);
  color: var(--af-cnpj-primary);

  font-size: 14px;
  line-height: 1.45;

  overflow-wrap: anywhere;
}

.af-cnpj-qrcode-box {
  display: flex;
  justify-content: center;

  margin-top: 24px;
}

.af-cnpj-qrcode-box canvas,
.af-cnpj-qrcode-box img {
  display: block;

  width: 120px !important;
  height: 120px !important;

  padding: 8px;

  border: 1px solid var(--af-cnpj-border);
  border-radius: 8px;

  background: #ffffff;
}

.af-cnpj-footer-copy {
  margin-top: 22px;

  color: var(--af-cnpj-muted);

  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

/* ==================================================
   ALERTAS
   ================================================== */

.af-cnpj-alert {
  padding: 14px;

  border-radius: 8px;

  font-size: 14px;
  line-height: 1.5;
}

.af-cnpj-alert-error {
  background: var(--af-cnpj-danger-bg);
  color: var(--af-cnpj-danger-text);
}

/* ==================================================
   TABLET E CELULAR
   ================================================== */

@media (max-width: 800px) {
  .af-cnpj-search-panel,
  .af-cnpj-report {
    padding: 20px;
  }

  .af-cnpj-search-row,
  .af-cnpj-feature-grid,
  .af-cnpj-summary-grid,
  .af-cnpj-detail-grid {
    grid-template-columns: 1fr;
  }

  .af-cnpj-report-header {
    display: block;
  }

  .af-cnpj-source-badge {
    display: inline-block;
    margin-top: 14px;
  }

  .af-cnpj-detail-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .af-cnpj-tool-title,
  .af-cnpj-company-name {
    font-size: 23px;
  }
}

@media (max-width: 640px) {
  .af-cnpj-widget {
    padding: 15px;
  }

  .af-cnpj-search-panel,
  .af-cnpj-report {
    padding: 17px;
  }

  .af-cnpj-cnae-item {
    grid-template-columns:
      28px minmax(0, 1fr);
  }

  .af-cnpj-cnae-code,
  .af-cnpj-cnae-description {
    grid-column: 2;
  }

  .af-cnpj-cnae-description {
    margin-top: -5px;
  }

  .af-cnpj-company-name {
    font-size: 21px;
  }

  .af-cnpj-section-title {
    font-size: 17px;
  }

  .af-cnpj-footer-actions,
  .af-cnpj-secondary-button {
    width: 100%;
  }
}

/* ==================================================
   IMPRESSÃO
   ================================================== */

@media print {
  .af-cnpj-search-panel,
  .af-cnpj-widget,
  .af-cnpj-footer-actions {
    display: none !important;
  }

  .af-cnpj-root,
  .af-cnpj-public-page,
  .af-cnpj-report {
    max-width: 100% !important;

    margin: 0 !important;
    padding: 0 !important;

    border: 0 !important;

    box-shadow: none !important;
  }

  .af-cnpj-report {
    display: block !important;
  }

  .af-cnpj-cnae-item,
  .af-cnpj-partner-item,
  .af-cnpj-summary-item,
  .af-cnpj-detail-row {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .af-cnpj-qrcode-box,
  .af-cnpj-link-box {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}