/* ERP-C — telas de acesso (login, seleção de unidade, recuperação de senha)
   Independente do tema Taurus: não carregar stylesheets.css/mystyles.css junto.
   Depende de css/erpc-base.css (fonte e tokens). */

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body.auth {
  margin: 0;
  font-family: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--navy);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.auth ::selection { background: #cfe0f5; color: var(--ink); }

/* ---------- Estrutura: foto à esquerda, painel à direita ---------- */
.auth-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

.auth-visual {
  flex: 1 1 auto;
  position: relative;
  background-color: #1b3563;
  background-image:
    linear-gradient(115deg, rgba(8, 22, 40, .62) 0%, rgba(8, 22, 40, .18) 55%, rgba(8, 22, 40, .38) 100%),
    url("../img/auth/login-bg-1280.jpg");
  background-size: cover;
  background-position: center 40%;
}
@media (min-width: 1500px), (min-resolution: 1.5dppx) and (min-width: 1000px) {
  .auth-visual {
    background-image:
      linear-gradient(115deg, rgba(8, 22, 40, .62) 0%, rgba(8, 22, 40, .18) 55%, rgba(8, 22, 40, .38) 100%),
      url("../img/auth/login-bg.jpg");
  }
}

.auth-panel {
  flex: 0 0 var(--panel-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 44px 56px 32px;
  background: var(--panel);
  box-shadow: -18px 0 48px rgba(4, 12, 24, .28);
  position: relative;
  z-index: 1;
}

/* ---------- Marca ---------- */
.auth-brand { display: flex; flex-direction: column; gap: 6px; }
.brand-word {
  font-size: 40px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--ink);
}
.brand-word .dash { color: var(--brand); letter-spacing: -0.01em; }
.brand-by {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.brand-by strong { font-weight: 700; color: var(--ink-2); }

/* ---------- Conteúdo ---------- */
.auth-main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 0 40px;
}

.auth-title {
  margin: 0 0 6px;
  font-size: 26px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-wrap: balance;
}
.auth-lead {
  margin: 0 0 28px;
  font-size: 15px;
  color: var(--muted);
  max-width: 38ch;
  text-wrap: pretty;
}

.auth-form { display: flex; flex-direction: column; gap: 18px; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.field-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

.input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .15s ease, box-shadow .15s ease;
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder { color: #8a95a3; }
.input:hover { border-color: var(--line-strong); }
.input:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
.input[aria-invalid="true"] { border-color: var(--danger); }

select.input {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%235e6a7a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

/* Senha com botão de mostrar/ocultar */
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 48px; }
.input-action {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.input-action:hover { color: var(--ink); background: #f1f4f8; }
.input-action:focus-visible { outline: none; box-shadow: var(--focus); }
.input-action svg { width: 20px; height: 20px; }
.input-action .icon-hide { display: none; }
.input-action[aria-pressed="true"] .icon-show { display: none; }
.input-action[aria-pressed="true"] .icon-hide { display: block; }

.field-hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}
.field-hint.is-warning { color: #8a4b00; font-weight: 600; }
.field-hint.is-error { color: var(--danger); font-weight: 600; }

.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: flex-start;
  margin: 0 0 20px -2px;
}
.auth-back svg { width: 16px; height: 16px; }
.field-hint[hidden] { display: none; }

/* ---------- Botões e links ---------- */
.btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 48px;
  margin-top: 6px;
  padding: 0 20px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.005em;
  color: #fff;
  background: var(--brand);
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color .15s ease, box-shadow .15s ease;
}
.btn-primary:hover { background: var(--brand-hover); }
.btn-primary:active { background: var(--brand-press); }
.btn-primary:focus-visible { outline: none; box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--brand); }
.btn-primary .spinner { display: none; }
.btn-primary.is-loading { pointer-events: none; background: var(--brand-hover); }
.btn-primary.is-loading .spinner {
  display: block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin .7s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }

.link {
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
  text-underline-offset: 3px;
  border-radius: 2px;
}
.link:hover { color: var(--brand-hover); text-decoration: underline; }
.link:focus-visible { outline: none; box-shadow: var(--focus); }
.link-small { font-size: 13px; }

.auth-alt { margin: 22px 0 0; font-size: 14px; color: var(--muted); text-align: center; }

/* ---------- Mensagens (displayMessagesAndErrors) ---------- */
.auth-messages:empty { display: none; }
.auth-messages { margin-bottom: 22px; }
.auth-messages .alert {
  position: relative;
  margin: 0 0 10px;
  padding: 12px 40px 12px 14px;
  font-size: 14px;
  line-height: 1.45;
  border: 1px solid;
  border-radius: var(--radius);
}
.auth-messages .alert ul { margin: 0; padding: 0; list-style: none; }
.auth-messages .alert li + li { margin-top: 4px; }
.auth-messages .alert-danger { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-line); }
.auth-messages .alert-info,
.auth-messages .alert-success { color: var(--info); background: var(--info-bg); border-color: var(--info-line); }
.auth-messages .alert .close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  color: currentColor;
  opacity: .6;
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}
.auth-messages .alert .close:hover { opacity: 1; }
.auth-messages .alert .close:focus-visible { outline: none; opacity: 1; box-shadow: var(--focus); }

/* ---------- Etapa 2: usuário, grid de campos, verificação ---------- */
.auth-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  padding: 12px 14px;
  background: #f5f7fa;
  border: 1px solid #e6eaf0;
  border-radius: 8px;
}
.auth-avatar {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--brand-tint);
}
.auth-avatar--initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: 0.02em;
}
.auth-user-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.auth-user-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.field-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; }

input[type="date"].input { padding-right: 10px; }
input[type="date"].input::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }
input[type="date"].input::-webkit-calendar-picker-indicator:hover { opacity: .9; }

.input[readonly] { background: #f3f5f8; color: var(--ink-2); border-color: #e1e6ec; cursor: default; }
.input[readonly]:hover { border-color: #e1e6ec; }
.input[readonly]:focus { border-color: var(--line-strong); box-shadow: none; }
input[type="date"].input[readonly]::-webkit-calendar-picker-indicator { display: none; }

.input:disabled, .btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary:disabled:hover { background: var(--brand); }

.auth-verify { display: flex; align-items: center; gap: 8px; margin: -4px 0 0; }
.auth-verify[hidden] { display: none; }
.spinner-inline {
  width: 14px;
  height: 14px;
  border: 2px solid #c9d4e2;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: auth-spin .7s linear infinite;
}

/* ---------- Botões secundários ---------- */
.btn-secondary,
.btn-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  padding: 0 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease;
}
.btn-secondary { color: var(--ink); background: #fff; border: 1px solid var(--line-strong); }
.btn-secondary:hover { background: #f3f6f9; border-color: #8e9bab; }
.btn-text { color: var(--muted); background: transparent; border: 0; padding: 0 10px; }
.btn-text:hover { color: var(--ink); background: #f3f6f9; }
.btn-secondary:focus-visible, .btn-text:focus-visible { outline: none; box-shadow: var(--focus); }
.btn-primary.btn-inline { width: auto; height: 42px; margin-top: 0; font-size: 14px; }

/* ---------- Diálogo (aviso de assinatura Asaas) ---------- */
.auth-dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  color: var(--ink);
  background: #fff;
  border: 0;
  border-radius: 10px;
  box-shadow: 0 24px 60px rgba(4, 12, 24, .35), 0 4px 12px rgba(4, 12, 24, .12);
  overflow: auto;
}
.auth-dialog::backdrop { background: rgba(6, 16, 30, .6); }
.auth-dialog[open] { animation: auth-dialog-in .18s ease-out; }
@keyframes auth-dialog-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.auth-dialog-head { display: flex; align-items: center; gap: 14px; padding: 22px 24px 6px; }
.auth-dialog-title { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; }
.auth-dialog-close {
  margin-left: auto;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
.auth-dialog-close svg { width: 18px; height: 18px; }
.auth-dialog-close:hover { color: var(--ink); background: #f1f4f8; }
.auth-dialog-close:focus-visible { outline: none; box-shadow: var(--focus); }
.auth-dialog-body { padding: 6px 24px 8px; }
.auth-dialog-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 18px 24px 22px; flex-wrap: wrap; }
.auth-dialog-foot .btn-text { margin-right: auto; }

.asaas-icon {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.asaas-icon svg { width: 20px; height: 20px; }
.asaas-icon--danger { background: #fee4e2; color: #912018; }
.asaas-icon--warn   { background: #fef0c7; color: #7a4a00; }
.asaas-icon--info   { background: var(--brand-tint); color: var(--brand); }

.asaas-msg { margin: 0 0 12px; font-size: 14.5px; line-height: 1.55; color: var(--ink-2); }
.asaas-msg:last-child { margin-bottom: 0; }
.asaas-pay-title { margin: 16px 0 8px; font-size: 13px; font-weight: 700; color: var(--ink); }
.asaas-pay-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.asaas-pay-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; }
.asaas-pay-list li + li { border-top: 1px solid #e8ecf1; }
.asaas-pay-info { min-width: 0; }
.asaas-pay-value { display: block; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.asaas-pay-due { display: flex; align-items: center; gap: 8px; margin-top: 2px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.asaas-hint { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }
.asaas-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; line-height: 18px; white-space: nowrap;
}
.asaas-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.asaas-badge--err  { background: #fee4e2; color: #7a271a; }
.asaas-badge--warn { background: #fef0c7; color: #7a4a00; }

/* Botões gerados pelo aviso (Pagar / Ver boleto) */
.asaas-pay-list .btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  border-radius: 5px;
  border: 1px solid transparent;
}
.asaas-pay-list .btn-success { color: #fff; background: var(--brand); }
.asaas-pay-list .btn-success:hover { background: var(--brand-hover); }
.asaas-pay-list .btn-default { color: var(--ink); background: #fff; border-color: var(--line-strong); }
.asaas-pay-list .btn-default:hover { background: #f3f6f9; }
.asaas-pay-list .btn:focus-visible { outline: none; box-shadow: var(--focus); }

/* ---------- Rodapé ---------- */
.auth-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
  color: var(--muted);
  border-top: 1px solid #edf0f4;
  padding-top: 18px;
}

/* ---------- Responsivo ---------- */
@media (max-width: 960px) {
  .auth-visual { display: none; }
  .auth-panel { flex: 1 1 auto; box-shadow: none; padding: 36px 28px 24px; }
  .auth-main { max-width: 440px; width: 100%; margin: 0 auto; }
  .auth-brand, .auth-footer { max-width: 440px; width: 100%; margin-left: auto; margin-right: auto; }
}
@media (max-width: 420px) {
  .field-grid { grid-template-columns: 1fr; }
  .auth-dialog-foot .btn-secondary, .auth-dialog-foot .btn-primary { flex: 1 1 auto; }
  .asaas-pay-list li { flex-wrap: wrap; }
  .auth-panel { padding: 28px 20px 20px; }
  .brand-word { font-size: 34px; }
  .auth-title { font-size: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  .btn-primary.is-loading .spinner, .spinner-inline { animation-duration: 1.6s; }
  .auth-dialog[open] { animation: none; }
  .input, .btn-primary { transition: none; }
}
