/*
 * Login page.
 *
 * The first screen says whose system this is before it asks for anything. On a
 * wide screen the company line stands on the left over a dark scene and the form
 * waits on a white card on the right; on a phone the same scene is a band at the
 * top and the card becomes the sheet under it — the anatomy of the mobile home
 * the user lands on next.
 *
 * The photo is always muted: the client's image can be anything, and toned down
 * to the brand slate any image reads as calm as the next. The logo lives on the
 * white card, never on the photo — a mark is not put on a busy image without a
 * light surface under it.
 */
.fs-auth-page {
  --fs-auth-photo: url("../../backgrounds/background-dunes-night-3.webp");
  width: 100%;
  min-height: 0;
  overflow: hidden;
}

body.app-loading .fs-auth-shell,
body.app-navigating .fs-auth-shell {
  pointer-events: none;
}

.fs-auth-shell {
  position: fixed;
  inset: 0;
  isolation: isolate;
  overflow-x: hidden;
  overflow-y: auto;
  background: linear-gradient(
    135deg,
    var(--fs-color-auth-scene-start) 0%,
    var(--fs-color-workspace-clouds) 58%,
    var(--fs-color-auth-scene-end) 100%
  );
}

/*
 * The company cover, the same frame the phone opens with — blurred and dimmed
 * until it is a surface rather than a picture. The inset is negative because a
 * blur fades out at its own edge and would leave a bright rim on the screen.
 */
.fs-auth-photo {
  position: fixed;
  z-index: -1;
  inset: -32px;
  background: var(--fs-auth-photo) center / cover no-repeat;
  opacity: 0.9;
  filter: blur(16px) saturate(0.8) brightness(0.48);
  transform: scale(1.04);
  pointer-events: none;
}

.fs-auth-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 430px);
  /* The reading sits in the middle of the screen; the provider signs its foot. */
  grid-template-rows: 1fr auto;
  align-items: center;
  gap: clamp(40px, 7vw, 96px);
  width: min(1180px, 100%);
  min-height: 100%;
  margin: 0 auto;
  padding: 40px clamp(24px, 6vw, 80px) 24px;
}

/* ── The company line ─────────────────────────────────────────────────────── */

.fs-auth-intro {
  display: grid;
  justify-items: start;
  gap: 18px;
  color: var(--fs-color-surface);
}

/*
 * The mark stands on the scene itself. It needs no plate here because the scene
 * is not a picture any more: the cover is blurred and dimmed to an even dark
 * surface, which is the light-neutral ground the brand book asks for, inverted.
 */
.fs-auth-intro__logo {
  display: block;
  max-width: min(340px, 100%);
  height: 86px;
  object-fit: contain;
  object-position: left center;
}

/* The sand rule is the accent of the KPI cards: the same hand on both sides of the door. */
.fs-auth-intro__line::before {
  display: block;
  width: 46px;
  height: 2px;
  margin-bottom: 18px;
  background: var(--fs-color-auth-accent);
  border-radius: 1px;
  content: "";
}

.fs-auth-intro__line {
  max-width: 16ch;
  margin: 0;
  font-size: clamp(25px, 2.5vw, 33px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.035em;
  text-wrap: balance;
  text-shadow: 0 1px 3px var(--fs-color-auth-text-shadow);
}

/* ── The card ─────────────────────────────────────────────────────────────── */

.fs-auth-main {
  display: flex;
  min-width: 0;
  transform: translateY(24px);
}

/*
 * The panel takes the canvas the application itself stands on, not white: after
 * the login the same tone carries every page, and the white fields inside it
 * read as the places to type rather than as one more white box on white.
 */
.fs-auth-card {
  display: grid;
  gap: 14px;
  width: 100%;
  padding: 18px 24px 18px;
  background: var(--fs-color-canvas);
  border-radius: 18px;
  box-shadow:
    0 30px 80px rgb(0 0 0 / 42%),
    0 0 0 1px rgb(255 255 255 / 8%);
}

/* The heading is a quiet line: a small grey lock and the word, centred over the form (уточнено 2026-10-23). */
.fs-auth-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--fs-color-border-subtle);
}

.fs-auth-heading__mark {
  display: block;
  width: 18px;
  height: 18px;
  color: var(--fs-color-text-muted);
}

.fs-auth-heading__mark::before {
  width: 16px;
  height: 16px;
  display: block;
  margin: 1px;
  background: currentcolor;
  -webkit-mask: url("../../icons/lock.svg") center / 16px 16px no-repeat;
  mask: url("../../icons/lock.svg") center / 16px 16px no-repeat;
  content: "";
}

.fs-auth-heading h1 {
  margin: 0;
  color: var(--fs-color-text);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

/* The reason the form is shown again stays on the form: a toast is gone before the password is retyped. */
.fs-auth-alert {
  margin: 0;
  padding: 10px 12px;
  color: var(--fs-color-danger-text);
  background: var(--fs-color-danger-subtle);
  border: 1px solid var(--fs-color-danger-line);
  border-radius: var(--fs-radius-control);
  font-size: var(--fs-text-sm);
  line-height: 1.4;
}

.fs-auth-form {
  display: grid;
  gap: 14px;
}

/* Both fields of a login are obviously required; the markers would only add noise. */
.fs-auth-form .fs-field:has(:required) > label::after {
  content: none;
}

.fs-auth-control {
  position: relative;
  display: flex;
  align-items: center;
}

.fs-auth-control > img {
  position: absolute;
  z-index: 1;
  left: 13px;
  width: 16px;
  height: 16px;
  pointer-events: none;
}

/* An empty login field is not a mistake yet, so it keeps the calm field tone. */
.fs-auth-form .fs-auth-control > input {
  min-height: 44px;
  padding-left: 38px;
  color: var(--fs-color-text);
  background: var(--fs-color-field);
  border-color: var(--fs-color-field-line);
}

/* Browser-filled credentials remain visually identical to credentials typed by the user. */
.fs-auth-form .fs-auth-control > input:-webkit-autofill,
.fs-auth-form .fs-auth-control > input:-webkit-autofill:hover {
  -webkit-text-fill-color: var(--fs-color-text);
  caret-color: var(--fs-color-text);
  box-shadow: 0 0 0 1000px var(--fs-color-field) inset;
}

.fs-auth-form .fs-auth-control > input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--fs-color-text);
  caret-color: var(--fs-color-text);
  box-shadow:
    0 0 0 1000px var(--fs-color-field) inset,
    var(--fs-focus-ring);
}

.fs-auth-form .fs-auth-control > input:autofill {
  color: var(--fs-color-text);
  background: var(--fs-color-field);
}

.fs-auth-form .fs-auth-control--password > input {
  padding-right: 46px;
}

.fs-auth-reveal {
  --fs-auth-reveal-icon: url("../../icons/visibility.svg");
  position: absolute;
  right: 5px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--fs-color-primary);
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.fs-auth-reveal[aria-pressed="true"] {
  --fs-auth-reveal-icon: url("../../icons/visibility-off.svg");
}

.fs-auth-reveal::before {
  width: 20px;
  height: 20px;
  background: currentcolor;
  -webkit-mask: var(--fs-auth-reveal-icon) center / 20px 20px no-repeat;
  mask: var(--fs-auth-reveal-icon) center / 20px 20px no-repeat;
  content: "";
}

@media (hover: hover) {
  .fs-auth-reveal:hover {
    background: var(--fs-color-primary-subtle);
  }
}

.fs-auth-reveal:focus-visible {
  outline: none;
  box-shadow: var(--fs-focus-ring);
}

.fs-auth-hint {
  color: var(--fs-color-warning-text);
  font-size: 12px;
  font-weight: 500;
}

.fs-auth-hint:empty {
  display: none;
}

/*
 * The option is one line: what it does, and a question mark for the rule behind
 * it. A paragraph of policy under a checkbox is not read while signing in, and
 * a panel around two controls only adds a box to a form that is already a panel.
 */
/* The option under the action: a hairline, a switch and two lines of words, the question mark at the end. */
.fs-auth-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--fs-color-border-subtle);
}

.fs-auth-option__control {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--fs-color-text);
  font-size: var(--fs-text-sm);
  font-weight: 500;
  cursor: pointer;
}

.fs-auth-option__text {
  display: grid;
  gap: 1px;
  line-height: 1.3;
}

.fs-auth-option__hint {
  color: var(--fs-color-text-muted);
  font-size: 12px;
  font-weight: 400;
}

/* A switch, not a box: the option is a setting of this device, on or off. */
.fs-auth-option__switch {
  position: relative;
  flex: 0 0 30px;
  width: 30px;
  height: 18px;
  background: var(--fs-color-border);
  border-radius: 9px;
  transition: background-color 0.16s ease;
}

.fs-auth-option__switch::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgb(0 0 0 / 20%);
  transition: transform 0.16s ease;
  content: "";
}

.fs-auth-option__input:checked + .fs-auth-option__switch {
  background: var(--fs-color-primary);
}

.fs-auth-option__input:checked + .fs-auth-option__switch::after {
  transform: translateX(12px);
}

.fs-auth-option__input:focus-visible + .fs-auth-option__switch {
  outline: none;
  box-shadow: var(--fs-focus-ring);
}

.fs-auth-option__control > input.fs-auth-option__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

/* The note on remembered devices: a lead sentence, then facts in two columns — the lead muted, the fact plain. */
.fs-auth-note {
  display: grid;
  gap: var(--fs-space-3);
}

.fs-auth-note__lead {
  margin: 0;
  color: var(--fs-color-text);
}

.fs-auth-note__facts {
  display: grid;
  gap: var(--fs-space-2);
  margin: 0;
  padding-top: var(--fs-space-3);
  border-top: 1px solid var(--fs-color-border-subtle);
}

.fs-auth-note__fact {
  display: grid;
  grid-template-columns: 7.5em minmax(0, 1fr);
  gap: var(--fs-space-2);
  font-size: var(--fs-text-sm);
}

.fs-auth-note__fact dt {
  color: var(--fs-color-text-muted);
  font-weight: 500;
}

.fs-auth-note__fact dd {
  margin: 0;
  color: var(--fs-color-text);
}

/* The product's one help glyph, at the size it is read without a label beside it. */
.fs-auth-question {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  color: var(--fs-color-text-muted);
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.fs-auth-question::before {
  width: 18px;
  height: 18px;
  background: currentcolor;
  -webkit-mask: url("../../icons/task/help.svg") center / 18px 18px no-repeat;
  mask: url("../../icons/task/help.svg") center / 18px 18px no-repeat;
  content: "";
}

@media (hover: hover) {
  .fs-auth-question:hover {
    color: var(--fs-color-primary);
    background: var(--fs-color-primary-subtle);
  }
}

.fs-auth-question:focus-visible {
  outline: none;
  box-shadow: var(--fs-focus-ring);
}

/* The one action: a full-width button with its arrow after the word, a touch of depth and a firm press. */
.fs-auth-card .action-button--wide {
  min-height: 44px;
  border-radius: 12px;
  font-size: var(--fs-text-md);
  letter-spacing: 0.01em;
  box-shadow: 0 1px 0 rgb(255 255 255 / 18%) inset, 0 6px 16px rgb(18 52 92 / 22%);
}

.fs-auth-submit {
  flex-direction: row-reverse;
}

@media (hover: hover) {
  .fs-auth-submit:hover .action-button__icon {
    transform: translateX(2px);
  }
}

.fs-auth-submit .action-button__icon {
  transition: transform 0.16s ease;
}

.fs-auth-help {
  margin: 0;
  color: var(--fs-color-text-secondary);
  font-size: 12px;
  text-align: center;
}

/* A way in, not an answer: the answer is one dialog away and fits in one line. */
.fs-auth-help__link {
  padding: 0;
  color: var(--fs-color-primary-text);
  background: none;
  border: 0;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

@media (hover: hover) {
  .fs-auth-help__link:hover {
    color: var(--fs-color-primary-hover);
  }
}

.fs-auth-help__link:focus-visible {
  outline: none;
  box-shadow: var(--fs-focus-ring);
  border-radius: 4px;
}

/* The provider signs the page quietly at its foot, under both columns. */
.fs-auth-provider {
  display: grid;
  justify-items: center;
  grid-column: 1 / -1;
  gap: 4px;
  margin-top: 24px;
  color: rgb(255 255 255 / 42%);
}

/* A typographic signature in one line of spaced capitals, quiet on the scene as a maker's mark on an object. */
.fs-auth-provider__name {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: rgb(255 255 255 / 62%);
  /* The tracking adds space after the last letter too; this gives it back so the line stays centred. */
  margin-right: -0.26em;
}

/* ── Phone: the scene is a band, the card is the sheet under it ──────────── */

/* ── The error page: the sign-in frame with a code and a card ────────────────── */

/*
 * The code stands where the company line stands on sign-in: large and quiet on the scene, so it is read first
 * and needs no explaining. The card says the rest in words with a sign of what kind of failure it is.
 */
.fs-error-intro__code {
  margin: 0;
  color: rgb(255 255 255 / 92%);
  font-size: clamp(88px, 12vw, 148px);
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  line-height: 0.9;
  letter-spacing: -0.05em;
  text-shadow: 0 2px 12px var(--fs-color-auth-text-shadow);
}

.fs-error-intro__code::before {
  display: block;
  width: 46px;
  height: 2px;
  margin-bottom: 22px;
  background: var(--fs-color-auth-accent);
  border-radius: 1px;
  content: "";
}

.fs-error-card {
  justify-items: start;
  gap: 12px;
  padding: 28px 34px 24px;
}

.fs-error-card__sign {
  --fs-error-sign: url("../../icons/task/alert-triangle.svg");
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 4px;
  color: var(--fs-color-warning-text);
  background: var(--fs-color-warning-subtle);
  border-radius: 16px;
}

.fs-error-card__sign::before {
  width: 26px;
  height: 26px;
  background: currentcolor;
  -webkit-mask: var(--fs-error-sign) center / 26px 26px no-repeat;
  mask: var(--fs-error-sign) center / 26px 26px no-repeat;
  content: "";
}

.fs-error-card[data-kind="missing"] .fs-error-card__sign {
  --fs-error-sign: url("../../icons/search.svg");
  color: var(--fs-color-primary-text);
  background: var(--fs-color-primary-subtle);
}

.fs-error-card[data-kind="locked"] .fs-error-card__sign {
  --fs-error-sign: url("../../icons/lock.svg");
  color: var(--fs-color-primary-text);
  background: var(--fs-color-primary-subtle);
}

.fs-error-card[data-kind="broken"] .fs-error-card__sign {
  color: var(--fs-color-danger-text);
  background: var(--fs-color-danger-subtle);
}

.fs-error-card__title {
  margin: 0;
  color: var(--fs-color-text);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.fs-error-card__message {
  margin: 0;
  color: var(--fs-color-text-secondary);
  font-size: var(--fs-text-md);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.fs-error-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.fs-error-card__reference {
  width: 100%;
  margin: 8px 0 0;
  padding-top: 12px;
  color: var(--fs-color-text-muted);
  border-top: 1px solid var(--fs-color-border-subtle);
  font-size: var(--fs-text-xs);
}

.fs-error-card__reference code {
  color: var(--fs-color-text-secondary);
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  user-select: all;
}

@media (max-width: 760px) {
  .fs-auth-stage {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
  }

  .fs-auth-intro {
    align-content: end;
    gap: 12px;
    min-height: 32svh;
    padding: max(28px, env(safe-area-inset-top)) 22px 34px;
  }

  .fs-auth-intro__logo {
    height: 62px;
  }

  .fs-auth-intro__line {
    font-size: 23px;
  }

  .fs-auth-intro__line::before {
    margin-bottom: 12px;
  }

  .fs-auth-main {
    flex: 1;
    width: 100%;
    transform: none;
  }

  /* The sheet rises over the band, so the corner shows the scene lies behind the page. */
  .fs-auth-card {
    align-content: start;
    gap: 18px;
    margin-top: -18px;
    padding: 18px 20px 16px;
    border-radius: 22px 22px 0 0;
    box-shadow: none;
  }

  .fs-auth-heading h1 {
    font-size: 21px;
  }

  .fs-error-intro__code {
    font-size: 72px;
  }

  .fs-error-card {
    padding: 22px 20px 18px;
  }

  .fs-error-card__title {
    font-size: 23px;
  }

  /* The foot closes the same sheet. */
  .fs-auth-provider {
    margin-top: 0;
    padding: 4px 20px max(18px, env(safe-area-inset-bottom));
    color: var(--fs-color-text-muted);
    background: var(--fs-color-canvas);
  }

  .fs-auth-provider__name {
    color: var(--fs-color-text-secondary);
  }
}
