:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #61706a;
  --line: #d8e2dd;
  --surface: #ffffff;
  --field: #f7faf8;
  --accent: #0b6b57;
  --accent-strong: #08483b;
  --amber: #b56a00;
  --rose: #a73544;
  --shadow: 0 18px 45px rgba(23, 33, 29, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: #edf3ef;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.workspace {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 20px;
}

.intro {
  display: grid;
  grid-template-columns: 1.2fr minmax(260px, 0.8fr);
  align-items: stretch;
  min-height: 260px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.intro > div {
  padding: clamp(24px, 5vw, 64px);
  display: grid;
  align-content: center;
  gap: 14px;
}

.intro img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-height: 260px;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4.8vw, 4.3rem);
  line-height: 1;
  max-width: 12ch;
}

h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
}

.lede {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
  max-width: 58ch;
}

.control-surface,
.saved-profiles,
.results-area {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.control-surface {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

label:first-child {
  grid-column: span 2;
}

input,
select {
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  color: var(--ink);
  padding: 10px 12px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(11, 107, 87, 0.28);
  outline-offset: 2px;
}

.actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

button {
  min-height: 44px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  padding: 10px 16px;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.secondary {
  background: transparent;
  color: var(--accent);
}

.secondary:hover {
  color: white;
}

.text-button {
  min-height: auto;
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 6px 0;
}

.text-button:hover {
  background: transparent;
  color: var(--accent-strong);
}

.saved-profiles,
.results-area {
  padding: 20px;
}

.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.results-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.results-tools button {
  min-height: 38px;
  padding: 8px 12px;
}

.profile-list,
.results-list {
  display: grid;
  gap: 12px;
}

.profile-card,
.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 16px;
}

.profile-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.profile-card strong,
.result-card strong {
  display: block;
  margin-bottom: 5px;
}

.publication-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.publication-number {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.publication-details {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

.publication-details div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px;
}

.publication-details dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.publication-details dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 0.94rem;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.meta span,
.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  background: white;
}

.status-pill {
  white-space: nowrap;
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 800;
}

.status-pill.error {
  color: var(--rose);
}

.status-pill.loading {
  color: var(--amber);
}

.status-message {
  color: var(--muted);
  line-height: 1.5;
}

.result-text {
  color: #28352f;
  line-height: 1.55;
  white-space: pre-wrap;
}

.result-link {
  color: var(--accent);
  font-weight: 800;
}

.result-actions {
  min-height: 24px;
}

.publication-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.publication-actions button {
  min-height: 38px;
  padding: 8px 12px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 18px;
}

#page-label {
  min-width: 82px;
  text-align: center;
  color: var(--muted);
  font-weight: 800;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  background: #fbfdfc;
}

@media (max-width: 900px) {
  .intro,
  .control-surface {
    grid-template-columns: 1fr;
  }

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

  label:first-child {
    grid-column: auto;
  }

  .intro img {
    max-height: 280px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 12px;
  }

  .intro > div,
  .saved-profiles,
  .results-area {
    padding: 18px;
  }

  .profile-card,
  .publication-header,
  .section-heading,
  .pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .publication-details {
    grid-template-columns: 1fr;
  }

  .pagination button,
  .actions button {
    width: 100%;
  }
}

@media print {
  body {
    background: white;
  }

  .app-shell {
    padding: 0;
  }

  .intro,
  .control-surface,
  .saved-profiles,
  .results-tools,
  .publication-actions,
  .pagination {
    display: none;
  }

  .workspace {
    width: 100%;
  }

  .results-area,
  .result-card {
    border: 0;
    box-shadow: none;
  }

  .results-area {
    padding: 0;
  }

  .result-card {
    break-inside: avoid;
    border-top: 1px solid #d8e2dd;
    border-radius: 0;
    padding: 16px 0;
  }

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

  .result-link {
    color: #17211d;
  }
}
/* --- CONFIGURAÇÃO DE IMPRESSÃO PROFISSIONAL --- */
@media print {
  /* 1. Esconde TUDO o que não é o relatório */
  .ad-banner, .hero-panel, .consult-highlight, .ad-rail, 
  .pagination, .site-footer, .results-tools, .brand-block, 
  .eyebrow, .publication-actions, .hero-ad-slot {
    display: none !important;
  }

  /* 2. Remove limites de altura e barras de scroll que causam o truncamento */
  html, body, .page-shell, .results-showcase, .results-area, .results-list {
    height: auto !important;
    overflow: visible !important;
    display: block !important;
    background: white !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* 3. Formata cada intimação como um bloco que não se quebra ao meio */
  .result-card {
    page-break-inside: avoid !important; /* Evita cortar uma intimação ao meio entre páginas */
    border: 1px solid #eee !important;
    margin-bottom: 20px !important;
    padding: 15px !important;
    display: block !important;
  }

  /* 4. Melhora a fonte para o papel (PDF) */
  .result-text {
    font-size: 11pt !important;
    line-height: 1.5 !important;
    color: #000 !important;
    white-space: pre-wrap !important;
  }

  /* 5. Título do Relatório */
  .section-heading h2 {
    font-size: 18pt !important;
    margin-bottom: 20px !important;
  }
}
/* --- CORREÇÕES DE EMERGÊNCIA PARA CELULAR (MOBILE) --- */

/* 1. Trava a largura da tela para impedir o "balanço" lateral */
html, body {
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
}

/* 2. Força números de processo e textos longos a quebrarem de linha */
/* Isso resolve o problema do número do processo esticando a tela */
.publication-header strong,
.publication-details dd,
.result-text {
  word-wrap: break-word !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  white-space: pre-wrap !important;
}

h1 {
  word-wrap: break-word !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
}

/* 3. Ajuste fino para a grade de detalhes no celular */
@media (max-width: 560px) {
  /* Garante que os cards não tenham margens negativas ou estiquem */
  .workspace, .intro, .control-surface, .results-area {
    width: 100% !important;
    margin: 0 !important;
    border-radius: 0 !important; /* Fica melhor visualmente em telas pequenas */
  }

  .app-shell {
    padding: 10px !important;
  }

  /* Faz as caixinhas de detalhes (Tribunal, Data, etc) ocuparem 100% se ficarem apertadas */
  .publication-details {
    grid-template-columns: 1fr !important;
  }
  
  /* Ajusta os botões para não sumirem ou ficarem cortados */
  .actions, .results-tools {
    flex-direction: column;
    width: 100%;
  }
  
  button {
    width: 100%;
    display: block;
  }
}

/* 4. Garante que imagens e elementos de layout nunca passem de 100% */
img, video, canvas, svg {
  max-width: 100%;
  height: auto;
}
#print-results {
  display: none;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-top: 20px;
}

.hero-title {
  max-width: 760px;
  font-family: 'Fraunces', serif;
  font-size: 5.2rem;
  line-height: 0.98;
  letter-spacing: -2px;
  color: #0f172a;
  margin-top: 22px;
  margin-bottom: 28px;
}

.hero-lede {
  font-size: 1.35rem;
  color: #475569;
  margin-bottom: 34px;
}

.hero-actions {
  margin-bottom: 34px;
}

.hero-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #075985, #0f766e);
  color: white;
  padding: 18px 34px;
  border-radius: 18px;
  font-size: 1.35rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 25px rgba(15, 118, 110, 0.22);
  transition: all 0.2s ease;
}

.hero-button:hover {
  transform: translateY(-2px);
}

.hero-disclaimer-box {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  max-width: 760px;
  padding: 26px;
  border-radius: 22px;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(15, 118, 110, 0.12);
  backdrop-filter: blur(10px);
}

.hero-disclaimer-icon {
  min-width: 46px;
  height: 46px;
  border-radius: 999px;
  background: #dff6f2;
  color: #0f766e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
}

.hero-disclaimer {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.8;
  color: #1e293b;
}

.hero-eyebrow {
  font-size: 1rem;
  letter-spacing: 2px;
  font-weight: 800;
  color: #0f766e;
}