/* Studio Admin auth/v2/login layout port, adapted to BD CRM and its five skins.
   Original source and MIT license: app/static/crm/vendor/studio-admin/SOURCE.md. */
:root {
  --ink: var(--crm-ink);
  --ink-soft: color-mix(in srgb, var(--crm-ink-soft) 86%, var(--crm-ink));
  --canvas: #fff;
  --line: var(--crm-line);
  --focus: var(--hub-detail-ink);
  --accent: var(--crm-accent);
  --brand-panel: var(--crm-nav);
  --brand-ink: var(--crm-surface);
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
html[data-crm-skin="signal"] { --brand-panel: #111315; }
html[data-crm-skin="cobalt"] { --brand-panel: var(--crm-ink); }
html[data-crm-skin] { background: var(--canvas); }

* { box-sizing: border-box; }
/* Keep the shared auth document steady at its edges; long forms still scroll. */
html, body { overflow-x: clip; overscroll-behavior: none; }
html { min-width: 320px; background: var(--canvas); }
body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: auto;
  -moz-osx-font-smoothing: auto;
}
html.auth-crm-leaving .login-shell { opacity: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { color: var(--ink); background: var(--crm-accent-soft); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.login-shell {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: 100dvh;
  padding: 8px;
}
.login-panel {
  --background: var(--canvas);
  --foreground: var(--crm-ink);
  --primary: var(--crm-accent);
  --primary-foreground: var(--crm-accent-ink);
  --input: var(--crm-line-strong);
  --muted-foreground: var(--ink-soft);
  --ring: var(--crm-ink);
  --radius-lg: 12px;
  --radius-md: 8px;
  grid-column: 2;
  grid-row: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: calc(100dvh - 16px);
  padding: 20px 40px;
  background: var(--canvas);
}
.login-corporate-brand {
  position: absolute;
  top: 41px;
  right: 40px;
  display: none;
  align-items: center;
  min-height: 46px;
}
.login-corporate-logo { position: relative; display: block; flex: 0 0 72px; width: 72px; height: 46px; overflow: hidden; }
.login-corporate-logo img { position: absolute; top: -18.1px; left: -11.65px; width: 94.4px; height: 94.4px; max-width: none; }
.login-crm-mark { display:none; }
.login-crm-mark img { display:block; width:48px; height:48px; max-width:none; }
.login-content { position: relative; width: min(100%, 350px); margin: auto; }
body:not(.katja-login) .login-content { padding:36px 0; }
.login-heading { text-align: center; }
.login-heading h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 650;
  line-height: 36px;
  letter-spacing: -.028em;
}
.login-heading .login-title-line { display:block; padding-inline:4px; white-space:nowrap; }
.intro { margin: 8px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 19.5px; }
.reset-guidance { display: flex; flex-direction: column; align-items: center; width: 100%; margin: 16px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 19.5px; text-align: center; }
.login-panel [data-reset-retry] { text-decoration: none; }
.login-panel [data-reset-retry][aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
form { display: flex; flex-direction: column; gap: 16px; margin-top: 32px; }
.auth-actions { display: flex; flex-direction: column; gap: 16px; margin-top: 32px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { color: var(--ink-soft); font-size: 12px; font-weight: 400; line-height: 16px; }
.login-panel [data-slot="input"] {
  color-scheme: light;
  background-color: var(--canvas) !important;
  font-size: 13px;
  font-weight: 400;
  line-height: 19.5px;
  color: var(--ink);
  caret-color: var(--ink);
}
/* Chrome owns the autofill background. Keep the existing white auth canvas
   under autofilled text without removing the keyboard focus outline. */
.login-panel input[data-slot="input"]:is(:autofill, :-webkit-autofill) {
  background-color: var(--canvas) !important;
  background-image: none !important;
  box-shadow: inset 0 0 0 1000px var(--canvas) !important;
  color: var(--ink) !important;
  -webkit-text-fill-color: var(--ink) !important;
  caret-color: var(--ink) !important;
}
.login-panel [data-slot="input"]::placeholder { color: var(--ink-soft); opacity: 1; }
.field-error { color: var(--crm-danger); font-size: 12px; line-height: 16px; }
.field-error[hidden] { display: none; }
.login-panel [data-slot="input"][aria-invalid="true"] { border-color: var(--crm-danger); box-shadow: none; }
.login-panel [data-slot="input"][aria-invalid="true"]:focus-visible {
  border-color: var(--crm-danger);
  outline-color: var(--crm-danger);
}
.login-panel :is([data-slot="input"], [data-slot="button"]):focus-visible {
  border-color: var(--ring);
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  box-shadow: none;
}
.remember-option { display: flex; align-items: center; gap: 10px; min-height: 32px; font-size: 13px; font-weight: 400; line-height: 19.5px; cursor: pointer; }
.remember-option small { color: var(--ink-soft); font-size: 12px; }
.login-panel [data-slot="button"] {
  font-size: 13px;
  line-height: 19.5px;
}
/* CRM keeps one control size at every viewport. KATJA retains its accepted
   responsive form dimensions and separate brand card. */
body:not(.katja-login) .login-panel .login-content :is([data-slot="input"], [data-slot="button"]) { height:32px; min-height:32px; font-weight:500; }
body:not(.katja-login) .login-panel .login-content [data-slot="input"] { font-size:13px; line-height:19.5px; }
body:not(.katja-login) .remember-option { min-height:32px; }
.login-panel [data-slot="button"][data-variant="default"] {
  box-shadow: inset 0 -1px 0 rgb(0 0 0 / 12%);
}
.login-panel [data-slot="button"][data-variant="default"]:hover:not(:disabled) { background: var(--crm-accent-hover); color: var(--crm-accent-ink); }
.login-panel [data-slot="button"][data-variant="link"] { --primary: var(--hub-detail-ink); }
.status { margin: 16px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 20px; }
.status:not(.is-error) { position: absolute; top: 100%; left: 0; right: 0; }
/* Keep CRM error feedback at the same anchor without re-centering the form. */
html:not([data-auth-surface="katja"]) .login-content .status.is-error { position: absolute; top: 100%; left: 0; right: 0; }
.status:empty { display: none; }
.status.is-error {
  padding: 12px;
  border: 1px solid var(--crm-danger-line, #e9b6b0);
  border-radius: 8px;
  background: var(--crm-danger-soft, #fff4f2);
  color: var(--crm-danger, #b42318);
}
.brand-panel {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: calc(100dvh - 16px);
  padding: 40px;
  border-radius: 24px;
  overflow: hidden;
  isolation: isolate;
  background: var(--brand-panel);
  color: var(--brand-ink);
}
@media (min-width: 1024px) {
  .brand-panel { position: sticky; top: 8px; align-self: start; height: calc(100dvh - 16px); min-height: 0; }
  /* Desktop mark:41px top/24px right, including the8px shell inset. */
  .login-corporate-brand { display:flex; top:33px; right:16px; min-height:48px; }
  .login-corporate-logo { display:none; }
  .login-crm-mark { display:block; width:48px; height:48px; }
}
.brand-panel-motion { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.brand-panel-motion canvas { display: block; width: 100%; height: 100%; }
.brand-panel::after {
  content: '';
  position: absolute;
  inset: auto 0 0;
  z-index: 1;
  height: 220px;
  pointer-events: none;
  background: linear-gradient(to top, var(--brand-panel) 0%, var(--brand-panel) 45%, transparent 100%);
}
.brand-panel-header, .brand-panel-footer { position: relative; z-index: 2; }
.brand-panel-full-logo { position: relative; display: block; flex: 0 0 90px; width: 90px; height: 57.2727px; overflow: hidden; }
.brand-panel-full-logo img { position: absolute; top: -22.9091px; left: -14.7273px; width: 118.5341px; height: 118.5341px; max-width: none; }
.brand-panel-footer { display: flex; align-items: stretch; margin-top: auto; }
.brand-panel-footer > div { flex: 1; min-width: 0; }
.brand-divider {
  flex: 0 0 1px;
  align-self: stretch;
  margin-inline: 12px;
  background: color-mix(in srgb, var(--brand-ink) 36%, var(--brand-panel));
}
.brand-panel-footer h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 16px; font-weight: 650; line-height: 24px; }
.brand-panel-footer h3 svg {
  flex: 0 0 17px;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.brand-panel-footer p { margin: 4px 0 0; color: color-mix(in srgb, var(--brand-ink) 82%, var(--brand-panel)); font-size: 13px; line-height: 19.5px; }
@media (prefers-reduced-motion: no-preference) {
  .login-content, .login-corporate-brand, .brand-panel-header, .brand-panel-footer {
    animation: login-arrive 340ms cubic-bezier(.16, 1, .3, 1) both;
  }
  .brand-panel-footer { animation-delay: 45ms; }
  .login-content.auth-swap-enter {
    animation: auth-step-arrive 300ms cubic-bezier(.16, 1, .3, 1) both;
  }
  html.auth-leaving .login-content {
    animation: none;
    opacity: .72;
    filter: blur(2px);
    transform: translateY(-3px);
  }
  @keyframes login-arrive {
    from { opacity: .68; filter: blur(4px); transform: translateY(5px); }
    to { opacity: 1; filter: blur(0); transform: translateY(0); }
  }
  @keyframes auth-step-arrive {
    from { opacity: .64; filter: blur(3px); transform: translateY(5px); }
    to { opacity: 1; filter: blur(0); transform: translateY(0); }
  }
}
@media (max-width: 1023px) {
  .login-shell { display: block; padding: 0; }
  .login-panel { min-height: 100dvh; padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom)); }
  .login-corporate-brand { display: flex; top: calc(24px + env(safe-area-inset-top)); right: calc(24px + env(safe-area-inset-right)); min-height: 36px; }
  .login-corporate-logo { flex-basis: 56px; width: 56px; height: 36px; }
  .login-corporate-logo img { top: -14.1px; left: -9.05px; width: 73.4px; height: 73.4px; }
  .katja-login .login-content { margin:auto; padding:36px 0; }
  .katja-login .login-heading h1 { font-size:24px; line-height:28.8px; }
  .katja-login .login-panel [data-slot="input"] { height:44px; font-size:16px; line-height:24px; }
  .katja-login .remember-option { min-height:44px; }
  .katja-login .login-panel [data-slot="button"] { min-height:44px; }
  .brand-panel { display: none; }
}
@media (max-height:560px) and (max-width:1023px) {
  .katja-login .login-content { padding-block:28px; }
}
@media (prefers-reduced-motion: reduce) {
  .login-panel :is([data-slot="input"], [data-slot="button"]) { transition: none; }
}

@media (max-width:520px) {
  body:not(.katja-login) [data-auth-view="login"] .login-heading h1 { font-size:clamp(22px,6.15vw,24px); line-height:1.2; }
}
