/* ==========================================================================
   S&D Notas Fiscal - Acabamento premium da tela de acesso

   Carregado DEPOIS de styles.css. Usa exatamente os mesmos nomes de classe
   e os mesmos ids do sistema (auth-shell, auth-brand, brand-lockup,
   brand-symbol, brand-name, auth-message, auth-eyebrow, auth-proof,
   auth-content, auth-card, auth-card-head, login-tabs, tab-button,
   form-stack, field, input-wrap, button, form-error, form-hint,
   security-note, #cpf4, #staff-user, #staff-password, #setup-*).

   Nenhuma marcacao HTML e nenhum JavaScript precisa mudar.
   Se quiser voltar ao visual anterior, basta remover o link deste arquivo.
   ========================================================================== */

:root {
  --auth-glow: rgba(213, 223, 102, 0.55);
  --auth-ring: rgba(45, 134, 134, 0.16);
  --auth-card-border: rgba(16, 47, 46, 0.09);
  --auth-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* --------------------------------------------------------------------------
   1. Estrutura geral
   -------------------------------------------------------------------------- */

.auth-shell {
  grid-template-columns: minmax(340px, 46%) 1fr;
  background: var(--surface);
  isolation: isolate;
}

/* --------------------------------------------------------------------------
   2. Lado da marca: gradiente vivo, malha de luz e grade tecnica
   -------------------------------------------------------------------------- */

.auth-brand {
  padding: clamp(34px, 4.6vw, 78px);
  background:
    radial-gradient(120% 90% at 12% 8%, rgba(58, 153, 152, 0.42) 0%, transparent 58%),
    radial-gradient(90% 70% at 88% 92%, rgba(213, 223, 102, 0.2) 0%, transparent 62%),
    linear-gradient(152deg, #0c2827 0%, var(--forest-950) 34%, var(--forest-800) 74%, #37716f 100%);
  background-size: 160% 160%, 160% 160%, 100% 100%;
  animation: authAurora 22s var(--auth-ease) infinite alternate;
}

@keyframes authAurora {
  0% { background-position: 0% 0%, 100% 100%, 0 0; }
  100% { background-position: 30% 22%, 70% 74%, 0 0; }
}

/* Grade fina por cima do gradiente, sem elemento novo no HTML. */
.auth-brand::before {
  width: 520px;
  height: 520px;
  right: -250px;
  top: -180px;
  border: 1px solid rgba(213, 223, 102, 0.26);
  box-shadow:
    0 0 0 70px rgba(213, 223, 102, 0.035),
    0 0 0 150px rgba(213, 223, 102, 0.028),
    0 0 0 240px rgba(213, 223, 102, 0.018);
  animation: authFloat 16s ease-in-out infinite alternate;
}

.auth-brand::after {
  width: 300px;
  height: 300px;
  left: -110px;
  bottom: -140px;
  background: radial-gradient(circle, var(--lime-500) 0%, rgba(213, 223, 102, 0) 72%);
  opacity: 0.24;
  filter: blur(6px);
  animation: authFloat 13s ease-in-out infinite alternate-reverse;
}

@keyframes authFloat {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(-22px, 26px, 0) scale(1.07); }
}

/* --------------------------------------------------------------------------
   3. Logotipo
   -------------------------------------------------------------------------- */

.brand-lockup {
  gap: 17px;
  animation: authRise 0.7s var(--auth-ease) both;
}

.brand-symbol {
  position: relative;
  width: 62px;
  height: 62px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 19px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 14px 34px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(6px);
  transition: transform 0.45s var(--auth-ease), box-shadow 0.45s var(--auth-ease);
}

.brand-symbol::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(140deg, var(--auth-glow), transparent 46%);
  opacity: 0;
  transition: opacity 0.45s ease;
  pointer-events: none;
}

.brand-lockup:hover .brand-symbol {
  transform: translateY(-3px) rotate(-2deg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 20px 44px rgba(0, 0, 0, 0.32);
}

.brand-lockup:hover .brand-symbol::after { opacity: 0.35; }

/* O nome fica em duas linhas: marca em cima, produto embaixo. */
.auth-brand .brand-name {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-size: 1.16rem;
  line-height: 1.2;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.auth-brand .brand-name small {
  position: relative;
  display: block;
  width: 100%;
  margin-top: 7px;
  padding-left: 0;
  color: var(--lime-500);
  letter-spacing: 0.14em;
  line-height: 1.2;
}

/* --------------------------------------------------------------------------
   4. Mensagem principal
   -------------------------------------------------------------------------- */

.auth-message {
  margin: 76px 0;
  animation: authRise 0.8s var(--auth-ease) 0.08s both;
}

.auth-eyebrow {
  gap: 12px;
  margin-bottom: 20px;
  letter-spacing: 0.16em;
}

.auth-eyebrow::before {
  width: 34px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--lime-500), rgba(213, 223, 102, 0.15));
}

/* Ponto pulsando ao lado do texto: sinal de sistema no ar. */
.auth-eyebrow::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime-500);
  box-shadow: 0 0 0 0 var(--auth-glow);
  animation: authPulse 2.4s ease-out infinite;
}

@keyframes authPulse {
  0% { box-shadow: 0 0 0 0 var(--auth-glow); }
  70% { box-shadow: 0 0 0 12px rgba(213, 223, 102, 0); }
  100% { box-shadow: 0 0 0 0 rgba(213, 223, 102, 0); }
}

.auth-message h1 {
  font-size: clamp(2.4rem, 4.3vw, 4.75rem);
  letter-spacing: -0.058em;
  text-wrap: balance;
}

.auth-message h1 span {
  background: linear-gradient(96deg, var(--lime-400) 0%, var(--lime-500) 42%, #b9d3a4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Reserva a cor cheia onde gradiente em texto nao e suportado. */
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .auth-message h1 span { color: var(--lime-500); }
}

.auth-message > p {
  margin-top: 26px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 1.04rem;
  line-height: 1.65;
  text-wrap: pretty;
}

/* --------------------------------------------------------------------------
   5. Selos de confianca
   -------------------------------------------------------------------------- */

.auth-proof {
  flex-wrap: wrap;
  gap: 10px;
  animation: authRise 0.8s var(--auth-ease) 0.16s both;
}

.auth-proof span {
  gap: 9px;
  padding: 9px 15px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.82);
  font-weight: 650;
  backdrop-filter: blur(8px);
  transition: border-color 0.3s ease, background 0.3s ease, transform 0.3s var(--auth-ease);
}

.auth-proof span:hover {
  transform: translateY(-2px);
  border-color: rgba(213, 223, 102, 0.45);
  background: rgba(255, 255, 255, 0.1);
}

.auth-proof i {
  width: 7px;
  height: 7px;
  background: var(--lime-500);
  box-shadow: 0 0 0 4px rgba(213, 223, 102, 0.14);
}

@keyframes authRise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   6. Lado do formulario
   -------------------------------------------------------------------------- */

.auth-content {
  position: relative;
  padding: 32px clamp(24px, 6.5vw, 108px);
  background:
    radial-gradient(80% 60% at 50% -10%, rgba(45, 134, 134, 0.07) 0%, transparent 70%),
    linear-gradient(180deg, #ffffff 0%, #fbfdfc 100%);
}

.auth-card {
  position: relative;
  width: min(100%, 486px);
  animation: authRise 0.75s var(--auth-ease) 0.1s both;
}

.auth-card-head { margin-bottom: 30px; }

.auth-card-head h2 {
  font-size: clamp(1.85rem, 3vw, 2.5rem);
  letter-spacing: -0.04em;
  background: linear-gradient(120deg, var(--forest-950) 0%, var(--teal-600) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .auth-card-head h2 { color: var(--forest-950); }
}

.auth-card-head p {
  font-size: 0.97rem;
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   7. Alternador motorista / escritorio com pastilha deslizante
   -------------------------------------------------------------------------- */

.login-tabs {
  position: relative;
  gap: 0;
  margin-bottom: 28px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--soft), #eef4f2);
  box-shadow: inset 0 1px 3px rgba(16, 47, 46, 0.05);
}

/* A pastilha e um pseudo-elemento do proprio container: desliza sem JS. */
.login-tabs::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 6px;
  bottom: 6px;
  left: 6px;
  width: calc(50% - 6px);
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(16, 47, 46, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: transform 0.42s var(--auth-ease);
}

.login-tabs:has(.tab-button:last-child.active)::before {
  transform: translateX(100%);
}

.tab-button {
  position: relative;
  z-index: 1;
  border-radius: 11px;
  padding: 12px 14px;
  font-size: 0.91rem;
  letter-spacing: -0.01em;
  transition: color 0.3s ease, transform 0.3s var(--auth-ease);
}

.tab-button:hover:not(.active) {
  color: var(--forest-800);
  transform: translateY(-1px);
}

.tab-button.active {
  background: transparent;
  color: var(--forest-950);
  box-shadow: none;
}

/* Navegador sem :has continua com o realce direto na aba ativa. */
@supports not selector(:has(*)) {
  .login-tabs::before { display: none; }
  .tab-button.active {
    background: #fff;
    box-shadow: 0 4px 14px rgba(16, 47, 46, 0.1);
  }
}

/* --------------------------------------------------------------------------
   8. Campos
   -------------------------------------------------------------------------- */

.auth-card .form-stack { gap: 19px; }

.auth-card .field label {
  color: #35494a;
  font-size: 0.85rem;
  letter-spacing: -0.005em;
}

.auth-card .input-wrap { z-index: 0; }

.auth-card .input-wrap .icon {
  left: 15px;
  color: #8b9c99;
  transition: color 0.25s ease, transform 0.25s var(--auth-ease);
}

.auth-card .input-wrap input { padding-left: 47px; }

.auth-card .input-wrap:focus-within .icon {
  color: var(--teal-600);
  transform: translateY(-50%) scale(1.06);
}

/* Brilho suave em volta do campo em foco, sem deslocar o layout. */
.auth-card .input-wrap::after {
  content: "";
  position: absolute;
  inset: -3px;
  z-index: -1;
  border-radius: 16px;
  background: linear-gradient(130deg, rgba(45, 134, 134, 0.3), rgba(213, 223, 102, 0.32));
  opacity: 0;
  filter: blur(7px);
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.auth-card .input-wrap:focus-within::after { opacity: 1; }

.auth-card input,
.auth-card select {
  min-height: 52px;
  border-radius: 14px;
  background: #fff;
  font-size: 0.97rem;
  box-shadow: 0 1px 2px rgba(16, 47, 46, 0.04);
}

.auth-card input:hover { border-color: #92a8a4; }

.auth-card input:focus {
  border-color: var(--teal-600);
  box-shadow: 0 0 0 4px var(--auth-ring);
}

/* Campo dos 4 digitos do CPF: numeros grandes, espacados e centralizados. */
#cpf4 {
  padding-left: 47px;
  font-size: 1.45rem;
  font-weight: 780;
  letter-spacing: 0.4em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--forest-950);
}

#cpf4::placeholder {
  font-weight: 600;
  letter-spacing: 0.4em;
  color: #c2cfcc;
}

/* --------------------------------------------------------------------------
   9. Botao de acesso
   -------------------------------------------------------------------------- */

.auth-card .button.primary {
  position: relative;
  overflow: hidden;
  min-height: 54px;
  margin-top: 4px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--forest-900) 0%, var(--forest-800) 48%, var(--teal-600) 130%);
  font-size: 0.95rem;
  letter-spacing: -0.005em;
  box-shadow: 0 12px 26px rgba(40, 77, 76, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition: transform 0.28s var(--auth-ease), box-shadow 0.28s ease, filter 0.28s ease;
}

/* Reflexo que atravessa o botao ao passar o mouse. */
.auth-card .button.primary::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 -60%;
  width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transform: skewX(-18deg);
  transition: left 0.65s var(--auth-ease);
  pointer-events: none;
}

.auth-card .button.primary:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: saturate(1.08);
  box-shadow: 0 18px 38px rgba(40, 77, 76, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.auth-card .button.primary:hover:not(:disabled)::before { left: 115%; }

.auth-card .button.primary:active:not(:disabled) {
  transform: translateY(0) scale(0.995);
  box-shadow: 0 8px 18px rgba(40, 77, 76, 0.22);
}

/* A seta anda um pouco para a direita, reforcando a ideia de avancar. */
.auth-card .button.primary .icon {
  transition: transform 0.32s var(--auth-ease);
}

.auth-card .button.primary:hover:not(:disabled) .icon {
  transform: translateX(4px);
}

/* --------------------------------------------------------------------------
   10. Mensagens de erro, dica e aviso de seguranca
   -------------------------------------------------------------------------- */

.auth-card .form-error {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 15px;
  border-radius: 13px;
  border-left: 3px solid var(--danger);
  font-weight: 600;
  animation: authShake 0.42s ease;
}

.auth-card .form-error::before {
  content: "!";
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 800;
}

@keyframes authShake {
  0%, 100% { transform: translateX(0); }
  22% { transform: translateX(-6px); }
  44% { transform: translateX(5px); }
  66% { transform: translateX(-3px); }
  88% { transform: translateX(2px); }
}

.auth-card .security-note {
  align-items: center;
  margin-top: 22px;
  padding: 15px 16px;
  border: 1px solid rgba(213, 223, 102, 0.5);
  border-radius: 14px;
  background: linear-gradient(120deg, var(--lime-100), #fbfdf0);
  line-height: 1.55;
}

.auth-card .security-note .icon { color: #7c8a2c; }

.auth-card .form-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 22px;
  font-size: 0.78rem;
}

/* Tracinhos decorativos nas laterais da dica final. */
.auth-card .form-hint::before,
.auth-card .form-hint::after {
  content: "";
  width: 28px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong));
}

.auth-card .form-hint::after {
  background: linear-gradient(90deg, var(--line-strong), transparent);
}

/* --------------------------------------------------------------------------
   11. Foco visivel para navegacao por teclado
   -------------------------------------------------------------------------- */

.auth-card .tab-button:focus-visible,
.auth-card .button:focus-visible,
.auth-card input:focus-visible {
  outline: 2px solid var(--teal-600);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   12. Telas menores
   -------------------------------------------------------------------------- */

@media (max-width: 1180px) {
  .auth-shell { grid-template-columns: minmax(300px, 42%) 1fr; }
  .auth-message { margin: 56px 0; }
}

@media (max-width: 720px) {
  .auth-shell {
    grid-template-columns: 1fr;
    background: linear-gradient(160deg, #0c2827, var(--forest-800) 44%, #fff 44%);
  }

  .auth-brand {
    min-height: 252px;
    padding: 26px 22px 46px;
    background: transparent;
    animation: none;
  }

  .auth-brand::before { width: 320px; height: 320px; right: -170px; top: -130px; }
  .auth-brand::after { width: 200px; height: 200px; left: -90px; bottom: -120px; }

  .auth-message { margin: 26px 0 0; }
  .auth-message h1 { font-size: 2.25rem; letter-spacing: -0.045em; }

  .auth-content {
    min-height: auto;
    padding: 30px 20px 46px;
    background: transparent;
    border-radius: 28px 28px 0 0;
  }

  .auth-card {
    margin-top: -52px;
    padding: 26px 22px 28px;
    border: 1px solid rgba(16, 47, 46, 0.07);
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 26px 60px rgba(16, 47, 46, 0.18);
  }

  .auth-card-head { margin-bottom: 24px; }
  .auth-card-head h2 { font-size: 1.68rem; }
  .auth-card .button.primary { min-height: 52px; }
}

@media (max-width: 420px) {
  .auth-message h1 { font-size: 2rem; }
  #cpf4 { font-size: 1.3rem; letter-spacing: 0.3em; }
  .tab-button { padding: 11px 8px; font-size: 0.85rem; }
}

/* --------------------------------------------------------------------------
   13. Preferencias do usuario
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .auth-brand,
  .auth-brand::before,
  .auth-brand::after,
  .auth-eyebrow::after,
  .brand-lockup,
  .auth-message,
  .auth-proof,
  .auth-card,
  .auth-card .form-error {
    animation: none !important;
  }

  .auth-card .button.primary::before { transition: none; }
  .login-tabs::before { transition: none; }
}

@media (prefers-contrast: more) {
  .auth-card-head h2,
  .auth-message h1 span {
    background: none;
    color: var(--forest-950);
    -webkit-text-fill-color: currentColor;
  }

  .auth-message h1 span { color: var(--lime-400); }
  .auth-card input { border-color: #56706c; }
  .auth-proof span { border-color: rgba(255, 255, 255, 0.45); }
}

@media print {
  .auth-brand { display: none; }
  .auth-shell { grid-template-columns: 1fr; background: #fff; }
  .auth-card { box-shadow: none; }
}
