:root {
  --bg: #ffffff;
  --panel-border: #ececf1;
  --title: #032d86;
  --text: #6c7da1;
  --link: #0a5fc8;
  --field-bg: #f6f8ff;
  --field-text: #6d7ea1;
  --button-disabled-bg: #f4f5ff;
  --button-disabled-text: #e1e4f2;
  --button-active-bg: #0a5fc8;
  --button-active-text: #ffffff;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  height: 100%;
  background: var(--bg);
  font-family: "Poppins", sans-serif;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

body {
  display: flex;
  justify-content: center;
  color: var(--text);
  overflow: hidden;
}

.page-shell {
  width: 100%;
  max-width: 430px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
  transition: opacity 0.25s ease, filter 0.25s ease;
}

.topbar,
.footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding-left: 24px;
  padding-right: 24px;
}

.topbar {
  justify-content: flex-start;
  min-height: 78px;
  padding-top: max(8px, env(safe-area-inset-top));
  padding-bottom: 10px;
  border-bottom: 1px solid var(--panel-border);
}

.brand-logo {
  width: auto;
  height: 38px;
  object-fit: contain;
}

.content {
  flex: 1;
  display: flex;
  padding: clamp(44px, 7.5dvh, 60px) 22px 20px;
}

.bill-screen,
.install-screen {
  width: 100%;
  height: 100%;
}

.bill-screen {
  display: flex;
  flex-direction: column;
}

.hero {
  max-width: 320px;
  margin: 0 auto;
  text-align: center;
}

.hero h1 {
  margin: 0 0 16px;
  color: var(--title);
  font-size: 25px;
  line-height: 1.16;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.hero p {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.85;
  font-weight: 500;
}

.hero a {
  color: var(--link);
  font-weight: 600;
}

.form-block {
  max-width: 100%;
  margin: clamp(44px, 9dvh, 70px) auto 0;
}

.form-block label {
  display: block;
  margin-bottom: 14px;
  color: var(--field-text);
  font-size: 15px;
  line-height: 1.35;
  font-weight: 500;
}

.form-block input {
  width: 100%;
  height: 52px;
  padding: 0 22px;
  border: 0;
  border-radius: 17px;
  background: var(--field-bg);
  color: var(--field-text);
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  outline: none;
}

.form-block input::placeholder {
  color: #7a8bb0;
  opacity: 1;
}

.footer {
  justify-content: flex-end;
  min-height: 78px;
  padding-top: 10px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--panel-border);
}

.proceed-button {
  width: 152px;
  height: 54px;
  border: 0;
  border-radius: 17px;
  background: var(--button-disabled-bg);
  color: var(--button-disabled-text);
  font-family: inherit;
  font-size: 18px;
  font-weight: 500;
  cursor: not-allowed;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.proceed-button.is-active {
  background: var(--button-active-bg);
  color: var(--button-active-text);
  cursor: pointer;
}

.install-screen {
  display: flex;
  align-items: center;
  justify-content: center;
}

.install-card {
  width: 100%;
  padding: 24px 18px 22px;
  border: 1px solid #e8eef9;
  border-radius: 22px;
  background: linear-gradient(180deg, #fbfdff 0%, #f3f8ff 100%);
  box-shadow: 0 18px 44px rgba(20, 76, 163, 0.08);
  text-align: center;
}

.install-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 14px;
  border-radius: 999px;
  background: #eaf3ff;
  color: #0b61c7;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.install-card h1 {
  margin: 16px 0 12px;
  color: var(--title);
  font-size: 24px;
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.install-card p {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.75;
  font-weight: 500;
}

.install-subtext {
  margin-top: 12px !important;
}

.install-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 54px;
  margin-top: 22px;
  padding: 14px 22px;
  border-radius: 17px;
  background: linear-gradient(180deg, #1172db 0%, #055cc6 100%);
  box-shadow: 0 14px 28px rgba(10, 95, 200, 0.22);
  color: #ffffff;
  font-size: 17px;
  font-weight: 600;
  text-decoration: none;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(244, 248, 255, 0.82);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.loader-ring {
  position: relative;
  width: 108px;
  height: 108px;
  animation: loader-spin 2.1s linear infinite;
}

.loader-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  transform:
    rotate(calc(var(--i) * 60deg))
    translateY(-35px)
    scale(var(--scale));
}

.loader-dot::before {
  content: "";
  display: block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--dot-color);
}

.loader-dot:nth-child(1) {
  --i: 0;
  --scale: 1.45;
  --dot-color: #0a66d0;
}

.loader-dot:nth-child(2) {
  --i: 1;
  --scale: 1.15;
  --dot-color: #1775dc;
}

.loader-dot:nth-child(3) {
  --i: 2;
  --scale: 0.5;
  --dot-color: #b6d8f8;
}

.loader-dot:nth-child(4) {
  --i: 3;
  --scale: 0.28;
  --dot-color: #d4e7fb;
}

.loader-dot:nth-child(5) {
  --i: 4;
  --scale: 0.65;
  --dot-color: #8abced;
}

.loader-dot:nth-child(6) {
  --i: 5;
  --scale: 1.58;
  --dot-color: #0b70db;
}

body.is-loading {
  overflow: hidden;
}

body.is-loading .page-shell {
  opacity: 0.34;
  filter: saturate(0.82);
  pointer-events: none;
}

body.is-loading .loading-overlay {
  opacity: 1;
  visibility: visible;
}

body.is-loading .proceed-button {
  background: var(--button-disabled-bg);
  color: var(--button-disabled-text);
}

@keyframes loader-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 360px) {
  .content {
    padding: 40px 16px 16px;
  }

  .hero h1 {
    font-size: 24px;
  }

  .hero p,
  .install-card p {
    font-size: 13px;
  }

  .form-block {
    margin-top: 40px;
  }

  .form-block input,
  .install-button,
  .proceed-button {
    height: 50px;
    font-size: 16px;
  }
}

@media (max-height: 780px) {
  .topbar {
    min-height: 72px;
    padding-top: max(6px, env(safe-area-inset-top));
    padding-bottom: 8px;
  }

  .brand-logo {
    height: 34px;
  }

  .content {
    padding: 34px 18px 14px;
  }

  .hero {
    max-width: 308px;
  }

  .hero h1 {
    margin-bottom: 12px;
    font-size: 23px;
  }

  .hero p {
    font-size: 13px;
    line-height: 1.72;
  }

  .form-block {
    margin-top: 34px;
  }

  .form-block label {
    margin-bottom: 10px;
    font-size: 14px;
  }

  .form-block input {
    height: 48px;
    font-size: 15px;
  }

  .footer {
    min-height: 70px;
    padding-top: 8px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .proceed-button {
    width: 146px;
    height: 50px;
    font-size: 17px;
  }

  .install-card {
    padding: 20px 16px 18px;
  }

  .install-card h1 {
    font-size: 22px;
  }

  .install-card p {
    font-size: 13px;
    line-height: 1.65;
  }
}

@media (max-height: 700px) {
  .content {
    padding-top: 24px;
  }

  .hero h1 {
    font-size: 21px;
  }

  .form-block {
    margin-top: 24px;
  }
}
