/* Conta e preferências (#modalProfile) — fonte única de estilo do painel.
   Carregar por último no index para vencer liquid/glass/mobile. */

#modalProfile.pm-modal-backdrop {
  --pm-prefs-ink: var(--pm-color-ink, #172438);
  --pm-prefs-muted: var(--pm-color-muted, #65798f);
  --pm-prefs-line: var(--pm-color-line, #e1e8f0);
  --pm-prefs-surface: var(--pm-color-card, #ffffff);
  --pm-prefs-soft: var(--pm-color-surface, #f3f6fa);
  --pm-prefs-primary: var(--pm-color-primary, #2476ce);
  --pm-prefs-font: var(--pm-font-ui, Roboto, system-ui, -apple-system, "Segoe UI", sans-serif);
}

/* Blur só no overlay (borra a janela atrás). O painel interno fica opaco, sem glass. */
#modalProfile.pm-modal-backdrop,
#modalProfile.pm-modal-backdrop.open {
  backdrop-filter: blur(12px) saturate(1.05) !important;
  -webkit-backdrop-filter: blur(12px) saturate(1.05) !important;
}

#modalProfile .pm-modal.pm-user-prefs-modal,
#modalProfile .pm-modal-head,
#modalProfile .pm-modal-body,
#modalProfile .pm-user-prefs-head,
#modalProfile .pm-user-prefs-body {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background-image: none !important;
}

#modalProfile .pm-modal.pm-user-prefs-modal {
  width: min(1040px, calc(100vw - 32px));
  max-width: 1040px;
  height: min(640px, calc(100vh - 48px));
  max-height: min(640px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--pm-prefs-surface) !important;
  border: 1px solid rgba(23, 36, 56, 0.08);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(23, 36, 56, 0.18);
  color: var(--pm-prefs-ink);
  font-family: var(--pm-prefs-font);
}

#modalProfile .pm-user-prefs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  padding: 20px 24px 12px;
  border-bottom: 1px solid var(--pm-prefs-line);
  background: var(--pm-prefs-surface) !important;
}

#modalProfile .pm-user-prefs-tabs {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding-right: 8px;
}

#modalProfile .pm-user-prefs-tab {
  appearance: none;
  flex: 0 0 auto;
  white-space: nowrap;
  margin: 0;
  padding: 8px 14px;
  border: 1px solid var(--pm-prefs-line);
  border-radius: 999px;
  background: var(--pm-prefs-soft);
  color: var(--pm-prefs-ink);
  font-family: var(--pm-prefs-font);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

#modalProfile .pm-user-prefs-tab[hidden] {
  display: none !important;
}

#modalProfile .pm-user-prefs-tab:hover {
  background: #ffffff;
  border-color: rgba(23, 36, 56, 0.18);
}

#modalProfile .pm-user-prefs-tab.is-active {
  background: var(--pm-prefs-primary);
  border-color: var(--pm-prefs-primary);
  color: #ffffff;
}

#modalProfile .pm-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--pm-prefs-line);
  border-radius: 10px;
  background: var(--pm-prefs-soft);
  color: var(--pm-prefs-ink);
  cursor: pointer;
  transform: none !important;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

#modalProfile .pm-modal-close:hover {
  transform: none !important;
  background: #ffffff;
  border-color: rgba(23, 36, 56, 0.18);
  color: var(--pm-prefs-ink);
}

#modalProfile .pm-user-prefs-body.pm-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 24px;
  margin: 0;
  background: var(--pm-prefs-surface) !important;
  color: var(--pm-prefs-ink);
}

#modalProfile .pm-user-prefs-panel {
  min-height: 100%;
  color: var(--pm-prefs-ink);
}

#modalProfile .pm-user-prefs-panel[hidden] {
  display: none !important;
}

#modalProfile .profile-avatar-center {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

#modalProfile .profile-avatar-xl {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px solid var(--pm-prefs-line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-weight: 700;
  font-size: 32px;
  color: #ffffff;
  background: var(--pm-prefs-primary);
  box-shadow: none;
}

#modalProfile .profile-avatar-xl img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

#modalProfile .profile-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

#modalProfile .profile-info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#modalProfile .profile-info-item.full {
  grid-column: span 2;
}

#modalProfile .pii-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--pm-prefs-muted);
}

#modalProfile .pii-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--pm-prefs-ink);
}

#modalProfile .pii-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--pm-prefs-line);
  background: var(--pm-prefs-soft);
  color: var(--pm-prefs-ink);
}

#modalProfile .pii-perms {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

#modalProfile .pii-perm {
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
}

#modalProfile .pii-perm.on {
  border: 1px solid rgba(36, 118, 206, 0.22);
  background: rgba(36, 118, 206, 0.08);
  color: var(--pm-prefs-ink);
}

#modalProfile .pii-perm.off {
  border: 1px solid var(--pm-prefs-line);
  background: var(--pm-prefs-soft);
  color: var(--pm-prefs-muted);
}

#modalProfile .profile-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--pm-prefs-line);
}

#modalProfile .profile-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--pm-prefs-line);
  border-radius: 12px;
  background: var(--pm-prefs-soft);
  color: var(--pm-prefs-ink);
  font-family: var(--pm-prefs-font);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

#modalProfile .profile-action-btn:hover {
  background: #ffffff;
  border-color: rgba(23, 36, 56, 0.18);
  transform: none;
}

#modalProfile .profile-action-btn:active {
  transform: none;
}

#modalProfile .profile-action-btn__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  flex: 0 0 auto;
}

#modalProfile .setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--pm-prefs-line);
  background: var(--pm-prefs-soft);
  margin-bottom: 10px;
  color: var(--pm-prefs-ink);
}

#modalProfile .setting-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--pm-prefs-ink);
}

#modalProfile .setting-desc {
  font-size: 13px;
  margin-top: 4px;
  line-height: 1.35;
  color: var(--pm-prefs-muted);
}

#modalProfile .divider {
  height: 1px;
  background: var(--pm-prefs-line);
  margin: 10px 0 12px;
}

#modalProfile #btnReset.pm-user-prefs-reset,
#modalProfile #btnReset,
#modalProfile #pmCookiePrefsSave.pm-user-prefs-reset,
#modalProfile #pmCookiePrefsSave {
  appearance: none;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--pm-prefs-line);
  border-radius: 12px;
  background: var(--pm-prefs-primary);
  color: #ffffff;
  font-family: var(--pm-prefs-font);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  cursor: pointer;
  box-shadow: none !important;
  transform: none !important;
  filter: none !important;
  transition: none !important;
  position: static;
  overflow: visible;
}

#modalProfile #btnReset::after,
#modalProfile #btnReset.pm-user-prefs-reset::after,
#modalProfile #pmCookiePrefsSave::after {
  content: none !important;
  display: none !important;
}

#modalProfile #btnReset:hover,
#modalProfile #btnReset:active,
#modalProfile #btnReset:focus-visible {
  background: var(--pm-prefs-primary);
  color: #ffffff;
  box-shadow: none !important;
  transform: none !important;
  filter: none !important;
}

#modalProfile #pmCookiePrefsSave.pm-user-prefs-reset,
#modalProfile #pmCookiePrefsSave {
  border-color: var(--pm-prefs-primary);
  transition: background 0.15s ease, border-color 0.15s ease !important;
}

#modalProfile #pmCookiePrefsSave:hover,
#modalProfile #pmCookiePrefsSave:focus-visible {
  background: #1d5fa8;
  border-color: #1d5fa8;
  color: #ffffff;
  box-shadow: none !important;
  transform: none !important;
  filter: none !important;
}

#modalProfile #pmCookiePrefsSave:active {
  background: #184e8a;
  border-color: #184e8a;
  color: #ffffff;
}

#modalProfile #userPrefsPanelCookies {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

#modalProfile #userPrefsPanelCookies[hidden] {
  display: none !important;
}

#modalProfile .pm-cookie-prefs {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 100%;
}

#modalProfile .pm-cookie-prefs-save,
#modalProfile #pmCookiePrefsSave {
  margin-top: auto;
}

#modalProfile .pm-cookie-prefs-title,
#modalProfile .pm-legal-prefs-title,
#modalProfile .pm-user-prefs-placeholder h3 {
  margin: 0 0 8px;
  font-family: var(--pm-prefs-font);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--pm-prefs-ink);
}

#modalProfile .pm-cookie-prefs-lead {
  margin: 0 0 16px;
  font: var(--pm-type-body-md, 400 14px/20px var(--pm-prefs-font));
  color: var(--pm-prefs-muted);
}

#modalProfile .pm-cookie-prefs-link {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
  color: var(--pm-prefs-primary);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

#modalProfile .pm-cookie-prefs-row .switch {
  cursor: pointer;
}

#modalProfile .pm-cookie-prefs-row .switch span {
  cursor: pointer;
}

#modalProfile .pm-cookie-prefs-row .switch:has(input:disabled),
#modalProfile .pm-cookie-prefs-row .switch input:disabled + span {
  opacity: 0.72;
  cursor: not-allowed;
}

/* `hidden` precisa vencer o display:flex de .setting */
#modalProfile .setting[hidden],
#modalProfile .pm-cookie-prefs-row[hidden] {
  display: none !important;
}

#modalProfile .pm-user-prefs-placeholder p {
  margin: 0 0 14px;
  font: var(--pm-type-body-md, 400 14px/20px var(--pm-prefs-font));
  color: var(--pm-prefs-muted);
}

#modalProfile .pm-user-prefs-placeholder-field {
  width: 100%;
  min-height: 160px;
  height: 220px;
  resize: none;
  padding: 12px 14px;
  border: 1.5px solid var(--pm-prefs-line);
  border-radius: 12px;
  background: var(--pm-prefs-soft);
  color: var(--pm-prefs-ink);
  font: var(--pm-type-body-md, 400 14px/20px var(--pm-prefs-font));
}

@media (max-width: 767px) {
  #modalProfile.pm-modal-backdrop.open {
    align-items: flex-end !important;
    justify-content: stretch !important;
    padding: 0 !important;
    background: rgba(15, 23, 42, 0.32) !important;
  }

  #modalProfile .pm-modal.pm-user-prefs-modal {
    position: relative;
    width: 100% !important;
    max-width: none !important;
    height: calc(100dvh - var(--pm-safe-top, env(safe-area-inset-top, 0px)) - 24px) !important;
    max-height: calc(100dvh - var(--pm-safe-top, env(safe-area-inset-top, 0px)) - 24px) !important;
    border: 0;
    border-radius: 28px 28px 0 0;
    box-shadow: 0 -8px 32px rgba(23, 46, 77, 0.18);
    background: #f5f6f8 !important;
    padding: 10px 0 env(safe-area-inset-bottom, 0px);
    transition: none;
  }

  #modalProfile.pm-modal-backdrop.open .pm-modal.pm-user-prefs-modal {
    animation: pmUmSheetUp 0.34s cubic-bezier(0.32, 0.72, 0, 1) both;
  }

  #modalProfile .pm-modal.pm-user-prefs-modal::before {
    content: "";
    display: block;
    width: 40px;
    height: 5px;
    margin: 0 auto 6px;
    border-radius: 3px;
    background: #d3dae3;
  }

  #modalProfile .pm-user-prefs-head {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 10px;
    padding: 6px 16px 10px 20px;
    border: 0;
    background: transparent !important;
  }

  #modalProfile .pm-user-prefs-head .pm-modal-close {
    align-self: flex-end;
    border: 0;
    border-radius: 50%;
    background: #eaf3ff;
    color: var(--pm-prefs-primary);
  }

  #modalProfile .pm-user-prefs-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }

  #modalProfile .pm-user-prefs-tabs::-webkit-scrollbar {
    display: none;
  }

  #modalProfile .pm-user-prefs-body.pm-modal-body {
    margin: 0 16px 18px;
    padding: 20px 18px;
    border-radius: 20px;
    background: #ffffff !important;
  }
}
