.page {
  width: 100%;
  container-type: inline-size;

  .page-header {
    display: flex;
    flex-direction: column;
    margin-block-end: 1rem;
    gap: clamp(1rem, 2vw, 2rem);

    @container (min-width: 48rem) {
      flex-direction: row;
      align-items: center;
      justify-content: space-between;
    }
  }


  .page-header-title {
    font-size: clamp(1.25rem, 2.5vw, 1.5rem);
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
    line-height: 1.4;
  }

  .page-header-description {
    color: var(--text-muted);
    font-size: clamp(0.875rem, 1.5vw, 1rem);
    line-height: 1.625;
    overflow-wrap: break-word;
    margin: 0;
    font-weight: 400;
    font-family: inherit;
  }

  .page-header-content .page-header-description,
  .page-header-nav .page-header-description,
  .page-header-with-back .page-header-description {
    font-size: clamp(0.875rem, 1.5vw, 1rem);
  }

  .page-header-actions {
    flex-shrink: 0;
    margin-top: 0;
    min-height: 2.5rem;

    @container (min-width: 48rem) {
      align-self: center;
      min-height: auto;
    }

    @container (max-width: 47.99rem) {
      align-self: flex-end;
    }
  }

  .page-header-content {
    min-inline-size: 0;
    flex: 1;
    min-height: 2.5rem;
    display: flex;
    align-items: center;

    @container (min-width: 48rem) {
      min-height: auto;
    }
  }

  .page-header-nav {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
  }

  .page-header-nav svg,
  .page-header-nav .page-header-back-icon {
    margin-top: 0.125rem;
  }

  .page-header-back-link {
    color: var(--color-border-darker);
    transition: color var(--transition-fast);

    &:hover {
      color: var(--color-neutral-text);
    }

    svg {
      width: 1.5rem;
      height: 1.5rem;
    }
  }

  .page-header-back-icon {
    width: 1.5rem;
    height: 1.5rem;
  }

  .page-header-with-back {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
  }

  .page-header-with-back svg,
  .page-header-with-back .page-header-back-icon {
    margin-top: 0.125rem;
  }

  .page-wrapper {
    width: 100%;
  }

  .backoffice-back-link {
    padding: 0.75rem;
    color: var(--color-border-darker);
    border-radius: 0.5rem;
    transition: all var(--transition-fast);

    &:hover {
      color: var(--color-neutral-text);
      background-color: var(--color-neutral-bg);
    }

    svg {
      width: 1.5rem;
      height: 1.5rem;
    }
  }

  .section-spacing {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }

  .icon-left {
    margin-inline-end: 0.5rem;
  }

  .icon-right {
    margin-inline-start: 0.5rem;
  }

  .flex-center {
    display: flex;
    justify-content: center;
  }

  .grid-two-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
    gap: clamp(2rem, 3vw, 2.5rem);
    margin-bottom: 2rem;
    align-items: start;
    container-type: inline-size;

    @container (min-width: 64rem) {
      grid-template-columns: 3fr 1fr;
    }

    @container (max-width: 63.99rem) {
      .grid-sidebar {
        display: contents;
      }

      .mobile-order-1 {
        order: 1;
      }

      .mobile-order-2 {
        order: 2;
      }

      .mobile-order-3 {
        order: 3;
      }

      .mobile-order-4 {
        order: 4;
      }
    }

    > div:first-child {
      display: flex;
      flex-direction: column;
      gap: 1.5rem;
      min-inline-size: 0;
    }

    > div:first-child > * {
      min-inline-size: 0;
    }
  }

  .grid-sidebar {
    display: flex;
    flex-direction: column;
    gap: clamp(1rem, 2vw, 1.5rem);
  }

  .grid-two-columns-fixed {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .muted-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .qr-code-wrapper {
    max-inline-size: 210px;
    inline-size: 100%;
  }

  .page-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    container-type: inline-size;

    .empty-data {
      text-align: center;
      padding: clamp(4rem, 8vw, 5rem) clamp(1.5rem, 3vw, 2rem);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      margin-inline: auto;
      min-height: clamp(24rem, 50vw, 28rem);

      .empty-data-title {
        font-size: clamp(1.25rem, 2.5vw, 1.5rem);
        font-weight: 600;
        color: var(--color-text);
        margin-block-end: clamp(0.875rem, 1.5vw, 1rem);
        letter-spacing: -0.01em;
        line-height: clamp(1.3, 1.5vw, 1.4);
      }

      .empty-data-description {
        color: var(--text-muted);
        font-size: clamp(0.9375rem, 1.8vw, 1.0625rem);
        line-height: 1.6;
        margin-block-end: clamp(2.25rem, 4vw, 2.5rem);
      }

      .empty-data-action {
        display: inline-flex;

        .btn {
          padding: clamp(0.875rem, 1.5vw, 1rem) clamp(2rem, 3vw, 2.25rem);
          font-size: clamp(0.9375rem, 1.5vw, 1rem);
          font-weight: 600;
          box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
          transition: all var(--transition-fast) ease;

          &:hover {
            box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
            transform: translateY(-1px);
          }
        }
      }
    }

    @keyframes pulse {
      0%, 100% {
        transform: scale(1);
      }
      50% {
        transform: scale(1.05);
      }
    }
  }
}

/* Public Authorization Page */
.public-authorization-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.public-authorization-container {
  max-width: 600px;
  width: 100%;
  background: white;
  border-radius: 16px;
  padding: 3rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.public-authorization-header {
  text-align: center;
  margin-bottom: 2rem;
}

.organization-logo {
  max-height: 60px;
  max-width: 200px;
}

.organization-name {
  font-size: 1.5rem;
  font-weight: 600;
  color: #111827;
}

.authorization-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #111827;
  text-align: center;
  margin-bottom: 1.5rem;
}

.plan-info {
  text-align: center;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: #f9fafb;
  border-radius: 8px;
}

.plan-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.5rem;
}

.plan-details {
  font-size: 1rem;
  color: #6b7280;
}

.authorization-status {
  text-align: center;
  margin-bottom: 2rem;
}

.qr-code-container {
  text-align: center;
  margin-bottom: 2rem;
}

.qr-code-container .qr-code-wrapper {
  display: inline-block;
  max-width: 300px;
  width: 100%;
  margin-bottom: 1.5rem;
}

.qr-code-container .qr-code-wrapper img {
  width: 100%;
  height: auto;
}

.pix-qr-code-image {
  max-inline-size: 100%;
  block-size: auto;
}

.pix-copy-container {
  margin-bottom: 1.5rem;
}

.pix-copy-label {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.authorization-instructions {
  font-size: 0.875rem;
  color: #6b7280;
  margin-top: 1rem;
}

.authorization-commitment {
  font-size: 0.75rem;
  color: #6b7280;
  font-style: italic;
  margin-top: 1rem;
  text-align: center;
}

.authorization-info {
  text-align: center;
  padding: 1rem;
  background: #eff6ff;
  border-radius: 8px;
}

.info-text {
  font-size: 0.875rem;
  color: #1e40af;
  margin: 0;
}

.authorization-success {
  text-align: center;
  padding: 2rem;
  margin-bottom: 2rem;
}

.success-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #d1fae5;
  color: #065f46;
  margin-bottom: 1.5rem;
}

.success-icon svg {
  width: 48px;
  height: 48px;
}

.success-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 1rem;
}

.success-message {
  font-size: 1rem;
  color: #6b7280;
  line-height: 1.5;
  margin: 0;
}

.authorization-error {
  text-align: center;
  padding: 2rem;
  margin-bottom: 2rem;
}

.error-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #fee2e2;
  color: #991b1b;
  margin-bottom: 1.5rem;
}

.error-icon svg {
  width: 48px;
  height: 48px;
}

.error-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 1rem;
}

.error-message {
  font-size: 1rem;
  color: #6b7280;
  line-height: 1.5;
  margin: 0;
}

@media (max-width: 640px) {
  .public-authorization-container {
    padding: 2rem 1.5rem;
  }

  .authorization-title {
    font-size: 1.25rem;
  }
}
