/* ============================================================
   GALA IBB · Portal Corporativo — design system pré-login ("O Traço")
   Reutilizado em login, cadastrar, verificar-email, set-password
   Namespace isolado em .auth-portal-shell para coexistir com Material 3
   ============================================================ */

.auth-portal-shell {
  --bg: #faf7f2;          /* off-white quente */
  --bg-form: #ffffff;     /* branco puro pro form, leve contraste */
  --ink: #0a0a0a;
  --ink-soft: #404040;
  --ink-mute: #666666;
  --rule: #e8e3d8;
  --rule-strong: #d8d2c3;
  --gala-red: #e30613;
  --gala-red-dark: #b30510;
  --green: #16a34a;
  --amber: #f59e0b;
  --red-soft: #dc2626;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  display: block;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.auth-portal-shell *,
.auth-portal-shell *::before,
.auth-portal-shell *::after {
  box-sizing: border-box;
}

/* ============================================================
   PORTAL — split layout
   ============================================================ */
.auth-portal-shell .portal {
  width: 100%;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  background: var(--bg);
  font-family: var(--sans);
  position: relative;
}

@media (max-width: 768px) {
  .auth-portal-shell .portal {
    grid-template-columns: 1fr;
    grid-template-rows: 380px 1fr;
  }
}

/* ============================================================
   HERO
   ============================================================ */
.auth-portal-shell .hero {
  position: relative;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
  padding: 48px 56px 40px;
  display: flex;
  flex-direction: column;
  isolation: isolate;
}

@media (max-width: 768px) {
  .auth-portal-shell .hero {
    padding: 28px 24px 20px;
  }
}

.auth-portal-shell .hero-watermark {
  position: absolute;
  left: clamp(-320px, -15vw, -180px);
  top: 50%;
  transform: translateY(-50%);
  width: clamp(900px, 130vh, 1700px);
  height: clamp(900px, 130vh, 1700px);
  z-index: 0;
  pointer-events: none;
  opacity: 0.1;
  user-select: none;
}

.auth-portal-shell .hero-watermark svg {
  width: 100%;
  height: 100%;
  display: block;
}

@media (max-width: 768px) {
  .auth-portal-shell .hero-watermark {
    width: 620px;
    height: 620px;
    left: -180px;
    top: 58%;
    opacity: 0.075;
  }
}

/* O TRAÇO — cometa senoidal */
.auth-portal-shell .traco {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: visible;
}

.auth-portal-shell .traco-shape {
  fill: url(#cometGradient);
  filter: url(#cometGlow);
  clip-path: inset(0 100% 0 0);
  animation: authPortalCometTrail 7s cubic-bezier(0.55, 0.05, 0.4, 1) infinite;
}

.auth-portal-shell .comet-head {
  display: none;
}

@keyframes authPortalCometTrail {
  0% { clip-path: inset(0 100% 0 0); opacity: 1; }
  60% { clip-path: inset(0 0 0 0); opacity: 1; }
  85% { clip-path: inset(0 0 0 0); opacity: 1; }
  100% { clip-path: inset(0 0 0 0); opacity: 0; }
}

/* HERO content */
.auth-portal-shell .hero-content {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  height: 100%;
  pointer-events: none;
}

.auth-portal-shell .hero-content > * {
  pointer-events: auto;
}

.auth-portal-shell .gala-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  align-self: flex-start;
}

.auth-portal-shell .gala-mark {
  height: 48px;
  display: block;
}

.auth-portal-shell .gala-mark img {
  height: 100%;
  width: auto;
  display: block;
}

@media (max-width: 768px) {
  .auth-portal-shell .gala-mark {
    height: 38px;
  }
}

.auth-portal-shell .brand-meta {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
  padding-left: 16px;
  border-left: 1px solid var(--rule-strong);
  line-height: 1.45;
}

@media (max-width: 768px) {
  .auth-portal-shell .brand-meta {
    display: none;
  }
}

.auth-portal-shell .hero-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 560px;
  padding-top: 24px;
  position: relative;
}

.auth-portal-shell .hero-eyebrow {
  display: inline-block;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  color: var(--gala-red);
  letter-spacing: 0.34em;
  text-transform: uppercase;
  margin-bottom: 24px;
  align-self: flex-start;
}

@media (max-width: 768px) {
  .auth-portal-shell .hero-eyebrow {
    font-size: 10px;
    letter-spacing: 0.28em;
    margin-bottom: 14px;
  }
}

.auth-portal-shell .hero-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 72px;
  line-height: 1;
  letter-spacing: -0.035em;
  color: var(--ink);
  margin: 0;
  text-wrap: balance;
}

.auth-portal-shell .hero-title em {
  font-style: italic;
  font-weight: 500;
}

@media (max-width: 768px) {
  .auth-portal-shell .hero-title {
    font-size: 38px;
    line-height: 1.04;
    letter-spacing: -0.03em;
  }
}

.auth-portal-shell .hero-sub {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 28px 0 0;
  max-width: 460px;
  font-weight: 400;
}

@media (max-width: 768px) {
  .auth-portal-shell .hero-sub {
    font-size: 13px;
    margin-top: 14px;
    max-width: 100%;
  }
}

.auth-portal-shell .hero-foot {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 32px;
}

.auth-portal-shell .hero-foot a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s;
  margin-left: 18px;
}

.auth-portal-shell .hero-foot a:first-child {
  margin-left: 0;
}

.auth-portal-shell .hero-foot a:hover {
  color: var(--ink);
}

@media (max-width: 768px) {
  .auth-portal-shell .hero-foot {
    font-size: 10px;
    margin-top: 18px;
  }
  .auth-portal-shell .hero-foot a {
    margin-left: 12px;
  }
}

/* ============================================================
   FORM
   ============================================================ */
.auth-portal-shell .form-wrap {
  background: var(--bg-form);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 64px;
  position: relative;
  overflow: hidden;
  border-left: 1px solid var(--rule);
}

@media (max-width: 768px) {
  .auth-portal-shell .form-wrap {
    padding: 32px 24px 28px;
    border-left: none;
    border-top: 1px solid var(--rule);
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
  }
}

.auth-portal-shell .form {
  width: 100%;
  max-width: 380px;
  position: relative;
  z-index: 2;
}

@media (max-width: 768px) {
  .auth-portal-shell .form {
    max-width: 100%;
  }
}

.auth-portal-shell .form-title {
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.025em;
  margin: 0;
  line-height: 1.05;
}

@media (max-width: 768px) {
  .auth-portal-shell .form-title {
    font-size: 28px;
  }
}

.auth-portal-shell .form-desc {
  font-size: 14px;
  color: var(--ink-mute);
  line-height: 1.55;
  margin: 10px 0 28px;
}

.auth-portal-shell .form-desc strong {
  color: var(--ink);
  font-weight: 600;
}

/* botão Microsoft */
.auth-portal-shell .btn-ms {
  width: 100%;
  height: 48px;
  background: #fff;
  color: var(--ink);
  border: 1.5px solid var(--rule-strong);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.auth-portal-shell .btn-ms:hover {
  border-color: var(--ink);
  background: #fafafa;
}

.auth-portal-shell .btn-ms:focus-visible {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.12);
}

.auth-portal-shell .divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0;
}

.auth-portal-shell .divider::before,
.auth-portal-shell .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.auth-portal-shell .divider span {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-mute);
}

/* campos */
.auth-portal-shell .field {
  margin-bottom: 16px;
}

.auth-portal-shell .field-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.auth-portal-shell .field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

.auth-portal-shell .field label .opt {
  font-weight: 400;
  color: var(--ink-mute);
  margin-left: 4px;
}

.auth-portal-shell .field a.muted {
  font-size: 13px;
  color: var(--ink-mute);
  text-decoration: none;
  font-weight: 400;
  transition: color 0.15s;
}

.auth-portal-shell .field a.muted:hover {
  color: var(--ink);
  text-decoration: underline;
}

.auth-portal-shell .input-wrap {
  position: relative;
}

.auth-portal-shell .input-wrap input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1.5px solid var(--rule-strong);
  background: #fff;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-portal-shell .input-wrap input::placeholder {
  color: #a8a8a8;
}

.auth-portal-shell .input-wrap input:hover {
  border-color: #b8b1a0;
}

.auth-portal-shell .input-wrap input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.1);
}

/* duas colunas */
.auth-portal-shell .field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 768px) {
  .auth-portal-shell .field-grid {
    grid-template-columns: 1fr;
  }
}

/* botão primário */
.auth-portal-shell .btn-primary {
  width: 100%;
  height: 54px;
  margin-top: 22px;
  background: var(--ink);
  color: #fff;
  border: none;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
  transition: background 0.15s ease, transform 0.15s ease;
}

.auth-portal-shell .btn-primary:hover {
  background: var(--gala-red);
  transform: translateY(-1px);
}

.auth-portal-shell .btn-primary:active {
  transform: translateY(0);
}

.auth-portal-shell .btn-primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.4);
}

.auth-portal-shell .btn-primary[disabled] {
  background: #cccccc;
  cursor: not-allowed;
  transform: none;
}

.auth-portal-shell .btn-primary[disabled]:hover {
  background: #cccccc;
  transform: none;
}

/* botão secundário (outline) */
.auth-portal-shell .btn-secondary {
  width: 100%;
  height: 48px;
  background: #fff;
  color: var(--ink);
  border: 1.5px solid var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.auth-portal-shell .btn-secondary:hover {
  background: var(--ink);
  color: #fff;
}

.auth-portal-shell .btn-secondary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.12);
}

.auth-portal-shell .btn-secondary[disabled] {
  border-color: var(--rule-strong);
  color: var(--ink-mute);
  cursor: not-allowed;
}

.auth-portal-shell .btn-secondary[disabled]:hover {
  background: #fff;
  color: var(--ink-mute);
}

/* link discreto centralizado */
.auth-portal-shell .back-link {
  display: flex;
  justify-content: center;
  margin-top: 24px;
  font-size: 14px;
  font-family: var(--sans);
}

.auth-portal-shell .back-link a {
  color: var(--ink-mute);
  text-decoration: none;
  transition: color 0.15s;
}

.auth-portal-shell .back-link a:hover {
  color: var(--ink);
}

.auth-portal-shell .signup {
  text-align: center;
  margin-top: 24px;
  font-size: 14px;
  color: var(--ink-mute);
}

.auth-portal-shell .signup a {
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1.5px solid var(--gala-red);
  padding-bottom: 1px;
  transition: color 0.15s;
}

.auth-portal-shell .signup a:hover {
  color: var(--gala-red);
}

.auth-portal-shell .trust {
  margin-top: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-mute);
  line-height: 1.5;
  justify-content: center;
}

.auth-portal-shell .trust-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

/* ============================================================
   PASSWORD CRITERIA — checklist com checkmarks dinâmicos
   ============================================================ */
.auth-portal-shell .criteria {
  margin-top: 10px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-mute);
}

.auth-portal-shell .criteria ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-portal-shell .criteria li {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.2s ease;
}

.auth-portal-shell .criteria li .ck-icon {
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--rule-strong);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.auth-portal-shell .criteria li .ck-icon svg {
  width: 8px;
  height: 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.auth-portal-shell .criteria li.ok {
  color: var(--green);
}

.auth-portal-shell .criteria li.ok .ck-icon {
  background: var(--green);
  border-color: var(--green);
}

.auth-portal-shell .criteria li.ok .ck-icon svg {
  opacity: 1;
}

.auth-portal-shell .criteria li .opt-tag {
  font-size: 10px;
  color: var(--ink-mute);
  background: #f4f0e8;
  padding: 1px 6px;
  border-radius: 99px;
  margin-left: auto;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ============================================================
   STRENGTH BAR — barra de força segmentada
   ============================================================ */
.auth-portal-shell .strength {
  margin-top: 12px;
  margin-bottom: 6px;
}

.auth-portal-shell .strength-bar {
  display: flex;
  gap: 4px;
  height: 6px;
  margin-bottom: 6px;
}

.auth-portal-shell .strength-seg {
  flex: 1;
  background: var(--rule);
  transition: background 0.25s ease;
}

.auth-portal-shell .strength-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--sans);
  font-size: 12px;
}

.auth-portal-shell .strength-meta .label {
  color: var(--ink-mute);
}

.auth-portal-shell .strength-meta .value {
  font-weight: 600;
  color: var(--ink-mute);
  transition: color 0.2s ease;
}

.auth-portal-shell .strength[data-level="1"] .strength-seg:nth-child(1) {
  background: var(--red-soft);
}

.auth-portal-shell .strength[data-level="1"] .value {
  color: var(--red-soft);
}

.auth-portal-shell .strength[data-level="2"] .strength-seg:nth-child(-n+2) {
  background: var(--amber);
}

.auth-portal-shell .strength[data-level="2"] .value {
  color: var(--amber);
}

.auth-portal-shell .strength[data-level="3"] .strength-seg:nth-child(-n+3) {
  background: #65a30d;
}

.auth-portal-shell .strength[data-level="3"] .value {
  color: #65a30d;
}

.auth-portal-shell .strength[data-level="4"] .strength-seg {
  background: var(--green);
}

.auth-portal-shell .strength[data-level="4"] .value {
  color: var(--green);
}

/* ============================================================
   CHECKBOX (termos)
   ============================================================ */
.auth-portal-shell .terms {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 10px 0 6px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
  cursor: pointer;
  user-select: none;
}

.auth-portal-shell .terms input {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: 1.5px solid var(--rule-strong);
  background: #fff;
  margin: 0;
  margin-top: 2px;
  position: relative;
  cursor: pointer;
  transition: all 0.15s ease;
}

.auth-portal-shell .terms input:hover {
  border-color: var(--ink);
}

.auth-portal-shell .terms input:checked {
  background: var(--ink);
  border-color: var(--ink);
}

.auth-portal-shell .terms input:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.auth-portal-shell .terms input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.12);
}

.auth-portal-shell .terms a {
  color: var(--ink);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--gala-red);
  text-underline-offset: 2px;
}

/* ============================================================
   STATE PANELS (verificar-email, set-password, cadastro pending)
   ============================================================ */
.auth-portal-shell .state {
  text-align: center;
  width: 100%;
  max-width: 380px;
  position: relative;
  z-index: 2;
}

.auth-portal-shell .state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 28px;
  border: 1.5px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}

.auth-portal-shell .state-icon svg {
  width: 28px;
  height: 28px;
}

@media (max-width: 768px) {
  .auth-portal-shell .state-icon {
    width: 56px;
    height: 56px;
    margin-bottom: 20px;
  }
}

.auth-portal-shell .state-title {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.025em;
  margin: 0 0 14px;
  line-height: 1.1;
  text-wrap: balance;
}

.auth-portal-shell .state-title strong {
  color: var(--ink);
  font-weight: 700;
}

@media (max-width: 768px) {
  .auth-portal-shell .state-title {
    font-size: 24px;
  }
}

.auth-portal-shell .state-sub {
  font-size: 14px;
  color: var(--ink-mute);
  line-height: 1.6;
  margin: 0 0 28px;
  text-wrap: pretty;
}

.auth-portal-shell .cooldown-meta {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-mute);
  text-align: center;
  margin-top: 10px;
}

.auth-portal-shell .cooldown-meta b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Botão de link discreto
   ============================================================ */
.auth-portal-shell .btn-link {
  background: none;
  border: 0;
  padding: 0;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--gala-red);
  text-underline-offset: 3px;
  transition: opacity 0.15s ease;
}

.auth-portal-shell .btn-link:hover {
  opacity: 0.7;
}

.auth-portal-shell .btn-link:disabled {
  color: var(--ink-mute);
  cursor: not-allowed;
  text-decoration-color: var(--rule-strong);
}

/* ============================================================
   Mensagens de erro/status (compatível com .auth-error existente)
   ============================================================ */
.auth-portal-shell .form-error,
.auth-portal-shell .auth-error {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--red-soft);
  margin: 8px 0 0;
  min-height: 18px;
  line-height: 1.4;
}

.auth-portal-shell .form-success,
.auth-portal-shell .auth-success {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--green);
  margin: 8px 0 0;
  min-height: 18px;
  line-height: 1.4;
}

.auth-portal-shell .auth-mode-hint,
.auth-portal-shell .hint {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-mute);
  margin: 6px 0 0;
  line-height: 1.4;
}

/* utilitário hidden (compatível com classe global existente) */
.auth-portal-shell .hidden {
  display: none !important;
}

/* ============================================================
   spinner + reduced motion
   ============================================================ */
.auth-portal-shell .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: authPortalSpin 0.7s linear infinite;
}

.auth-portal-shell .spinner.dark {
  border-color: rgba(10, 10, 10, 0.2);
  border-top-color: var(--ink);
}

@keyframes authPortalSpin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-portal-shell .traco-shape {
    animation: none;
    clip-path: none;
    opacity: 1;
  }
  .auth-portal-shell .comet-head {
    animation: none;
    opacity: 1;
  }
  .auth-portal-shell .spinner {
    animation: none;
  }
}

/* ============================================================
   legal (footer informativo)
   ============================================================ */
.auth-portal-shell .legal {
  position: absolute;
  left: 56px;
  right: 56px;
  bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--ink-mute);
  font-family: var(--sans);
}

.auth-portal-shell .legal a {
  color: inherit;
  text-decoration: none;
  margin-left: 18px;
}

.auth-portal-shell .legal a:hover {
  color: var(--ink);
}

@media (max-width: 768px) {
  .auth-portal-shell .legal {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    margin-top: 24px;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
    font-size: 10px;
  }
}
