/* Backoffice CSS contract: login. */

:root {
  --login-card-max: 1050px;
  --login-card-min-h: 460px;
  --login-panel-pad-x: 28px;
  --login-panel-pad-y: 34px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  min-width: 320px;
  overflow-x: hidden;
  background: var(--aman-bg);
  color: var(--aman-text-strong);
  font-family: var(--aman-font-family);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--aman-hover);
  color: var(--aman-text-strong);
}

.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--aman-space-2xl);
}

.auth-card {
  width: min(100%, var(--login-card-max));
  min-height: var(--login-card-min-h);
  overflow: hidden;
  border: 0;
  background: var(--aman-surface);
  box-shadow: var(--aman-shadow);
}

.auth-grid {
  display: grid;
  grid-template-columns: minmax(0, 68%) minmax(320px, 32%);
  min-height: var(--login-card-min-h);
}

.auth-media {
  position: relative;
  min-height: var(--login-card-min-h);
  overflow: hidden;
  border-right: 1.5px solid var(--aman-line);
  background: var(--aman-wash);
  contain: layout paint;
}

.auth-media img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 36% center;
  pointer-events: none;
  user-select: none;
}

.auth-main {
  min-height: var(--login-card-min-h);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 38px;
  padding: var(--login-panel-pad-y) var(--login-panel-pad-x);
  background: var(--aman-surface);
}

.auth-header {
  text-align: center;
}

.brand-logo {
  display: block;
  width: min(230px, 100%);
  height: auto;
  margin: 0 auto var(--aman-space-md);
}

.version-tag {
  margin: 0;
  color: var(--aman-muted);
  font-family: var(--aman-font-family);
  font-size: var(--aman-font-size-base);
  font-weight: var(--aman-font-weight-medium);
  line-height: 1.35;
}

.auth-body {
  width: 100%;
}

.form-wrapper {
  width: 100%;
  max-width: 292px;
  margin: 0 auto;
}

.form-group {
  margin: 0 0 var(--aman-space-lg);
}

.form-group:last-child {
  margin-bottom: 0;
}

.field-label {
  display: block;
  margin: 0 0 var(--aman-space-xs);
  color: var(--aman-text-strong);
  font-family: var(--aman-font-family);
  font-size: var(--aman-font-size-base);
  font-weight: var(--aman-font-weight-semibold);
  line-height: 1.35;
}

.flash-message {
  margin: 0 0 var(--aman-space-lg);
  padding: var(--aman-space-md) 14px;
  border: 1px solid var(--aman-line);
  background: var(--aman-wash);
  color: var(--aman-muted);
  font-family: var(--aman-font-family);
  font-size: var(--aman-font-size-base);
}

.help-block {
  display: block;
  margin-top: var(--aman-space-sm);
  font-family: var(--aman-font-family);
  font-size: var(--aman-font-size-base);
}

.help-block strong {
  color: var(--aman-danger);
  font-weight: var(--aman-font-weight-semibold);
}

.form-group.has-danger .ml-input {
  border-color: var(--aman-danger);
}

.ml-input {
  width: 100%;
  height: var(--aman-control-h);
  border: 1px solid var(--aman-line);
  border-radius: var(--ui-input-radius);
  background-color: var(--aman-surface);
  padding: 0 var(--aman-input-padding-x, var(--aman-space-14));
  color: var(--aman-text);
  -webkit-text-fill-color: var(--aman-text);
  caret-color: var(--aman-text);
  font-family: var(--aman-font-family);
  font-size: var(--ui-font-md);
  font-weight: var(--aman-font-weight-regular);
  line-height: 1.35;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.ml-input:focus,
.ml-input:active,
.ml-input:focus-visible {
  border-color: var(--aman-line);
  background-color: var(--aman-surface);
  color: var(--aman-text);
  -webkit-text-fill-color: var(--aman-text);
  box-shadow: none;
}

.ml-input:is(:autofill, :-webkit-autofill),
.ml-input:is(:autofill, :-webkit-autofill):is(:hover, :focus, :focus-visible, :active) {
  border-color: var(--aman-line);
  background-color: var(--aman-surface);
  color: var(--aman-text);
  -webkit-text-fill-color: var(--aman-text);
  caret-color: var(--aman-text);
  box-shadow: 0 0 0 1000px var(--aman-surface) inset;
  transition: background-color 9999s ease-out, color 9999s ease-out;
}

.pw-wrap {
  position: relative;
}

.pw-wrap .ml-input {
  padding-right: 76px;
}

.pw-toggle {
  --login-toggle-hover-color: var(--aman-text-strong);
  position: absolute;
  top: 50%;
  right: var(--aman-space-md);
  min-height: 0;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--aman-text-strong);
  -webkit-text-fill-color: var(--aman-text-strong);
  font-family: var(--aman-font-family);
  font-size: var(--aman-font-size-sm);
  font-weight: var(--aman-font-weight-semibold);
  line-height: 1.2;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
  user-select: none;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.pw-toggle:hover,
.pw-toggle:focus,
.pw-toggle:active,
.pw-toggle:focus-visible {
  background: transparent;
  color: var(--login-toggle-hover-color);
  -webkit-text-fill-color: var(--login-toggle-hover-color);
  box-shadow: none;
  text-decoration-color: currentColor;
}

.login-submit {
  width: 100%;
  height: var(--ui-action-button-height);
  min-height: var(--ui-action-button-height);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--aman-line);
  border-radius: var(--ui-button-radius);
  background: var(--aman-surface);
  color: var(--aman-text-strong);
  -webkit-text-fill-color: var(--aman-text-strong);
  font-family: var(--aman-font-family);
  font-size: var(--aman-action-button-font-size);
  font-weight: var(--aman-action-button-font-weight);
  line-height: var(--aman-action-button-line-height);
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.login-submit:hover,
.login-submit:focus,
.login-submit:focus-visible {
  border-color: var(--aman-line);
  background: var(--aman-surface);
  color: var(--aman-text-action-hover);
  -webkit-text-fill-color: var(--aman-text-action-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
  box-shadow: none;
}

@media (max-width: 767px) {
  :root {
    --login-card-min-h: 0;
    --login-panel-pad-x: clamp(20px, 7vw, 28px);
    --login-panel-pad-y: 24px;
  }

  html,
  body {
    min-height: 100%;
    height: auto;
  }

  .auth-shell {
    min-height: 100vh;
    min-height: 100dvh;
    align-items: center;
    padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  }

  .auth-card {
    width: 100%;
    min-height: 0;
  }

  .auth-grid {
    width: 100%;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: clamp(120px, 28dvh, 220px) auto;
  }

  .auth-media {
    min-height: 120px;
    border-right: 0;
    border-bottom: 1px solid var(--aman-line);
  }

  .auth-media img {
    position: absolute;
    object-position: 38% center;
  }

  .auth-main {
    min-height: 0;
    justify-content: flex-start;
    gap: 24px;
    padding: var(--login-panel-pad-y) var(--login-panel-pad-x) 28px;
  }

  .brand-logo {
    width: min(238px, 100%);
    margin-bottom: var(--aman-space-sm);
  }

  .version-tag {
    font-size: var(--aman-font-size-sm);
  }

  .form-wrapper {
    max-width: 100%;
  }

  .form-group {
    margin-bottom: 14px;
  }

  .field-label {
    margin-bottom: var(--aman-space-xs);
  }

  .ml-input,
  .login-submit {
    height: 42px;
    min-height: 42px;
  }

  .pw-wrap .ml-input {
    padding-right: 70px;
  }

  .pw-toggle {
    right: var(--aman-space-10);
  }
}

@media (max-width: 420px) and (max-height: 720px) {
  .auth-grid {
    grid-template-rows: minmax(88px, 20dvh) auto;
  }

  .auth-media {
    min-height: 88px;
  }

  .auth-main {
    gap: 18px;
    padding-top: 20px;
    padding-bottom: 22px;
  }

  .brand-logo {
    width: min(218px, 100%);
  }
}
