/* ===========================================================================
   The front door.

   The sign-in page is the first thing anyone sees, and until now it was
   ERPNext's own card sitting on a navy background: a rounded grey box, a black
   pill button, icons inside the fields, "Welcome! Please sign in to continue."
   None of that is the product behind it.

   This restyles the page into the TILT OS composition: a dark panel
   carrying the TILT dandelion on the left, a porcelain column with the
   form on the right, the same type system and the same restraint as every
   screen after it.

   WHY A STYLESHEET AND NOT OUR OWN PAGE. Frappe's login markup handles the
   parts that are genuinely hard: the two factor challenge, the email link
   flow, password reset, rate limit messages and the redirect chain. Overriding
   the page would mean owning all of that, and the first mistake would lock
   somebody out of the ledger. So the markup stays exactly as Frappe renders it
   and only the presentation changes. Everything here is reversible by clearing
   one Website Settings field.

   Loaded through Website Settings head_html alongside tiltos-login.js.
   =========================================================================== */

@font-face {
  font-family: 'Figtree';
  src: url('/assets/tilt_os/fonts/Figtree-300-900-normal.woff2') format('woff2');
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --pl-rail: #03101B;
  --pl-canvas: #F4F5F6;
  --pl-paper: #FFFFFF;
  --pl-sunk: #EEF1F3;
  --pl-ink: #0A1C2B;
  --pl-graphite: #33475A;
  --pl-slate: #52677A;
  --pl-inverse: #F4F5F6;
  --pl-graphite-dark: #9FB0C0;
  --pl-slate-dark: #6F8296;
  --pl-accent: #0A6E74;
  --pl-accent-hover: #085A5F;
  --pl-teal: #4CC4CB;
  --pl-critical: #9B3A3A;
  --pl-rule: rgba(10, 28, 43, 0.10);
  --pl-rule-strong: rgba(10, 28, 43, 0.18);
  --pl-ease: cubic-bezier(.2, .8, .2, 1);
}

/* --- The two panels -------------------------------------------------------
   38 / 62. The form sits in the wider half, off centre, the way a document
   sets its text block. */
body.tilt-login {
  margin: 0;
  min-height: 100vh;
  background: var(--pl-canvas);
  color: var(--pl-ink);
  font-family: 'Figtree', -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-variant-numeric: tabular-nums lining-nums;
  display: grid;
  grid-template-columns: 38fr 62fr;
}

/* The dark half, and the dandelion in it. */
body.tilt-login #tilt-bg {
  position: relative;
  grid-column: 1;
  background: var(--pl-rail);
  overflow: hidden;
  min-height: 100vh;
}
/* The dandelion fills the panel: the T sits low, its dots rise into the space
   beneath the lockup and fade before they reach it. */
body.tilt-login #tilt-dandelion {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* The lockup: the name and its line, centred under the T. The script sets
   left and top from where the dandelion drew the T; until then the words are
   hidden, so they never jump. If the dandelion cannot load they return to the
   top left (.is-alone), at the size a wordmark is set. */
body.tilt-login #tilt-wordmark {
  position: absolute;
  top: 48px;
  left: 48px;
  z-index: 2;
  text-align: center;
  white-space: nowrap;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 900ms cubic-bezier(.2, .8, .2, 1);
}
body.tilt-login #tilt-wordmark.is-placed { opacity: 1; }
body.tilt-login #tilt-wordmark.is-alone {
  top: 48px !important;
  left: 48px !important;
  transform: none;
  text-align: left;
  opacity: 1;
}
body.tilt-login #tilt-wordmark .tilt-name {
  font-size: 30px;
  font-weight: 400;
  letter-spacing: 0.36em;
  padding-left: 0.36em; /* balances the tracking after the last letter */
  color: var(--pl-inverse);
  line-height: 1;
}
body.tilt-login #tilt-wordmark .tilt-group {
  margin-top: 12px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.34em;
  padding-left: 0.34em;
  text-transform: uppercase;
  color: var(--pl-teal);
  line-height: 1;
}

/* One tracked line of standing, and the address, the way the room states what
   it is rather than selling itself. */
body.tilt-login #tilt-bg::after {
  content: 'TILT OS';
  position: absolute;
  left: 48px;
  right: 48px;
  bottom: 40px;
  z-index: 2;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--pl-slate-dark);
}

/* --- The form half -------------------------------------------------------- */
body.tilt-login #page-login {
  grid-column: 2;
  display: flex;
  align-items: center;
  min-height: 100vh;
  background: var(--pl-canvas);
  padding: 0;
}
body.tilt-login #page-login .page-content-wrapper,
body.tilt-login #page-login main.container {
  width: 100%;
  max-width: none;
  padding: 0;
  margin: 0;
}
body.tilt-login .page-breadcrumbs,
body.tilt-login .page-header-wrapper,
body.tilt-login .page-footer,
body.tilt-login footer.web-footer,
body.tilt-login .page-card-head .app-logo {
  display: none !important;
}
body.tilt-login .page_content {
  display: flex;
  padding: 0 8% 0 8%;
}

/* The card stops being a card. No border, no shadow, no rounded box: a column
   of type on the page, which is what every screen after this looks like. */
body.tilt-login .login-content.page-card {
  width: 100%;
  max-width: 384px;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
body.tilt-login .page-card-head {
  display: block;
  margin: 0 0 32px;
  padding: 0;
  border: 0;
}
/* An eyebrow above the title, the same micro label the product uses. */
body.tilt-login .page-card-head::before {
  content: 'TILT OS';
  display: block;
  margin-bottom: 12px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--pl-slate);
}
body.tilt-login .page-card-head h4 {
  margin: 0;
  font-family: 'Figtree', -apple-system, 'Segoe UI', sans-serif;
  font-size: 40px;
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.06;
  color: var(--pl-ink);
}
body.tilt-login .page-card-subtitle {
  margin: 12px 0 0;
  max-width: 40ch;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.55;
  color: var(--pl-slate);
}

/* --- Fields --------------------------------------------------------------- */
body.tilt-login .form-group { margin: 0 0 20px; }
body.tilt-login .for-login .page-card .page-card-body .form-label,
body.tilt-login .for-forgot .page-card .page-card-body .form-label,
body.tilt-login .for-login-with-email-link .page-card .page-card-body .form-label,
body.tilt-login .for-signup .page-card .page-card-body .form-label {
  display: block;
  margin-bottom: 8px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--pl-graphite);
}
body.tilt-login .for-login .page-card .page-card-body input[type='text'],
body.tilt-login .for-forgot .page-card .page-card-body input[type='text'],
body.tilt-login .for-login-with-email-link .page-card .page-card-body input[type='text'],
body.tilt-login .for-signup .page-card .page-card-body input[type='text'],
body.tilt-login .for-login .page-card .page-card-body input[type='email'],
body.tilt-login .for-forgot .page-card .page-card-body input[type='email'],
body.tilt-login .for-login-with-email-link .page-card .page-card-body input[type='email'],
body.tilt-login .for-signup .page-card .page-card-body input[type='email'],
body.tilt-login .for-login .page-card .page-card-body input[type='password'],
body.tilt-login .for-forgot .page-card .page-card-body input[type='password'],
body.tilt-login .for-login-with-email-link .page-card .page-card-body input[type='password'],
body.tilt-login .for-signup .page-card .page-card-body input[type='password'],
body.tilt-login .for-login .page-card .page-card-body .form-control,
body.tilt-login .for-forgot .page-card .page-card-body .form-control,
body.tilt-login .for-login-with-email-link .page-card .page-card-body .form-control,
body.tilt-login .for-signup .page-card .page-card-body .form-control {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 0;
  color: var(--pl-ink);
  background-color: var(--pl-sunk);
  border: 1px solid var(--pl-rule-strong);
  border-radius: 3px;
  box-shadow: none;
  transition: border-color 140ms var(--pl-ease);
}
body.tilt-login .for-login .page-card .page-card-body .form-control::placeholder,
body.tilt-login .for-forgot .page-card .page-card-body .form-control::placeholder,
body.tilt-login .for-login-with-email-link .page-card .page-card-body .form-control::placeholder,
body.tilt-login .for-signup .page-card .page-card-body .form-control::placeholder { color: var(--pl-slate); }
body.tilt-login .for-login .page-card .page-card-body .form-control:hover,
body.tilt-login .for-forgot .page-card .page-card-body .form-control:hover,
body.tilt-login .for-login-with-email-link .page-card .page-card-body .form-control:hover,
body.tilt-login .for-signup .page-card .page-card-body .form-control:hover { border-color: var(--pl-ink); }
body.tilt-login .for-login .page-card .page-card-body .form-control:focus,
body.tilt-login .for-forgot .page-card .page-card-body .form-control:focus,
body.tilt-login .for-login-with-email-link .page-card .page-card-body .form-control:focus,
body.tilt-login .for-signup .page-card .page-card-body .form-control:focus {
  /* One ring, carried by the field's own border, as in the app: an outline two
     pixels outside a bordered box drew two frames at once. */
  border-color: var(--pl-accent);
  background-color: var(--pl-sunk);
  outline: none;
  box-shadow: 0 0 0 1px var(--pl-accent) inset;
}
/* Frappe puts an icon inside the field. A label already says what the field is. */
/* Frappe puts an icon inside each field and pads the text away from it. A label
   above already says what the field is, so the icon is removed and the padding
   with it. */
body.tilt-login .for-login .page-card .page-card-body .email-field input,
body.tilt-login .for-forgot .page-card .page-card-body .email-field input,
body.tilt-login .for-login-with-email-link .page-card .page-card-body .email-field input,
body.tilt-login .for-signup .page-card .page-card-body .email-field input,
body.tilt-login .for-login .page-card .page-card-body .password-field input,
body.tilt-login .for-forgot .page-card .page-card-body .password-field input,
body.tilt-login .for-login-with-email-link .page-card .page-card-body .password-field input,
body.tilt-login .for-signup .page-card .page-card-body .password-field input { padding-left: 12px; }
body.tilt-login .for-login .page-card .page-card-body .email-field > svg,
body.tilt-login .for-forgot .page-card .page-card-body .email-field > svg,
body.tilt-login .for-login-with-email-link .page-card .page-card-body .email-field > svg,
body.tilt-login .for-signup .page-card .page-card-body .email-field > svg,
body.tilt-login .for-login .page-card .page-card-body .password-field > svg,
body.tilt-login .for-forgot .page-card .page-card-body .password-field > svg,
body.tilt-login .for-login-with-email-link .page-card .page-card-body .password-field > svg,
body.tilt-login .for-signup .page-card .page-card-body .password-field > svg { display: none; }
body.tilt-login .password-field { position: relative; }
body.tilt-login .toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--pl-slate);
  cursor: pointer;
}

/* --- Actions --------------------------------------------------------------
   One filled button, sized to its label rather than stretched across the
   column, because a full width bar is a shout. */
/* Frappe stacks the actions in a centred column, which puts the primary button
   in the middle of a left aligned form. They sit on one line, left, against the
   fields above them. */
body.tilt-login .for-login .page-card .page-card-actions,
body.tilt-login .for-forgot .page-card .page-card-actions,
body.tilt-login .for-login-with-email-link .page-card .page-card-actions,
body.tilt-login .for-signup .page-card .page-card-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 24px;
  padding: 0;
  border: 0;
}
body.tilt-login .page-card-actions .btn.btn-login {
  width: auto;
  min-width: 96px;
  height: 36px;
  padding: 0 20px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: #FFFFFF;
  background: var(--pl-accent);
  border: 1px solid var(--pl-accent);
  border-radius: 3px;
  box-shadow: none;
  transition: background-color 140ms var(--pl-ease), border-color 140ms var(--pl-ease);
}
body.tilt-login .page-card-actions .btn.btn-login:hover,
body.tilt-login .page-card-actions .btn.btn-login:focus {
  background: var(--pl-accent-hover);
  border-color: var(--pl-accent-hover);
  color: #FFFFFF;
}
/* The second way in is a quiet option, not a second primary action. */
body.tilt-login .page-card-actions .btn.btn-login-option,
body.tilt-login .page-card-actions .btn.btn-signup {
  width: auto;
  height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--pl-graphite);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  box-shadow: none;
}
body.tilt-login .page-card-actions .btn.btn-login-option:hover,
body.tilt-login .page-card-actions .btn.btn-signup:hover {
  color: var(--pl-ink);
  background: rgba(10, 28, 43, 0.06);
  border-color: transparent;
}
body.tilt-login .forgot-password-message,
body.tilt-login .sign-up-message,
body.tilt-login .text-center.sign-up-message {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--pl-slate);
  text-align: left;
}
body.tilt-login .forgot-password-message a,
body.tilt-login .sign-up-message a {
  color: var(--pl-accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 140ms var(--pl-ease);
}
body.tilt-login .forgot-password-message a:hover,
body.tilt-login .sign-up-message a:hover { border-bottom-color: rgba(10, 110, 116, 0.28); }

/* --- Failure states -------------------------------------------------------
   A wrong password is not an emergency. It is stated, in the room's own voice,
   and the way back is obvious. */
body.tilt-login .page-card .login-error-banner,
body.tilt-login .page-card .field-error,
body.tilt-login .page-card .alert {
  margin-top: 12px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--pl-critical);
  background: rgba(155, 58, 58, 0.08);
  border: 0;
  border-left: 3px solid var(--pl-critical);
  border-radius: 0 3px 3px 0;
}
body.tilt-login .login-error-banner svg { display: none; }
body.tilt-login .indicator.gray { color: var(--pl-slate); }

/* --- Closing line ---------------------------------------------------------
   The same sentence the product uses when it records what someone did. */
body.tilt-login .page_content > div::after {
  content: 'Access to this environment is recorded.';
  display: block;
  margin-top: 48px;
  padding-top: 16px;
  border-top: 1px solid var(--pl-rule);
  max-width: 384px;
  font-size: 11px;
  color: var(--pl-slate);
}

/* --- Responsive -----------------------------------------------------------
   Below the split the dark panel becomes a band across the top, carrying the
   lockup and the dandelion at its right, and the form takes the full width. */
@media (max-width: 900px) {
  body.tilt-login {
    display: block;
    min-height: 100vh;
  }
  body.tilt-login #tilt-bg {
    position: relative;
    height: 260px;
    min-height: 0;
  }
  body.tilt-login #tilt-wordmark .tilt-name { font-size: 22px; }
  body.tilt-login #tilt-wordmark .tilt-group { margin-top: 9px; font-size: 9px; }
  body.tilt-login #tilt-wordmark.is-alone { top: 32px !important; left: 32px !important; }
  /* The band is short and the lockup now fills it; the form says TILT OS just below. */
  body.tilt-login #tilt-bg::after { display: none; }
  body.tilt-login #page-login { min-height: 0; padding: 48px 0; }
  body.tilt-login .page_content { padding: 0 32px; }
  body.tilt-login .page-card-head h4 { font-size: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  body.tilt-login * { transition-duration: 1ms !important; }
}
