:root {
  color-scheme: light;
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-soft: #eef7ff;
  --ink: #08152c;
  --muted: #657289;
  --line: #d7e1ec;
  --line-strong: #c5d2df;
  --brand: #0a8dff;
  --brand-strong: #0876df;
  --brand-cyan: #08aee4;
  --bad: #d94a4a;
  --good: #1f9d5b;
  --shadow: 0 24px 70px rgba(20, 35, 64, 0.14);
  font-family: Arial, Tahoma, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

body,
button,
input,
select {
  font: inherit;
}

button,
input,
select {
  border-radius: 8px;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

[data-visible-on] {
  display: none;
}

[data-state="CodeSent"] [data-visible-on*="CodeSent"],
[data-state="CodeError"] [data-visible-on*="CodeError"],
[data-state="SendingCode"] [data-visible-on*="SendingCode"],
[data-state="ConfirmingCode"] [data-visible-on*="ConfirmingCode"] {
  display: grid;
}

.always-visible {
  display: grid;
}

[data-state="Idle"] .info-callout,
[data-state="Idle"] .code-block,
[data-state="Idle"] .code-controls,
[data-state="CodeError"] .info-callout,
[data-state="CodeError"] .code-block,
[data-state="CodeError"] .code-controls,
[data-state="SendingCode"] .field-block,
[data-state="SendingCode"] .info-callout,
[data-state="SendingCode"] .phone-controls .primary-action,
[data-state="SendingCode"] .code-block,
[data-state="SendingCode"] .code-controls,
[data-state="CodeSent"] .field-block,
[data-state="CodeSent"] .info-callout,
[data-state="CodeSent"] .phone-controls .primary-action {
  display: none;
}

.login-shell {
  min-height: 100vh;
  padding: 12px;
  display: grid;
  place-items: center;
  background: var(--bg);
}

.login-frame {
  width: min(100%, 1500px);
  height: min(980px, calc(100vh - 24px));
  min-height: 0;
  max-height: calc(100vh - 24px);
  display: grid;
  direction: ltr;
  grid-template-columns: minmax(460px, 0.46fr) minmax(520px, 0.54fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-panel {
  min-width: 0;
  padding: clamp(24px, 3.8vh, 40px) clamp(38px, 4.2vw, 58px);
  display: grid;
  align-content: center;
  gap: clamp(14px, 1.8vh, 18px);
  direction: inherit;
  background: var(--surface);
  overflow: hidden;
}

[dir="rtl"] .login-panel {
  direction: rtl;
}

.login-brand {
  display: grid;
  gap: clamp(12px, 2vh, 20px);
}

.brand-logo {
  width: clamp(152px, 10vw, 180px);
  height: auto;
}

[dir="rtl"] .brand-logo {
  justify-self: start;
}

h1,
p {
  margin: 0;
}

h1 {
  font-size: clamp(32px, 2.6vw, 40px);
  line-height: 1.16;
  letter-spacing: 0;
}

.login-brand p {
  margin-block-start: 4px;
  color: #4c5c76;
  font-size: 20px;
  line-height: 1.35;
}

.login-form {
  width: min(100%, 542px);
  display: grid;
  gap: 12px;
}

.field-block,
.code-block {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
}

.field-shell {
  min-height: 54px;
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: white;
  padding: 0 20px;
}

[dir="rtl"] .field-shell {
  direction: ltr;
}

.field-shell i {
  color: #8392aa;
  font-size: 24px;
  text-align: center;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--ink);
  outline: none;
}

input[type="tel"] {
  direction: ltr;
  text-align: left;
  font-size: 20px;
}

input::placeholder {
  color: #78869b;
}

select:focus,
.code-cell:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(10, 141, 255, 0.18);
  outline-offset: 2px;
}

.info-callout {
  min-height: 50px;
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border: 1px solid #cce5fb;
  border-radius: 8px;
  background: var(--surface-soft);
  color: #3d5070;
}

.info-callout i {
  grid-column: 1;
  grid-row: 1;
  color: var(--brand);
  font-size: 24px;
}

.info-callout strong {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 500;
}

[dir="rtl"] .info-callout {
  grid-template-columns: 1fr 32px;
}

[dir="rtl"] .info-callout i {
  grid-column: 2;
}

[dir="rtl"] .info-callout strong {
  grid-column: 1;
  text-align: right;
}

.code-hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.code-grid {
  display: grid;
  direction: ltr;
  grid-template-columns: repeat(5, 56px);
  justify-content: center;
  gap: clamp(12px, 1.3vw, 18px);
}

.code-cell {
  width: 56px;
  aspect-ratio: 1;
  border: 1px solid var(--line-strong);
  background: white;
  color: #40506a;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 700;
}

.code-lock {
  color: #536986;
  font-size: 20px;
}

.code-grid.active .code-cell {
  border-color: #b7d6f1;
  box-shadow: 0 8px 18px rgba(10, 141, 255, 0.08);
}

.text-action {
  justify-self: start;
  min-height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand);
  font-size: 16px;
}

[dir="rtl"] .text-action {
  justify-self: end;
}

.state-message {
  min-height: 48px;
  align-items: center;
  grid-template-columns: max-content 1fr;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  background: #f8fbff;
  color: var(--ink);
}

[dir="rtl"] .state-message {
  direction: rtl;
  grid-template-columns: max-content minmax(0, 1fr);
}

.state-message strong {
  grid-column: 2;
  grid-row: 1;
  font-size: 13px;
  text-align: start;
}

[dir="rtl"] .state-message strong {
  text-align: right;
}

.state-message.success {
  border-color: rgba(31, 157, 91, 0.28);
  background: #f0fbf5;
  color: #146c42;
}

.state-message.error {
  border-color: rgba(217, 74, 74, 0.30);
  background: #fff5f5;
  color: #9f2f2f;
}

.state-message.error::before,
.state-message.success::before {
  grid-column: 1;
  grid-row: 1;
  width: 10px;
  height: 10px;
  content: "";
  border-radius: 999px;
  background: currentColor;
}

.spinner {
  grid-column: 1;
  grid-row: 1;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(10, 141, 255, 0.25);
  border-top-color: var(--brand);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

.controls {
  display: grid;
  gap: 12px;
}

.primary-action,
.secondary-action {
  width: 100%;
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border: 1px solid var(--brand);
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}

.primary-action {
  background: var(--brand);
  color: white;
  box-shadow: 0 12px 24px rgba(10, 141, 255, 0.22);
}

.primary-action:not(:disabled):hover {
  background: var(--brand-strong);
}

.primary-action:disabled {
  opacity: 0.72;
}

.secondary-action {
  background: #eef7ff;
  color: #7a8ca5;
  border-color: #d2e6f8;
}

.secondary-action:not(:disabled) {
  background: white;
  color: var(--brand);
}

.separator {
  display: none;
  grid-template-columns: 1fr max-content 1fr;
  gap: 12px;
  align-items: center;
  color: #6c7b90;
  font-size: 16px;
}

.separator::before,
.separator::after {
  content: "";
  height: 1px;
  background: var(--line);
}

.login-footer {
  width: min(100%, 542px);
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 22px;
  color: #53647d;
}

[dir="rtl"] .login-footer {
  flex-direction: row-reverse;
}

.version-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  font-size: 15px;
}

.version-badge img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.locale-control {
  width: 180px;
  display: grid;
  gap: 8px;
  color: #53647d;
  font-size: 14px;
  font-weight: 700;
}

.locale-select-shell {
  position: relative;
  display: block;
}

.locale-flag {
  position: absolute;
  inset-inline-start: 12px;
  top: 50%;
  width: 28px;
  height: 20px;
  transform: translateY(-50%);
  pointer-events: none;
  border: 1px solid rgba(8, 21, 44, 0.16);
  border-radius: 4px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  box-shadow: 0 1px 2px rgba(8, 21, 44, 0.08);
}

.flag-il {
  background-image: url("/images/flags/il.svg");
}

.flag-us {
  background-image: url("/images/flags/us.svg");
}

.locale-control select {
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: white;
  padding-block: 0;
  padding-inline: 12px;
  padding-inline-start: 52px;
  font-size: 16px;
  font-weight: 700;
}

.login-visual {
  min-width: 0;
  min-height: 0;
  background: #eef8ff;
}

.login-visual img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1080px) {
  .login-frame {
    grid-template-columns: 1fr;
  }

  .login-visual {
    display: none;
  }

  .login-panel {
    justify-items: stretch;
  }
}

@media (max-width: 640px) {
  .login-shell {
    padding: 0;
  }

  .login-frame {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .login-panel {
    padding: 30px 20px;
  }

  .brand-logo {
    width: 160px;
  }

  h1 {
    font-size: 30px;
  }

  .login-brand p {
    font-size: 18px;
  }

  .code-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
  }

  .code-cell {
    width: 100%;
  }

  .login-footer {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .locale-control {
    width: 100%;
  }
}
