/* Auth page layout (login, nova senha) — scoped under html.modern; reuses Phase 0
   tokens/components. The shell is keyed on .auth-page so every auth screen shares one
   canvas/card system; #login-page stays only for the login-only background image. */
html.modern .auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--m-space-4);
  padding: var(--m-space-5);
  background-color: var(--m-app-bg);
  background-image:
    linear-gradient(var(--m-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--m-grid-line) 1px, transparent 1px);
  background-size: 160px 160px;
}
/* White-label login background: when a real bg image is set (…/{id}-loginbg.png),
   show the image instead of the default grid. */
html.modern #login-page[style*="--login-bg"] {
  background-image: var(--login-bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
html.modern .login-card {
  width: 100%;
  max-width: 420px;
  margin: 0;
  padding: var(--m-space-6);
  text-align: center;
}
html.modern .login-logo-badge {
  width: 96px; height: 96px;
  margin: 0 auto var(--m-space-4);
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--m-radius-lg);
  background: color-mix(in srgb, var(--primary-site-color) 12%, transparent);
}
html.modern .login-logo-badge > img { max-width: 70%; max-height: 70%; }
/* The bottom margin carries the gap to the form. It used to live on the
   subtitle that sat under this title; with that removed the title owns it. */
html.modern .login-title {
  font-size: 28px; font-weight: 700; margin: 0 0 var(--m-space-5); color: var(--m-text);
}
/* Supporting line under the title, where a screen needs one (recuperar senha). The title
   normally owns the whole gap down to the form, so hand that gap to the subtitle when one
   follows it. */
html.modern .login-title:has(+ .auth-subtitle) { margin-bottom: var(--m-space-2); }
html.modern .auth-subtitle {
  margin: 0 0 var(--m-space-5);
  font-size: 14px;
  line-height: 1.55;
  color: var(--m-text-muted);
}
html.modern .login-card .form-group { text-align: left; margin-bottom: var(--m-space-4); }
/* Icon sits INSIDE the field at its right edge. The input-group becomes a plain
   relative box so the .form-control spans the full width and the icon overlays it
   (padding-right reserves the space). position:relative needs !important to beat
   theme-custom.css's `.input-group { position: initial !important }` — without a
   positioned container the absolute icon escapes to the viewport edge (scoped to
   .auth-page). theme-custom.css also forces the addon background-color with
   !important, so we override it the same way; the addon color token
   (--select-group-addon-color) is already theme-aware, so we leave it. z-index keeps
   the icon above the input's Bootstrap z-index:2 (the opaque fill would otherwise hide
   it), and pointer-events:none lets clicks fall through to the input. */
html.modern .auth-page .input-group-icon { display: block; position: relative !important; }
html.modern .auth-page .input-group-icon .form-control {
  display: block; float: none; width: 100%;
  padding-right: 40px;
  border-radius: var(--m-radius-sm);
}
html.modern .auth-page .input-group-icon .input-group-addon {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 3;
  display: flex; align-items: center; width: auto;
  padding: 0 var(--m-space-3);
  background: transparent !important;
  border: none !important;
  pointer-events: none;
}
/* "Esqueci minha senha" now lives under the button — right-aligned to the button's edge. */
html.modern .login-forgot { display: block; text-align: right; font-size: 13px; margin-top: var(--m-space-3); }
html.modern .login-card .btn-block { margin-top: var(--m-space-3); }
html.modern .login-signup { text-align: center; margin: var(--m-space-4) 0 0; color: var(--m-text-muted); }
html.modern .login-footer { color: var(--m-text-muted); font-size: 12px; margin: 0; }
/* theme toggle */
html.modern .login-theme-toggle {
  position: fixed; top: 18px; right: 18px;
  width: 40px; height: 40px; border-radius: var(--m-radius-sm);
  border: 1px solid var(--m-card-border); background: var(--m-card-bg);
  color: var(--m-text); cursor: pointer;
}
html.modern .login-theme-toggle:hover { background: rgba(127,127,127,.08); }

/* ---------------------------------------------------------------------------
   Wide variant, for the signup-flow document screens (#238).

   The card is 420px, which suits a login form and not a commercial proposal or a
   terms document -- both were 1000px panels before joining the shell. /new_password
   set the precedent of widening per page (460px in newpass.css); with three screens
   wanting the same width it belongs here instead of being restated in each page file.
   Additive: nothing that /login, /recover_password or /new_password renders changes.

   Text goes left: .login-card centres, which is right for a one-line form and wrong
   for pages of prose. The badge and title keep their own centring.
   --------------------------------------------------------------------------- */
html.modern .login-card.login-card-wide {
  max-width: 1000px;
  text-align: left;
}
html.modern .login-card-wide .login-logo-badge { margin-left: auto; margin-right: auto; }
html.modern .login-card-wide .login-title { text-align: center; }

/* Bootstrap's .row carries -15px side margins; inside the card's padding that pushes
   the content past the rounded corners. The columns keep their own padding. */
html.modern .login-card-wide > form > .row { margin-left: 0; margin-right: 0; }

/* Dense pricing/terms tables scroll in their own box rather than widening the page. */
html.modern .login-card-wide .table-div { overflow-x: auto; }

/* A document card is taller than the viewport, and on a phone its top corner passes
   under the fixed theme toggle. */
@media (max-width: 575px) {
  html.modern .auth-page:has(.login-card-wide) { padding-top: 72px; }
}

/* A native number spinner renders at the input's right edge, which is exactly where the
   icon overlay sits -- padding-right moves the text but not the arrows, so the two collide
   (#239, seen on /signup's "Número"). The icon is the affordance here; on these fields the
   arrows are noise (nobody increments a street number), so they go. Scoped to the icon
   group, so a number field without an overlay keeps its spinner. */
html.modern .auth-page .input-group-icon input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
html.modern .auth-page .input-group-icon input[type="number"]::-webkit-outer-spin-button,
html.modern .auth-page .input-group-icon input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
