*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-base: #eef3f9;
  --text-dark: #2b2b2b;
  --text-muted: #8a8f98;
  --blue: #0066b3;
  --blue-btn: #0b57b9;
  --red: #e30613;
  --card-shadow: 0 4px 20px rgba(30, 40, 60, 0.08);
  --border: #d8dde5;
  --page-padding: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html,
body {
  height: 100%;
}

body {
  font-family: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text-dark);
  background-color: var(--bg-base);
  background-image: linear-gradient(180deg, #f5f9fd 0%, #e8eef6 100%);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-text-size-adjust: 100%;
}

.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--page-padding);
  padding-top: calc(var(--page-padding) + var(--safe-top));
  padding-bottom: calc(var(--page-padding) + var(--safe-bottom));
  transition: opacity 0.2s ease;
}

.page--splash.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.splash-card {
  width: 100%;
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--card-shadow);
  padding: 36px 24px 32px;
  text-align: center;
}

.logo {
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1;
}

.logo--center {
  font-size: 34px;
  margin-bottom: 24px;
}

.logo--left {
  font-size: 30px;
  margin-bottom: 28px;
  text-align: left;
}

.logo__gos {
  color: var(--blue);
}

.logo__uslugi {
  color: var(--red);
}

.splash-card__title {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-dark);
}

.splash-card__subtitle {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.loader {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.loader span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c5cad1;
  animation: bounce 1s infinite ease-in-out;
}

.loader span:nth-child(2) {
  animation-delay: 0.12s;
}

.loader span:nth-child(3) {
  animation-delay: 0.24s;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }

  40% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.login-screen.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.support-banner {
  position: fixed;
  top: calc(10px + var(--safe-top));
  left: var(--page-padding);
  right: var(--page-padding);
  width: auto;
  z-index: 20;
  background: #f2f6fb;
  border-radius: 10px;
  box-shadow: none;
  padding: 16px 14px 14px;
  text-align: center;
  color: var(--text-dark);
}

.support-banner__line {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
}

.support-banner__line--sub {
  margin-top: 2px;
}

.support-banner__phone {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.support-banner__phone:active {
  opacity: 0.75;
}

.login-screen__body {
  flex: 1;
  width: 100%;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(96px + var(--safe-top))
    var(--page-padding)
    calc(16px + var(--safe-bottom));
}

.login-card {
  width: 100%;
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--card-shadow);
  padding: 28px 20px 32px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__label {
  font-size: 14px;
  color: var(--text-muted);
}

.field__input {
  width: 100%;
  height: 56px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-dark);
  background: #fff;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.field__input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 102, 179, 0.12);
}

.field__input--typing {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 102, 179, 0.12);
}

.field__input--autofill {
  background: #eef4fc;
  border-color: #b8cfe8;
  color: #2b2b2b;
  font-size: 22px;
  letter-spacing: 0.18em;
}

.login-form__submit {
  margin-top: 2px;
  width: 100%;
  height: 54px;
  border: none;
  border-radius: 10px;
  background: var(--blue-btn);
  color: #fff;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.login-form__submit:active {
  background: #094a9e;
}

@media (min-width: 481px) {
  :root {
    --page-padding: 24px;
  }

  .splash-card {
    max-width: 520px;
    padding: 48px 40px 40px;
  }

  .logo--center {
    font-size: 42px;
    margin-bottom: 28px;
  }

  .splash-card__title {
    font-size: 22px;
  }

  .splash-card__subtitle {
    font-size: 16px;
  }

  .support-banner {
    max-width: 720px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: calc(100% - var(--page-padding) * 2);
    padding: 18px 24px 16px;
  }

  .support-banner__line {
    font-size: 15px;
  }

  .login-screen__body {
    padding-top: calc(104px + var(--safe-top));
  }

  .login-card {
    max-width: 420px;
    padding: 36px 40px 40px;
  }

  .logo--left {
    font-size: 36px;
    margin-bottom: 32px;
  }

  .login-form__submit:hover {
    background: #094a9e;
  }

  .support-banner__phone:hover {
    text-decoration: underline;
  }
}

.terminal-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding:
    calc(92px + var(--safe-top))
    var(--page-padding)
    calc(12px + var(--safe-bottom));
  background: transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.terminal-modal.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.terminal-modal__window {
  width: 100%;
  max-width: none;
  min-height: 220px;
  max-height: min(58dvh, calc(100dvh - 92px - var(--safe-top) - var(--safe-bottom) - 140px));
  height: auto;
  background: #000;
  border: none;
  border-radius: 6px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  padding: 14px 12px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.terminal {
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  color: #00ff00;
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal__line {
  opacity: 0;
  animation: terminal-line-in 0.15s ease forwards;
}

.terminal__line--alert {
  color: #ff3333;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.5;
}

.terminal__check {
  margin-right: 4px;
}

.terminal__check-icon {
  font-size: 18px;
  color: #00ff00;
  text-shadow:
    0 0 6px rgba(0, 255, 0, 0.85),
    0 0 12px rgba(0, 255, 0, 0.45);
}

@keyframes terminal-line-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.terminal-progress {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.4;
  color: #00ff00;
}

.terminal-progress__row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  opacity: 0;
  animation: terminal-line-in 0.2s ease forwards;
}

.terminal-progress__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.terminal-progress__label {
  flex: 1;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 0.01em;
}

.terminal-progress__track {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
  font-weight: 900;
  font-size: 15px;
}

.terminal-progress__bracket {
  color: #00cc00;
  font-weight: 900;
  font-size: 16px;
  line-height: 1;
  text-shadow: 0 0 4px rgba(0, 255, 0, 0.35);
}

.terminal-progress__meter {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(20, minmax(0, 1fr));
  gap: 2px;
  height: 14px;
  min-width: 0;
}

.terminal-progress__segment {
  background: #124012;
  border-radius: 1px;
  transition: background 0.08s ease, box-shadow 0.08s ease;
}

.terminal-progress__segment.is-filled {
  background: #00ff00;
  box-shadow:
    0 0 4px rgba(0, 255, 0, 0.8),
    inset 0 0 2px rgba(255, 255, 255, 0.25);
}

.terminal-progress__pct {
  min-width: 3.2em;
  text-align: right;
  font-weight: 900;
  font-size: 14px;
  color: #00ff00;
  text-shadow: 0 0 6px rgba(0, 255, 0, 0.45);
  transition: color 0.2s ease, text-shadow 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.terminal-progress__pct.is-complete {
  color: #7fff7f;
  border: 1px solid #5dff5d;
  border-radius: 4px;
  padding: 1px 6px;
  text-shadow:
    0 0 8px rgba(127, 255, 127, 0.9),
    0 0 16px rgba(0, 255, 0, 0.5);
  box-shadow:
    0 0 6px rgba(0, 255, 0, 0.35),
    inset 0 0 4px rgba(0, 255, 0, 0.15);
}

@media (max-width: 380px) {
  .terminal,
  .terminal-progress {
    font-size: 13px;
    line-height: 1.35;
  }

  .terminal-progress__label,
  .terminal-progress__pct {
    font-size: 13px;
  }

  .terminal-progress__track {
    font-size: 14px;
  }

  .terminal-progress__bracket {
    font-size: 15px;
  }

  .terminal__line--alert {
    font-size: 16px;
  }

  .terminal__check-icon {
    font-size: 17px;
  }

  .terminal-progress__row {
    gap: 5px;
  }

  .terminal-progress__top {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .terminal-progress__pct {
    text-align: left;
    min-width: auto;
  }
}

@media (min-width: 481px) {
  .terminal-modal {
    padding-top: calc(110px + var(--safe-top));
  }

  .terminal-modal__window {
    max-width: 780px;
    min-height: 300px;
    max-height: 65vh;
  }

  .terminal,
  .terminal-progress {
    font-size: 15px;
  }

  .terminal-progress__label,
  .terminal-progress__pct {
    font-size: 15px;
  }

  .terminal-progress__track {
    font-size: 16px;
  }

  .terminal-progress__bracket {
    font-size: 17px;
  }

  .terminal__line--alert {
    font-size: 19px;
  }

  .terminal__check-icon {
    font-size: 20px;
  }
}
