/* Documentos legais — painéis do modal (rotas /termos-de-uso e /privacidade abrem este painel). */

.pm-legal-doc {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100%;
  height: 100%;
}

.pm-legal-doc__title {
  margin: 0;
  font-family: var(--pm-prefs-font, var(--pm-font-ui, Roboto, system-ui, sans-serif));
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--pm-prefs-ink, #172438);
}

.pm-legal-doc__scroll {
  flex: 1 1 auto;
  min-height: 180px;
  max-height: min(360px, 42vh);
  overflow: auto;
  padding: 14px 16px;
  border: 1.5px solid var(--pm-prefs-line, #e1e8f0);
  border-radius: 12px;
  background: var(--pm-prefs-soft, #f3f6fa);
  color: var(--pm-prefs-ink, #172438);
  font: 400 14px/1.55 var(--pm-prefs-font, var(--pm-font-ui, Roboto, system-ui, sans-serif));
  -webkit-overflow-scrolling: touch;
}

.pm-legal-doc__scroll p {
  margin: 0 0 12px;
}

.pm-legal-doc__scroll p:last-child {
  margin-bottom: 0;
}

.pm-legal-doc__scroll h2 {
  margin: 18px 0 8px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--pm-prefs-ink, #172438);
}

.pm-legal-doc__scroll h2:first-child {
  margin-top: 0;
}

.pm-legal-doc__scroll h3 {
  margin: 14px 0 6px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--pm-prefs-ink, #172438);
}

.pm-legal-doc__scroll h4 {
  margin: 12px 0 6px;
  font-size: 13px;
  font-weight: 700;
}

.pm-legal-doc__scroll ul,
.pm-legal-doc__scroll ol {
  margin: 0 0 12px;
  padding-left: 1.35em;
}

.pm-legal-doc__scroll li {
  margin: 0 0 4px;
}

.pm-legal-doc__scroll hr {
  border: 0;
  border-top: 1px solid var(--pm-prefs-line, #e1e8f0);
  margin: 16px 0;
}

.pm-legal-doc__scroll a {
  color: var(--pm-prefs-primary, #2476ce);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pm-legal-doc__scroll code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  padding: 0.05em 0.3em;
  border-radius: 4px;
  background: rgba(23, 36, 56, 0.06);
}

.pm-legal-doc__scroll strong {
  font-weight: 700;
}

.pm-legal-doc__scroll em {
  font-style: italic;
}

.pm-legal-doc__scroll .pm-legal-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 0 0 14px;
  -webkit-overflow-scrolling: touch;
}

.pm-legal-doc__scroll table {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
  font-size: 12.5px;
  line-height: 1.4;
  background: #fff;
}

.pm-legal-doc__scroll th,
.pm-legal-doc__scroll td {
  border: 1px solid var(--pm-prefs-line, #e1e8f0);
  padding: 7px 8px;
  text-align: left;
  vertical-align: top;
}

.pm-legal-doc__scroll th {
  background: #e8eef5;
  font-weight: 700;
}

.pm-legal-doc__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
}

.pm-legal-doc__print {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--pm-prefs-primary, #2476ce);
  color: #ffffff;
  font: 600 14px/1.2 var(--pm-prefs-font, var(--pm-font-ui, Roboto, system-ui, sans-serif));
  cursor: pointer;
  text-decoration: none;
}

.pm-legal-doc__print:hover {
  background: #184e8a;
}

#modalProfile .pm-legal-doc {
  min-height: 0;
  height: auto;
  gap: 14px;
}

#modalProfile .pm-legal-doc__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-right: 36px;
}

#modalProfile .pm-legal-doc__kicker {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--pm-prefs-muted, #65798f);
}

#modalProfile .pm-legal-doc__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

#modalProfile .pm-legal-doc__badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef3f8;
  color: #3d4d61;
  font-size: 12px;
  font-weight: 700;
}

#modalProfile .pm-legal-doc__badge.is-pending {
  background: #fff4df;
  color: #9a6700;
}

#modalProfile .pm-legal-doc__print {
  flex: 0 0 auto;
  min-height: 36px;
  border: 1px solid var(--pm-prefs-line, #e1e8f0);
  border-radius: 8px;
  background: #fff;
  color: var(--pm-prefs-ink, #172438);
  font-weight: 700;
}

#modalProfile .pm-legal-doc__print:hover {
  background: #f8fafc;
  border-color: #b7c5d6;
}

#modalProfile .pm-legal-doc__reader {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  min-height: 0;
  align-items: start;
}

#modalProfile .pm-legal-doc__toc-label {
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8b9aab;
}

#modalProfile .pm-legal-doc__toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

#modalProfile .pm-legal-doc__toc li {
  margin: 0;
}

#modalProfile .pm-legal-doc__toc a {
  display: block;
  padding: 6px 8px;
  border-radius: 6px;
  color: #3d4d61;
  font-size: 13px;
  line-height: 1.35;
  text-decoration: none;
}

#modalProfile .pm-legal-doc__toc a.is-active,
#modalProfile .pm-legal-doc__toc a:hover {
  background: #e8f1fb;
  color: var(--pm-prefs-primary, #2476ce);
  font-weight: 700;
}

#modalProfile .pm-legal-doc__scroll {
  max-height: none;
  min-height: 280px;
  height: min(520px, calc(100vh - 280px));
  border: 0;
  border-radius: 12px;
  background: #f6f8fb;
}

.pm-legal-doc__jump {
  display: none;
}

@media (max-width: 767px) {
  #modalProfile .pm-legal-doc {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
  }

  #modalProfile .pm-legal-doc__head {
    display: contents;
  }

  #modalProfile .pm-legal-doc__head > div {
    order: 0;
  }

  #modalProfile .pm-legal-doc__kicker {
    display: none;
  }

  #modalProfile .pm-legal-doc__title {
    margin: 0;
    font-size: 22px;
  }

  #modalProfile .pm-legal-doc__reader {
    display: flex;
    flex-direction: column;
    gap: 12px;
    order: 1;
    min-height: 0;
  }

  #modalProfile .pm-legal-doc__toc ol,
  #modalProfile .pm-legal-doc__toc-label {
    display: none;
  }

  #modalProfile .pm-legal-doc__jump {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  #modalProfile .pm-legal-doc__jump-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #8b9aab;
  }

  #modalProfile .pm-legal-doc__jump-select {
    width: 100%;
    min-height: 44px;
    padding: 0 36px 0 12px;
    border: 1px solid #e1e8f0;
    border-radius: 12px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235d6d80' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 12px center / 16px no-repeat;
    color: #172438;
    font: 600 14px/1.3 Roboto, system-ui, sans-serif;
    appearance: none;
  }

  #modalProfile .pm-legal-doc__scroll {
    order: 2;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  #modalProfile .pm-legal-section {
    display: none;
  }

  #modalProfile .pm-legal-section.is-current {
    display: block;
  }

  #modalProfile .pm-legal-doc__print {
    order: 3;
    width: 100%;
    min-height: 44px;
    margin: 4px 0 12px;
  }
}

#modalProfile .pm-user-prefs-panel[data-user-prefs-panel="termos"],
#modalProfile .pm-user-prefs-panel[data-user-prefs-panel="privacidade"] {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

#modalProfile .pm-user-prefs-panel[data-user-prefs-panel="termos"][hidden],
#modalProfile .pm-user-prefs-panel[data-user-prefs-panel="privacidade"][hidden] {
  display: none !important;
}

/* Desktop: quadros "Desktop 1440 — Termos de uso / Política de privacidade" do Figma. */
@media (min-width: 768px) {
  #modalProfile .pm-user-prefs-panel[data-user-prefs-panel="termos"],
  #modalProfile .pm-user-prefs-panel[data-user-prefs-panel="privacidade"] {
    height: 100%;
    min-height: 0;
  }

  #modalProfile .pm-legal-doc {
    flex: 1 1 auto;
    gap: 24px;
    height: 100%;
    min-height: 0;
  }

  #modalProfile .pm-legal-doc__head {
    margin-right: 56px;
  }

  #modalProfile .pm-legal-doc__title {
    font-size: 20px;
    font-weight: 600;
    line-height: 28px;
    letter-spacing: -0.01em;
  }

  #modalProfile .pm-legal-doc__kicker {
    margin-top: 4px;
    font-size: 13px;
    line-height: 20px;
  }

  #modalProfile .pm-legal-doc__badges {
    margin-top: 8px;
  }

  #modalProfile .pm-legal-doc__badge {
    min-height: 22px;
    padding: 3px 8px;
    background: #eef1f5;
    color: var(--pm-prefs-body, #33415c);
    font-size: 11px;
    font-weight: 600;
    line-height: 16px;
  }

  #modalProfile .pm-legal-doc__badge.is-pending {
    background: #fff6e3;
    color: #8f5300;
  }

  #modalProfile .pm-legal-doc__print {
    min-height: 40px;
    padding: 9px 16px;
    border-color: var(--pm-prefs-line);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    line-height: 20px;
  }

  #modalProfile .pm-legal-doc__print:hover {
    border-color: #c9d3e0;
  }

  #modalProfile .pm-legal-doc__reader {
    flex: 1 1 auto;
    grid-template-columns: 248px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 24px;
    align-items: stretch;
  }

  #modalProfile .pm-legal-doc__toc {
    min-height: 0;
    overflow: auto;
  }

  #modalProfile .pm-legal-doc__toc-label {
    margin: 0 0 12px;
    padding: 0 10px;
    font-size: 11px;
    font-weight: 600;
    line-height: 16px;
    color: var(--pm-prefs-muted, #5e6b82);
  }

  #modalProfile .pm-legal-doc__toc ol {
    display: flex;
    flex-direction: column;
    gap: 2px;
    counter-reset: pm-legal-toc;
  }

  #modalProfile .pm-legal-doc__toc li {
    counter-increment: pm-legal-toc;
  }

  /* styles.css pinta todo `a` com !important. */
  #modalProfile .pm-legal-doc__toc a {
    padding: 7px 10px;
    border-radius: 8px;
    color: var(--pm-prefs-body, #33415c) !important;
    font-size: 12px;
    line-height: 16px;
  }

  #modalProfile .pm-legal-doc__toc a::before {
    content: counter(pm-legal-toc) ". ";
  }

  #modalProfile .pm-legal-doc__toc a.is-active,
  #modalProfile .pm-legal-doc__toc a:hover {
    background: var(--pm-prefs-primary-soft, #eaf1fb);
    color: var(--pm-prefs-primary) !important;
    font-weight: 500;
  }

  #modalProfile .pm-legal-doc__scroll {
    height: auto;
    min-height: 0;
    padding: 28px 32px;
    border: 1px solid var(--pm-prefs-line);
    border-radius: 14px;
    background: var(--pm-prefs-soft);
    color: var(--pm-prefs-body, #33415c);
    font-size: 14px;
    line-height: 24px;
  }

  #modalProfile .pm-legal-doc__scroll h2 {
    margin: 0 0 14px;
    font-size: 16px;
    font-weight: 600;
    line-height: 24px;
  }

  #modalProfile .pm-legal-section + .pm-legal-section {
    margin-top: 28px;
  }

  #modalProfile .pm-legal-doc__scroll h2 + p > strong:only-child {
    color: var(--pm-prefs-primary);
    font-weight: 600;
  }
}

@media print {
  #modalProfile .pm-legal-section {
    display: block !important;
  }

  .pm-legal-doc__actions {
    display: none !important;
  }

  .pm-legal-doc__title {
    break-after: avoid;
  }

  .pm-legal-doc__scroll {
    max-height: none;
    overflow: visible;
    border: 0;
    padding: 0;
    background: transparent;
  }
}

@media (max-width: 767px) {
  .pm-legal-doc__title {
    font-size: 20px;
  }
}
