.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field-grid .field-full {
  grid-column: 1 / -1;
}

.field {
  min-width: 0;
}

.field > * {
  max-width: 100%;
}

.field > label:where(:not(.check-row):not(.toggle-row):not(.switch)),
.label-row {
  color: var(--form-label-color);
  font-size: var(--form-label-size);
  font-weight: var(--form-label-weight);
  line-height: var(--form-label-line-height);
}

.field > label:where(:not(.check-row):not(.toggle-row):not(.switch)) {
  display: block;
  margin-bottom: var(--form-label-gap);
}

.required-marker {
  color: var(--red-600);
  font-weight: 800;
}

.field:has(input[required], select[required], textarea[required])
  > label:not(:has(.required-marker, .required-mark, .required-star))::after {
  color: var(--red-600);
  content: " *";
  font-weight: 800;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.input-wrap {
  position: relative;
}

.input-wrap > svg {
  position: absolute;
  top: 50%;
  left: 13px;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--ink-400);
  stroke-width: 1.7;
  transform: translateY(-50%);
  pointer-events: none;
}

.input-wrap > svg + input {
  padding-left: 42px;
}

input:where(:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="range"]):not([type="color"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"])),
select,
textarea {
  width: 100%;
  min-height: var(--form-control-height);
  padding: var(--form-control-padding);
  color: var(--ink-900);
  border: 1px solid var(--line-strong);
  border-radius: var(--form-control-radius);
  background: #fff;
  font-size: var(--form-control-font-size);
  font-family: var(--font-body);
  line-height: 1.4;
  outline: none;
  transition:
    border-color 0.18s,
    box-shadow 0.18s,
    background 0.18s;
}

input:where(:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="range"]):not([type="color"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"])),
select {
  height: var(--form-control-height);
}

textarea {
  min-height: 96px;
  line-height: 1.5;
  resize: vertical;
}

.workspace-body input:is([type="date"], [type="month"], [type="datetime-local"]) {
  color-scheme: light;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}

.workspace-body input:is([type="date"], [type="month"], [type="datetime-local"])::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.7;
}

.workspace-body input:is([type="date"], [type="month"], [type="datetime-local"]):hover::-webkit-calendar-picker-indicator {
  opacity: 1;
}

input:disabled,
select:disabled,
textarea:disabled,
input[readonly],
textarea[readonly] {
  color: var(--ink-600);
  background: var(--surface-muted);
  cursor: not-allowed;
  opacity: 1;
}

input::placeholder,
textarea::placeholder {
  color: var(--ink-400);
}

input:where(:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="range"]):not([type="color"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"])):focus,
select:focus,
textarea:focus {
  border-color: var(--form-focus-border);
  outline: none;
  box-shadow: var(--focus);
}

.field.invalid input,
.field.invalid select,
.field.invalid textarea {
  border-color: var(--red-600);
  background: var(--red-50);
}

.field.invalid :is(input, select, textarea):focus {
  border-color: var(--red-600);
  box-shadow: 0 0 0 4px rgba(217, 45, 32, 0.14);
}

.invalid-target {
  border-radius: 12px;
  outline: 2px solid var(--red-600);
  outline-offset: 3px;
}

.field-error {
  min-height: 0;
  margin: var(--form-error-gap) 0 0;
  color: var(--red-700);
  font-size: var(--form-error-size);
  font-weight: 650;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.field-error:empty {
  display: none;
}

.form-alert {
  margin-bottom: 16px;
  padding: 11px 12px;
  color: var(--red-700);
  border: 1px solid var(--red-100);
  border-radius: 11px;
  background: var(--red-50);
  font-size: var(--form-error-size);
  line-height: 1.45;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--violet-700);
  border: 0;
  border-radius: var(--form-control-radius);
  background: transparent;
  font-size: 0;
  transform: translateY(-50%);
}

.password-toggle::before {
  position: relative;
  z-index: 1;
  width: 18px;
  height: 18px;
  background: currentColor;
  content: "";
  transition: transform 0.18s ease;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12Z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12Z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
}

.password-toggle::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--violet-50);
  content: "";
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.85);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.input-wrap input[data-password-visible="true"] + .password-toggle::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3l18 18M10.6 5.1A10.8 10.8 0 0 1 12 5c6.4 0 10 7 10 7a15 15 0 0 1-3 3.6M6.4 6.4C3.5 8.2 2 12 2 12s3.6 7 10 7a10 10 0 0 0 4.1-.8M10 10a3 3 0 0 0 4 4'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3l18 18M10.6 5.1A10.8 10.8 0 0 1 12 5c6.4 0 10 7 10 7a15 15 0 0 1-3 3.6M6.4 6.4C3.5 8.2 2 12 2 12s3.6 7 10 7a10 10 0 0 0 4.1-.8M10 10a3 3 0 0 0 4 4'/%3E%3C/svg%3E");
}

.password-toggle:hover {
  background: transparent;
}

.password-toggle:hover::before {
  transform: scale(1.08);
}

.password-toggle:hover::after {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.password-toggle:focus-visible {
  outline: 2px solid var(--form-focus-border);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .password-toggle::before,
  .password-toggle::after {
    transition: none;
  }

  .password-toggle:hover::before {
    transform: none;
  }
}

.input-wrap input[type="password"],
.input-wrap input[data-password-visible="true"] {
  padding-right: 62px;
}

.form-intro {
  margin-bottom: 24px;
  color: var(--ink-500);
  font-size: 12.5px;
  line-height: 1.55;
}

.form-section + .form-section {
  margin-top: 22px;
  padding-top: 20px;

}

.form-section-title {
  margin-bottom: 13px;
  font-size: 13px;
}

.switch-row {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.switch-row strong,
.switch-row small {
  display: block;
}

.switch-row strong {
  font-size: 11.5px;
}

.switch-row small {
  margin-top: 3px;
  color: var(--ink-500);
  font-size: 10px;
}

.switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex: 0 0 42px;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--ink-400);
  transition: background 0.2s;
}

.switch span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(16, 24, 40, 0.25);
  content: "";
  transition: transform 0.2s var(--ease);
}

.switch input:checked + span {
  background: var(--violet-600);
}

.switch input:checked + span::after {
  transform: translateX(18px);
}

.switch input:focus-visible + span {
  box-shadow: var(--focus);
}

.login-body {
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  background: #f7f8fc;
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(400px, 0.9fr) minmax(460px, 1.1fr);
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.login-story {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: clamp(24px, 3vw, 44px);
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(
      circle at 18% 18%,
      rgba(58, 77, 179, 0.42),
      transparent 34%
    ),
    radial-gradient(
      circle at 90% 82%,
      rgba(58, 77, 179, 0.22),
      transparent 30%
    ),
    linear-gradient(145deg, #111827, #121b2c 58%, #0c1320);
}

.story-copy {
  position: relative;
  z-index: 2;
  width: min(590px, 100%);
  margin: auto 0;
  padding: clamp(24px, 5vh, 54px) 0;
}

.story-copy h1 {
  margin-bottom: 22px;
  font-size: clamp(38px, 4.6vw, 66px);
  line-height: 1.07;
}

.story-copy > p {
  max-width: 520px;
  margin-bottom: 30px;
  color: #aeb8c8;
  font-size: 15px;
  line-height: 1.7;
}

.story-points {
  display: grid;
  gap: 10px;
}

.story-points span {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #dce2eb;
  font-size: 12px;
  font-weight: 650;
}

.story-points i {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: #c8bdff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  font: 700 9px var(--font-body);
}

.story-foot {
  position: relative;
  z-index: 2;
  margin: 0;
  color: #758195;
  font-size: 11px;
}

.story-orbit {
  position: absolute;
  right: -130px;
  bottom: 5%;
  width: 420px;
  height: 420px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 50%;
  animation: spin 35s linear infinite;
}

.story-orbit::before,
.story-orbit::after {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.045);
  border-radius: inherit;
  content: "";
}

.story-orbit::before {
  inset: 55px;
}

.story-orbit::after {
  inset: 112px;
}

.story-orbit span {
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--pink-500);
  box-shadow: 0 0 30px var(--pink-500);
}

.story-orbit span:first-child {
  top: 40px;
  left: 85px;
}

.story-orbit span:nth-child(2) {
  right: 30px;
  bottom: 130px;
  background: var(--violet-500);
  box-shadow: 0 0 30px var(--violet-500);
}

.story-orbit span:nth-child(3) {
  bottom: 35px;
  left: 100px;
  background: var(--orange-400);
  box-shadow: 0 0 30px var(--orange-400);
}

.login-panel {
  display: flex;
  min-width: 0;
  height: 100%;
  min-height: 0;
  align-items: stretch;
  padding: max(22px, env(safe-area-inset-top)) clamp(22px, 5vw, 80px)
    max(22px, env(safe-area-inset-bottom));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.login-card {
  width: 100%;
  max-width: 440px;
  min-width: 0;
  margin: auto;
}

.login-card h2 {
  margin-bottom: 8px;
  font-size: clamp(27px, 3vw, 36px);
}

.login-card .field {
  margin-bottom: 10px;
}

.login-card .button-block {
  margin-top: 9px;
}

.mobile-brand {
  display: none;
  align-items: center;
  gap: 12px;
  font-family: var(--font-brand);
  margin-bottom: 22px;
}

.mobile-brand strong,
.mobile-brand small {
  display: block;
}

.mobile-brand strong {
  color: var(--ink-900);
  font-family: var(--font-brand);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
}

.mobile-brand small {
  margin-top: 4px;
  color: var(--ink-500);
  font: 800 13px var(--font-body);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.support-note {
  margin: 18px 0 0;
  color: var(--ink-500);
  font-size: 10.5px;
  text-align: center;
}

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(2px);
  pointer-events: none;
}

.ambient-one {
  top: -180px;
  right: -120px;
  width: 400px;
  height: 400px;
  background: rgba(58, 77, 179, 0.08);
}

.ambient-two {
  right: 18%;
  bottom: -160px;
  width: 360px;
  height: 360px;
  background: rgba(58, 77, 179, 0.06);
}

.switch input:disabled + span {
  opacity: 0.5;
  cursor: not-allowed;
}

.switch:has(input:disabled) {
  cursor: not-allowed;
}

.field .switch {
  margin: 0;
}

@media (pointer: coarse) {
  .switch::before {
    position: absolute;
    inset: -10px -4px;
    content: "";
  }
}

@media (forced-colors: active) {
  .switch span {
    border: 2px solid ButtonText;
  }

  .switch input:checked + span {
    background: Highlight;
  }
}
