/* Documentos: editor, papel e consulta pública */

.doc-paper {
  background: #fff; border: 1px solid var(--gov-border); border-radius: var(--r-sm);
  padding: 2.5rem 3rem; font-family: Georgia, 'Times New Roman', serif; font-size: .95rem;
  line-height: 1.7; color: #1b1f27; box-shadow: var(--sh-1); max-width: 52rem; margin: 0 auto;
}
.doc-paper h1, .doc-paper h2, .doc-paper h3 { font-family: inherit; text-align: center; }
.doc-paper table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.doc-paper th, .doc-paper td { border: 1px solid var(--gov-border); padding: .4rem .6rem; }
.doc-var-missing {
  background: var(--gov-warning-soft); color: var(--gov-warning);
  border-radius: 3px; padding: 0 .2rem; font-style: italic;
}

.var-list { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: var(--s-3); }
.var-chip {
  border: 1px solid var(--gov-primary-line); background: var(--gov-primary-soft);
  color: var(--gov-primary-dark); border-radius: var(--r-pill); padding: .1rem .5rem;
  font-size: .74rem; font-family: ui-monospace, SFMono-Regular, monospace; cursor: pointer;
}
.var-chip:hover { background: var(--gov-primary); color: #fff; }

.doc-signature {
  border: 1px solid var(--gov-border); border-radius: var(--r-md);
  padding: var(--s-3); background: var(--gov-bg-alt); margin-bottom: var(--s-2);
}
.doc-signature--signed { border-left: 3px solid var(--gov-success); background: var(--gov-success-soft); }
.doc-signature--pending { border-left: 3px solid var(--gov-warning); }
.doc-signature__hash {
  font-family: ui-monospace, SFMono-Regular, monospace; font-size: .68rem;
  color: var(--gov-muted); word-break: break-all;
}
.code-input {
  font-family: ui-monospace, SFMono-Regular, monospace; font-size: 1.4rem;
  letter-spacing: .4rem; text-align: center; max-width: 10rem;
}
.doc-authenticity {
  border: 1px dashed var(--gov-border-strong); border-radius: var(--r-md);
  padding: var(--s-3); display: flex; gap: var(--s-4); align-items: center; flex-wrap: wrap;
}
.doc-authenticity__code {
  font-family: ui-monospace, SFMono-Regular, monospace; font-size: 1.05rem;
  font-weight: 700; letter-spacing: .06em; color: var(--gov-primary-dark);
}
.doc-authenticity svg { width: 108px; height: 108px; }

.validation-result { border-radius: var(--r-lg); padding: var(--s-5); text-align: center; margin-bottom: var(--s-4); }
.validation-result--valid { background: var(--gov-success-soft); border: 1px solid #bfe3c4; }
.validation-result--invalid { background: var(--gov-danger-soft); border: 1px solid #f6c9c5; }
.validation-result__icon { font-size: 2.2rem; line-height: 1; }
.validation-result__title { font-size: 1.2rem; font-weight: 700; margin: .4rem 0 .2rem; }

@media print {
  .navbar-gov, .sidebar, .breadcrumb, .page-head__actions, .panel__head, .no-print { display: none !important; }
  body { background: #fff; }
  .doc-paper { border: 0; box-shadow: none; padding: 0; max-width: none; }
  .panel { border: 0; box-shadow: none; }
}

/* Verificação pública: QR ao lado do endereço da consulta */
.doc-qr {
  display: flex;
  gap: var(--space-4, 1rem);
  align-items: center;
  padding: var(--space-3, .75rem);
  border: 1px solid var(--color-border, #dfe3e8);
  border-radius: var(--radius-md, 8px);
  background: var(--color-surface-muted, #f6f8fa);
}

.doc-qr__code {
  flex: 0 0 120px;
  width: 120px;
  line-height: 0;
}

.doc-qr__code svg {
  width: 100%;
  height: auto;
  display: block;
}

.doc-qr__text {
  min-width: 0;
}

.doc-qr__text code {
  overflow-wrap: anywhere;
}

@media (max-width: 575.98px) {
  .doc-qr { flex-direction: column; align-items: flex-start; }
}

/* ---------------------------------------------------------------------------
   Folha do documento na tela (mesma estrutura do PDF, §9.6)
   --------------------------------------------------------------------------- */
.doc-paper__head {
  border-bottom: 2px solid var(--gov-ink, #14181f);
  padding-bottom: .5rem;
  margin-bottom: 1.25rem;
}

.doc-paper__organ {
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.doc-paper__number { font-size: .74rem; color: var(--gov-muted, #5b6472); }

.doc-holder {
  width: 100%;
  border: 1px solid var(--gov-border, #dfe3e8);
  border-collapse: collapse;
  margin: 0 0 1rem;
  font-size: .8rem;
}

.doc-holder td {
  padding: .4rem .6rem;
  border-right: 1px solid var(--gov-border, #dfe3e8);
  vertical-align: top;
}

.doc-holder td:last-child { border-right: 0; }

.doc-holder__label {
  display: block;
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gov-muted, #5b6472);
}

.doc-signatures { margin-top: 2rem; }

.doc-signatures__title {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--gov-muted, #5b6472);
  border-bottom: 1px solid var(--gov-border, #dfe3e8);
  padding-bottom: .25rem;
  margin-bottom: 1rem;
}

.doc-signatures__item { margin-bottom: 1.25rem; }

.doc-signatures__rule {
  border-top: 1px solid var(--gov-ink, #14181f);
  padding-top: .25rem;
  max-width: 24rem;
  font-weight: 600;
  font-size: .9rem;
}

.doc-signatures__item--pending .doc-signatures__rule {
  color: var(--gov-muted, #5b6472);
  font-weight: 400;
  font-style: italic;
  border-top-style: dashed;
}

.doc-signatures__role { font-size: .78rem; }
.doc-signatures__meta { font-size: .72rem; color: var(--gov-muted, #5b6472); }

.doc-signatures__hash {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .62rem;
  color: #6b7280;
  overflow-wrap: anywhere;
}

.doc-authenticity-strip {
  margin-top: 1.5rem;
  border-top: 1px dashed var(--gov-border, #c3cad6);
  padding-top: .75rem;
  display: flex;
  gap: .9rem;
  align-items: flex-start;
}

.doc-authenticity-strip__qr { flex: 0 0 84px; width: 84px; line-height: 0; }
.doc-authenticity-strip__qr svg { width: 100%; height: auto; display: block; }

.doc-authenticity-strip__data {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .68rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.doc-authenticity-strip__title {
  font-family: inherit;
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--gov-muted, #5b6472);
}

.doc-authenticity-strip__label {
  display: inline-block;
  min-width: 5.6rem;
  color: var(--gov-muted, #5b6472);
}

.doc-paper__notice {
  margin-top: 1.25rem;
  border: 1px solid #d1a24a;
  background: #fdf6e6;
  padding: .5rem .7rem;
  font-size: .8rem;
  border-radius: var(--radius-sm, 6px);
}

.doc-print { background: #fff; }
.doc-print__sheet { max-width: 54rem; margin: 0 auto; padding: 1.5rem 1rem; }

@media print {
  .no-print { display: none !important; }
  .doc-print__sheet { max-width: none; padding: 0; }
}
