/* Entrar: the brand on one half, the form on the other (Kaue, 30/11/2026,
 * from a reference he sent). The brand is a card again, made premium (Kaue,
 * the same day: "bordas com textura que pareçam sair da tela"):
 *  - the edge is a thread of light, brighter at the top, not a grey line;
 *  - a fine grain sits over the gradient, like printed paper;
 *  - the card leans towards the person in 3D, still (Kaue: "ficar parado
 *    quando passar o mouse"), and the chart floats in front of it.
 * The form stands on the page beside it.
 *
 * Every colour comes from the styles.css tokens, so the dark and the light
 * theme follow; the text is the theme's ink. The inputs and the button keep
 * the rules of `.utility-page .card`.
 */

body.utility-page.login-page {
  display: block;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 16px;
  box-sizing: border-box;
  background:
    radial-gradient(48% 52% at 26% 8%, var(--color-accent-12) 0%, transparent 70%),
    var(--color-bg-app);
  background-attachment: fixed;
}

.login {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 40px;
  width: min(100%, 1320px);
  min-height: calc(100vh - 32px);
  min-height: calc(100dvh - 32px);
  margin: 0 auto;
  align-items: center;
  perspective: 1800px;
}

/* ------------------------------------------------------------- the brand */

.login__brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  height: min(calc(100vh - 56px), 860px);
  height: min(calc(100dvh - 56px), 860px);
  padding: clamp(28px, 4vw, 48px);
  box-sizing: border-box;
  border: 1px solid transparent;
  border-radius: 28px;
  isolation: isolate;
  transform-style: preserve-3d;
  transform: rotateY(2.5deg) rotateX(1deg);
  transform-origin: 30% 50%;
  /* The gradient inside, and the thread of light on the edge (border-box). */
  background:
    radial-gradient(120% 50% at 50% 0%, var(--color-accent-light) 0%, var(--color-accent) 20%, var(--color-accent-40) 40%, transparent 66%) padding-box,
    linear-gradient(180deg, transparent 38%, var(--color-bg-app) 88%) padding-box,
    linear-gradient(180deg, var(--color-surface-2), var(--color-bg-app)) padding-box,
    linear-gradient(165deg, var(--color-accent-light) 0%, var(--color-accent-40) 18%, var(--color-border-soft) 42%, var(--color-border-soft) 70%, var(--color-accent-20) 100%) border-box;
  box-shadow:
    inset 0 1px 0 var(--color-accent-60),
    0 2px 4px var(--color-neutral-12),
    0 30px 60px -18px var(--color-neutral-12),
    0 60px 120px -40px var(--color-accent-20);
}

/* In the light theme the accent's lighter step is a darker gold: the glow
 * keeps to the accent itself, fading into the white card. */
:root[data-theme='light'] .login__brand {
  background:
    radial-gradient(120% 60% at 50% 0%, var(--color-accent-40) 0%, var(--color-accent-20) 30%, var(--color-accent-08) 52%, transparent 76%) padding-box,
    linear-gradient(180deg, var(--color-surface-1), var(--color-surface-2)) padding-box,
    linear-gradient(165deg, var(--color-accent) 0%, var(--color-accent-40) 18%, var(--color-border-soft) 42%, var(--color-border-soft) 70%, var(--color-accent-20) 100%) border-box;
  box-shadow:
    inset 0 1px 0 var(--color-surface-1),
    0 2px 4px var(--color-neutral-12),
    0 30px 60px -20px var(--color-neutral-12),
    0 60px 120px -40px var(--color-accent-40);
}

/* The grain: a fine noise over the whole card, under its content. */
.login__brand::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.16;
  mix-blend-mode: overlay;
  pointer-events: none;
}

:root[data-theme='light'] .login__brand::after {
  opacity: 0.35;
  mix-blend-mode: multiply;
}


.login__brand-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(100%, 430px);
  margin: 0 auto;
  text-align: center;
}

.login__logo {
  width: min(220px, 60%);
  height: auto;
}

.login__logo--light {
  display: none;
}

:root[data-theme='light'] .login__logo--dark {
  display: none;
}

:root[data-theme='light'] .login__logo--light {
  display: block;
}

.login__brand-title {
  margin: 6px 0 0;
  color: var(--color-text);
  font-size: clamp(1.6rem, 2.6vw, 2.15rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  /* Two even lines, never one word alone on the second. */
  text-wrap: balance;
}

/* The closing line of the text: the claim, on its own line, in ink. */
.login__brand-claim {
  display: block;
  margin-top: 6px;
  color: var(--color-text);
  font-weight: 600;
}

/* Each sentence of the title on its own line. */
.login__brand-line {
  display: block;
}

/* The answer of the title, in the BI's yellow, on a line of its own. */
.login__brand-accent {
  display: block;
  color: var(--color-accent);
}

.login__brand-text {
  margin: 0;
  text-wrap: pretty;
  color: var(--color-text-muted);
  font-size: 0.98rem;
  line-height: 1.55;
}

/* The picture of what the BI shows: a profit line rising over a soft area
 * (the BI's one exception to "no gradient", for line charts) and the four
 * marketplaces side by side. Decoration only: no number on it is anybody's. */
.login__chart {
  position: relative;
  transform: translateZ(60px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin-top: 18px;
  padding: 18px 18px 16px;
  border: 1px solid var(--color-border-soft);
  border-radius: 20px;
  background: var(--color-surface-1);
  box-shadow:
    inset 0 1px 0 var(--color-border),
    0 2px 6px var(--color-neutral-12),
    0 28px 70px -10px var(--color-neutral-12),
    0 40px 90px -30px var(--color-accent-20);
  box-sizing: border-box;
  text-align: left;
}

.login__chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.login__chart-label {
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.login__chart-pill {
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--ds-status-success-tint);
  color: var(--ds-status-success-text);
  font-size: 0.78rem;
  font-weight: 700;
}

.login__chart-svg {
  display: block;
  width: 100%;
  height: 112px;
  overflow: visible;
}

.login__chart-grid {
  stroke: var(--color-border-soft);
  stroke-width: 1;
  stroke-dasharray: 3 5;
  vector-effect: non-scaling-stroke;
}

.login__chart-stop--top {
  stop-color: var(--color-accent);
  stop-opacity: 0.32;
}

.login__chart-stop--bottom {
  stop-color: var(--color-accent);
  stop-opacity: 0.02;
}

/* The line and its area rise from the floor of the chart. */
.login__chart-rise {
  transform-box: view-box;
  transform-origin: 50% 100%;
  animation: login-rise 1.5s cubic-bezier(0.23, 1, 0.32, 1) 0.15s both;
}

.login__chart-area {
  fill: url(#login-area);
}

.login__chart-line {
  fill: none;
  stroke: var(--color-accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 520;
  stroke-dashoffset: 520;
  animation: login-draw 1.6s cubic-bezier(0.23, 1, 0.32, 1) 0.2s forwards;
}

/* The last point of the line, with a ring. */
.login__chart-dot {
  position: absolute;
  right: 12px;
  top: calc(18px + 1.5rem + 12px + 112px * 0.2 - 6px);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 0 5px var(--color-accent-20);
  opacity: 0;
  animation: login-fade 0.4s ease 1.5s forwards;
}

.login__chart-channels {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 4px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--color-border-soft);
  list-style: none;
}

.login__channel {
  display: grid;
  grid-template-columns: 20px minmax(0, 7.2rem) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.login__channel img {
  width: 20px;
  height: 20px;
  padding: 2px;
  border-radius: 6px;
  background: var(--color-text);
  object-fit: contain;
  box-sizing: border-box;
}

:root[data-theme='light'] .login__channel img {
  background: var(--color-surface-2);
}

.login__channel-name {
  overflow: hidden;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login__channel-value {
  color: var(--color-text);
  font-size: 0.8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 5.6rem;
}

.login__channel-track {
  flex: 1 1 auto;
  height: 6px;
  border-radius: 99px;
  background: var(--color-surface-3);
  overflow: hidden;
}

.login__channel-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: var(--color-accent);
  animation: login-grow 1.2s cubic-bezier(0.23, 1, 0.32, 1) 0.5s forwards;
}

.login__channel--ml .login__channel-fill { --to: 92%; }
.login__channel--sp .login__channel-fill { --to: 71%; }
.login__channel--az .login__channel-fill { --to: 56%; }
.login__channel--tt .login__channel-fill { --to: 38%; }

@keyframes login-rise {
  from {
    transform: scaleY(0.12);
    opacity: 0.4;
  }
}

@keyframes login-draw {
  to { stroke-dashoffset: 0; }
}

@keyframes login-fade {
  to { opacity: 1; }
}

@keyframes login-grow {
  to { width: var(--to); }
}

@media (prefers-reduced-motion: reduce) {
  .login__chart-rise,
  .login__chart-line,
  .login__chart-dot,
  .login__channel-fill {
    animation: none;
    stroke-dashoffset: 0;
    opacity: 1;
  }

  .login__channel-fill {
    width: var(--to);
  }
}

/* -------------------------------------------------------------- the form */

.login__panel {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: clamp(8px, 3vw, 40px);
}

/* The form is no longer a floating card: it sits on the page. */
.utility-page .login__panel .card.login__card {
  width: min(100%, 420px);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.login__title {
  margin: 0 0 6px;
  color: var(--color-text);
  font-size: clamp(1.5rem, 2.4vw, 1.85rem);
  font-weight: 600;
  text-align: center;
}

.login__subtitle {
  margin: 0 0 28px;
  color: var(--color-text-muted);
  font-size: 0.92rem;
  text-align: center;
}

/* Labels in sentence case, like the reference, not the old capitals. */
.login .auth-form span {
  color: var(--color-text);
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.login .auth-form {
  gap: 18px;
}

.utility-page .login .card input {
  border-radius: 12px;
}

.login .auth-link-button {
  font-family: inherit;
}

.login .auth-form button[type='submit'] {
  margin-top: 8px;
}

.login__forgot {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 6px;
}

.login__forgot .auth-help {
  width: 100%;
  box-sizing: border-box;
}

/* ------------------------------------------------------------ the phone */

@media (max-width: 900px) {
  .login {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    min-height: 0;
  }

  /* The brand becomes the top of the page: the logo and the title, under
   * the glow, now centred over the whole width. */

  .login {
    perspective: none;
  }

  .login__brand {
    min-height: 0;
    height: auto;
    padding: 36px 20px 28px;
    border-radius: 22px;
    transform: none;
  }

  .login__brand-body {
    margin: 48px auto 0;
  }

  .login__chart {
    display: none;
  }

  .login__panel {
    padding: 28px 4px 24px;
  }
}
