/* Gate de login do cpanel — alinhado ao modal canónico GoCore / produção */
:root {
  --pg-auth-accent: #2563eb;
  --pg-auth-accent-hover: #1d4ed8;
  --pg-auth-accent-soft: #60a5fa;
  --pg-auth-accent-soft-hover: #3b82f6;
  --pg-auth-text: #222;
  --pg-auth-muted: #717171;
  --pg-auth-border: #ebebeb;
  --pg-auth-bg: #f3f4f6;
  --pg-auth-card: #fff;
  --pg-auth-radius: 12px;
  --pg-auth-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--pg-auth-bg);
  color: var(--pg-auth-text);
}

body.pg-auth-gate.modal-login-open { overflow: hidden; }

.modal-overlay.modal-login-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.45);
  opacity: 1;
  visibility: visible;
}

.modal-box.modal-login {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 301;
  width: min(100%, 460px);
  max-width: min(480px, calc(100dvw - 2rem));
  min-width: 280px;
  max-height: min(90vh, calc(100dvh - 2rem));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--pg-auth-card);
  border-radius: var(--pg-auth-radius);
  border: 1px solid var(--pg-auth-border);
  box-shadow: var(--pg-auth-shadow);
}

.modal-box.modal-login.is-register {
  width: min(100%, 600px);
  max-width: min(620px, calc(100dvw - 2rem));
}

.modal-box.modal-login .login-form-wrap {
  padding: clamp(1rem, 2.5vw, 1.4rem);
  overflow-y: auto;
}

.modal-tenant-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin-bottom: 0.7rem;
}

.modal-tenant-logo img {
  height: 38px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}

.login-standalone-brand-fallback {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-subtitle {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  color: var(--pg-auth-muted);
  text-align: center;
}

.login-form-wrap label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.login-form-wrap input[type="email"],
.login-form-wrap input[type="password"],
.login-form-wrap input[type="text"],
.login-form-wrap input[type="tel"],
.login-form-wrap select {
  width: 100%;
  min-height: 42px;
  padding: 0.55rem 0.7rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--pg-auth-border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--pg-auth-card);
  color: var(--pg-auth-text);
}

.login-form-wrap input:focus {
  outline: none;
  border-color: var(--pg-auth-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.login-password-wrap {
  position: relative;
  margin-bottom: 0.8rem;
}

.login-password-wrap input {
  margin-bottom: 0 !important;
  padding-right: 2.75rem;
}

.login-password-toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.login-password-toggle:hover {
  background: #f3f4f6;
}

.login-remember {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.login-remember label {
  margin: 0;
  font-weight: 500;
}

.btn-login {
  width: 100%;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: 8px;
  background: var(--pg-auth-accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-login:hover { background: var(--pg-auth-accent-hover); }
.btn-login:disabled { opacity: 0.65; cursor: wait; }

.login-recovery {
  margin: 0.8rem 0 0;
  text-align: center;
  font-size: 0.9rem;
}

.login-account-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
}

.btn-create-account {
  display: block;
  width: 100%;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  background: var(--pg-auth-accent-soft);
  color: #fff !important;
  font-weight: 600;
  text-align: center;
  text-decoration: none !important;
}

.btn-create-account:hover { background: var(--pg-auth-accent-soft-hover); }

.btn-create-account[hidden] { display: none !important; }

.login-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 0.75rem;
}

.login-field-grid[hidden] { display: none !important; }

.login-field { min-width: 0; }

.pg-auth-register #registerForm .login-contact-grid select,
.pg-auth-register #registerForm .login-contact-grid input[type="tel"] {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  margin: 0 0 0.75rem;
}

.login-recaptcha-wrap {
  width: 100%;
  min-height: 78px;
  margin: 0.15rem 0 0.75rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: hidden;
}

.pg-auth-register .g-recaptcha {
  width: 304px;
  max-width: 100%;
  min-height: 78px;
  margin: 0;
}

@media (max-width: 560px) {
  .login-field-grid { grid-template-columns: 1fr; }
  .login-recaptcha-wrap {
    justify-content: flex-start;
  }
}

@media (max-width: 360px) {
  .pg-auth-register .g-recaptcha {
    transform: scale(0.88);
    transform-origin: left top;
  }
}

.login-recovery a {
  color: var(--pg-auth-accent);
  text-decoration: none;
}

.login-recovery a:hover { text-decoration: underline; }

.error-message {
  margin-bottom: 1rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 0.9rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
