@import url("./fonts/fonts.css");

:root {
  --bg: #060B08;
  --surface: #0C130F;
  --surface-2: #111A15;
  --line: rgba(255, 255, 255, .09);
  --line-2: rgba(255, 255, 255, .16);
  --txt: #EEF5F0;
  --mut: #90A498;
  --ink: #04170C;
  --brand: #01E358;
  --accent: #75FFAA;
  --danger: #FF6B6B;
  --r-lg: 34px;
  --r-md: 26px;
  --r-sm: 18px;
}

* { box-sizing: border-box; }

/* `[hidden]` and a class selector have equal specificity, so the UA's
   `display: none` loses to rules like `.btn { display: inline-flex }` that
   come later -- hidden buttons would still render. */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--txt);
  font-family: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -.011em;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: -20vh -10vw auto;
  height: 70vh;
  background:
    radial-gradient(48% 60% at 22% 0%, rgba(1, 227, 88, .17), transparent 70%),
    radial-gradient(42% 55% at 78% 8%, rgba(117, 255, 170, .11), transparent 72%);
  filter: blur(20px);
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; }
p { margin: 0; }
h1, h2 { margin: 0; font-weight: 500; letter-spacing: -.035em; }

.shell {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 28px 16px 60px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.brand__link {
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
}

.brand__link img {
  display: block;
  height: 26px;
  width: auto;
  max-width: 55vw;
}

.brand__label {
  font-weight: 600;
  font-size: 14px;
  color: var(--mut);
  padding-left: 12px;
  border-left: 1px solid var(--line-2);
  line-height: 1.1;
}

/* ==========================================================================
   HERO — «наклейка» с обводкой, как на xata436.tech
   ========================================================================== */
.hero { margin: 6px 0 2px; }

.hero__title {
  font-size: clamp(26px, 7vw, 40px);
  line-height: 1.32;
  font-weight: 600;
  /* каждая строка получает свою «наклейку», поэтому нужен вертикальный зазор */
  margin-bottom: 14px;
}

.sticker {
  display: inline;
  padding: .12em .34em;
  border-radius: .42em;
  background: rgba(9, 15, 11, .74);
  border: 1.5px solid rgba(255, 255, 255, .17);
  box-shadow:
    0 0 0 5px rgba(6, 11, 8, .5),
    0 18px 44px rgba(0, 0, 0, .45);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.hero__text {
  margin-top: 18px;
  color: var(--mut);
  font-size: 15px;
  max-width: 34em;
}

.progress {
  display: flex;
  gap: 6px;
}

.progress i {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: var(--line-2);
  transition: background .2s ease;
}

.progress i.done { background: var(--brand); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 28px 26px;
}

.card h1 {
  font-size: 26px;
  margin-bottom: 6px;
}

.card .hint {
  color: var(--mut);
  font-size: 14px;
  margin-bottom: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  /* без этого intrinsic-ширина date-инпута распирает колонку наружу */
  min-width: 0;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--mut);
}

.field input,
.field textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 13px 16px;
  font: inherit;
  color: var(--txt);
  outline: none;
  transition: border-color .15s ease;
}

.field textarea { resize: vertical; min-height: 72px; }

/* Firefox/Safari дают input[type=date] собственную минимальную ширину под
   нативный пикер, из-за чего поле вылезало за карточку. */
.field input[type="date"] {
  min-width: 0;
  max-width: 100%;
  -webkit-appearance: none;
  appearance: none;
}

/* иначе в iOS Safari date-инпут схлопывается по высоте */
.field input[type="date"]::-webkit-date-and-time-value { text-align: left; }

.field input:focus,
.field textarea:focus { border-color: var(--brand); }

.field .error {
  font-size: 12.5px;
  color: var(--danger);
  min-height: 16px;
}

.choice-row {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.choice {
  flex: 1;
  padding: 16px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--line-2);
  background: var(--surface-2);
  text-align: center;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}

.choice.active {
  border-color: var(--brand);
  background: rgba(1, 227, 88, .1);
  color: var(--brand);
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  padding: 0 26px;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, opacity .15s ease;
}

.btn--solid {
  background: var(--brand);
  color: var(--ink);
  flex: 1;
}

.btn--solid:hover { background: var(--accent); }

.btn--solid:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.btn--ghost {
  background: transparent;
  color: var(--txt);
  border: 1.5px solid var(--line-2);
}

.btn--ghost:hover { border-color: var(--brand); color: var(--brand); }

.review-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.review-row:last-child { border-bottom: none; }
.review-row span:first-child { color: var(--mut); }
.review-row span:last-child { text-align: right; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  width: fit-content;
}

.status-pill.new { color: var(--mut); }
.status-pill.approved { color: var(--brand); border-color: rgba(1, 227, 88, .4); }
.status-pill.rejected { color: var(--danger); border-color: rgba(255, 107, 107, .4); }

/* ==========================================================================
   ЧЕК-ЛИСТ ЭТАПОВ ЗАЯВКИ
   ========================================================================== */
.steps {
  list-style: none;
  margin: 20px 0 4px;
  padding: 0;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 9px 0;
  color: var(--mut);
  font-size: 15px;
  position: relative;
}

/* соединительная линия между отметками */
.step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 31px;
  bottom: -9px;
  width: 2px;
  background: var(--line-2);
}

.step--done:not(:last-child)::before { background: var(--brand); }

.step__box {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 1.5px solid var(--line-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  margin-top: 1px;
  background: var(--surface-2);
  position: relative;
  z-index: 1;
}

.step--done { color: var(--txt); }

.step--done .step__box {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--ink);
  font-weight: 700;
}

.step--current { color: var(--txt); font-weight: 600; }

.step--current .step__box {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(1, 227, 88, .18);
}

.step__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 2px;
}

/* inline notice steps (rejected / clarification / office_visit), spliced
   right after the last completed regular step -- amber for "you need to do
   something", red for "this is where it stopped". */
.step--notice .step__box {
  font-size: 12px;
}

.step--warn {
  color: #ffd79a;
}

.step--warn .step__box {
  background: rgba(255, 190, 90, .12);
  border-color: #ffb454;
  color: #ffb454;
}

.step--warn .step__label {
  color: #ffd79a;
  font-weight: 600;
}

.step--danger {
  color: #ffb3b3;
}

.step--danger .step__box {
  background: rgba(220, 90, 90, .14);
  border-color: #ff6b6b;
  color: #ff6b6b;
}

.step--danger .step__label {
  color: #ffb3b3;
  font-weight: 600;
}

.step__reason {
  font-size: 13px;
  color: inherit;
  opacity: .85;
  white-space: pre-wrap;
}

.step__time {
  font-size: 12px;
  font-weight: 400;
  color: var(--mut);
}

.footer-note {
  color: var(--mut);
  font-size: 12.5px;
  text-align: center;
  margin-top: 10px;
}

/* ==========================================================================
   ДОГОВОР -- показывается на странице статуса начиная с этапа
   "Ожидание подписания договора"
   ========================================================================== */
.contract__title {
  font-size: 19px;
  font-weight: 700;
  margin: 0 0 4px;
}

.contract__h {
  font-weight: 700;
  font-size: 14px;
  margin: 18px 0 6px;
}

.contract__p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--txt);
  margin: 0;
}

.contract__parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--mut);
}

.contract__parties b {
  color: var(--txt);
}

@media (max-width: 560px) {
  .contract__parties {
    grid-template-columns: 1fr;
  }
}

.contract__sign {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.contract__sign input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  background: var(--surface-2);
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 13px 16px;
  font: inherit;
  color: var(--txt);
  outline: none;
}

.contract__sign input[type="text"]:focus {
  border-color: var(--brand);
}

.contract__sign input[type="checkbox"] {
  accent-color: var(--brand);
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

/* Стоящие отдельно уведомления под договором (не встроенные в цепочку
   этапов) -- статус подписи и требование явки в офис. */
.notice {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--r-sm);
  font-size: 14px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
}

.notice--signed {
  border-color: rgba(1, 227, 88, .4);
  background: rgba(1, 227, 88, .1);
  color: var(--brand);
}

.notice--warn {
  border-color: #ffb454;
  background: rgba(255, 190, 90, .1);
  color: #ffd79a;
}

.top-error {
  background: rgba(255, 107, 107, .1);
  border: 1px solid rgba(255, 107, 107, .3);
  color: var(--danger);
  border-radius: var(--r-sm);
  padding: 12px 16px;
  font-size: 14px;
}

.success-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(1, 227, 88, .12);
  border: 1.5px solid rgba(1, 227, 88, .4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: var(--brand);
  margin-bottom: 16px;
}

.token-box {
  background: var(--surface-2);
  border: 1px dashed var(--line-2);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  font-size: 13px;
  word-break: break-all;
  margin: 16px 0;
}

.token-box a { color: var(--brand); font-weight: 600; }

/* ==========================================================================
   УЧЁТНЫЕ ДАННЫЕ — заметный блок с логином/паролем, xataID-онбординг
   ========================================================================== */
.cred-card {
  position: relative;
  margin: 18px 0;
  padding: 24px 22px;
  border-radius: var(--r-md);
  background:
    linear-gradient(180deg, rgba(1, 227, 88, .13), rgba(1, 227, 88, .04) 60%),
    var(--surface-2);
  border: 1.5px solid rgba(1, 227, 88, .4);
  box-shadow: 0 0 0 5px rgba(1, 227, 88, .06), 0 20px 50px rgba(0, 0, 0, .35);
}

.cred-card__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  color: var(--txt);
  margin-bottom: 4px;
}

.cred-card__title .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px rgba(1, 227, 88, .18);
  flex: 0 0 auto;
}

.cred-card__hint {
  font-size: 13px;
  color: var(--mut);
  margin-bottom: 18px;
}

.cred-field {
  margin-bottom: 12px;
}

.cred-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--mut);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.cred-field__row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.cred-field__value {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 13px 16px;
  font: inherit;
  font-weight: 600;
  color: var(--txt);
  font-variant-ligatures: none;
  overflow-x: auto;
  white-space: nowrap;
  cursor: default;
  user-select: all;
}

/* Заблюренное поле пароля -- кликабельное, раскрывается через модалку
   предупреждения, а не отдельной кнопкой "получить пароль". */
.cred-field__value--masked {
  cursor: pointer;
  filter: blur(6px);
  user-select: none;
  transition: filter .15s ease;
}

.cred-field__value--masked:hover { filter: blur(5px); }

.copy-btn {
  flex: 0 0 auto;
  width: 46px;
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--txt);
  font-size: 17px;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}

.copy-btn:hover { border-color: var(--brand); color: var(--brand); }
.copy-btn.copied { border-color: var(--brand); background: rgba(1, 227, 88, .12); color: var(--brand); }
.copy-btn:disabled { opacity: .35; cursor: not-allowed; }

.cred-field__already-shown {
  font-size: 12.5px;
  color: var(--mut);
  padding: 13px 16px;
}

/* ---- модалка (предупреждение об одноразовом пароле) ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 4, .72);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 26px 24px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .5);
}

.modal__icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 190, 90, .14);
  border: 1.5px solid #ffb454;
  color: #ffb454;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 14px;
}

.modal h2 {
  font-size: 19px;
  margin-bottom: 10px;
}

.modal p {
  font-size: 14px;
  color: var(--mut);
  line-height: 1.55;
  margin-bottom: 8px;
}

.modal p b { color: var(--txt); }

.modal .actions { margin-top: 18px; }

/* ---- онбординг xataID ---- */
.onboarding {
  margin: 16px 0;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  overflow: hidden;
}

.onboarding__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  cursor: pointer;
  user-select: none;
}

.onboarding__head .emoji { font-size: 20px; flex: 0 0 auto; }

.onboarding__head b {
  flex: 1;
  font-size: 14.5px;
  font-weight: 700;
}

.onboarding__chev {
  color: var(--mut);
  transition: transform .2s ease;
  flex: 0 0 auto;
}

.onboarding.open .onboarding__chev { transform: rotate(180deg); }

.onboarding__body {
  padding: 0 18px 18px;
  font-size: 13.5px;
  color: var(--mut);
  line-height: 1.6;
}

.onboarding__body ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.onboarding__body li { margin-bottom: 6px; }
.onboarding__body b { color: var(--txt); }

/* ---- договор: свёрнутый вид после подписания ---- */
.contract-collapsed__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.contract-collapsed__chev {
  color: var(--mut);
  transition: transform .2s ease;
  flex: 0 0 auto;
}

.contract-collapsed.open .contract-collapsed__chev { transform: rotate(180deg); }

.contract-collapsed__body {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

@media (max-width: 480px) {
  .card { padding: 22px 18px; border-radius: var(--r-md); }
  .choice-row { flex-direction: column; }
  .cred-card { padding: 20px 16px; }
}

/* Печать договора в PDF -- только карточка договора, без остального
   интерфейса (шапка, чек-лист этапов, кнопки). */
@media print {
  html, body { background: #fff !important; }
  body::before { display: none; }
  .brand, #content, .no-print { display: none !important; }
  .shell { max-width: none; padding: 0; gap: 0; }
  #contract-card {
    display: block !important;
    background: #fff !important;
    border: none;
    border-radius: 0;
    padding: 0;
    /* Тёмная тема экрана не годится для распечатки/PDF -- переопределяем
       переменные темы только в области карточки договора на светлые. */
    --bg: #fff;
    --surface: #fff;
    --surface-2: #f4f4f4;
    --txt: #000;
    --mut: #444;
    --line: #ccc;
    --line-2: #ccc;
    --brand: #000;
  }
  .contract-collapsed__chev { display: none !important; }
}


/* ---------- собственноручная подпись при подписании договора ---------- */
.sigpad {
  position: relative;
  height: 170px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, .18);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
  overflow: hidden;
  touch-action: none;
}
.sigpad canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
  z-index: 2;
}
.sigpad__line {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 42px;
  border-bottom: 1.5px dashed #c5cbd6;
  z-index: 1;
}
.sigpad__hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 16px;
  text-align: center;
  font-size: 12px;
  color: #8a93a3;
  z-index: 1;
  pointer-events: none;
  transition: opacity .15s ease;
}
.sigpad--inked .sigpad__hint { opacity: 0; }
.sigpad__clear {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  border: 1px solid #d6dbe4;
  background: #fff;
  color: #4a5568;
  font: inherit;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.sigpad__clear:hover { background: #f2f4f8; }
.contract__signature {
  display: inline-block;
  margin: 6px 0 2px;
  padding: 6px 10px;
  border-radius: 10px;
  background: #fff;
}
.contract__signature img {
  display: block;
  max-width: 200px;
  max-height: 90px;
}
.contract__signature--mini { margin: 10px 0 0; }
.contract__signature--mini img { max-width: 150px; max-height: 60px; }
@media print {
  .contract__signature { padding: 0; background: none; }
}

/* Окно подписания выше остальных модалок (поле подписи): не даём ему
   вылезать за экран -- ограничиваем высоту экраном и прокручиваем внутри. */
.modal-overlay { overflow-y: auto; }
.modal {
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.modal--sign { max-width: 520px; }
.sigpad { width: 100%; box-sizing: border-box; }
.contract__signature { max-width: 100%; box-sizing: border-box; }
.contract__signature img { max-width: 100%; }
@media (max-height: 700px) {
  .sigpad { height: 130px; }
  .modal { padding: 18px 18px; }
}
@media (max-width: 480px) {
  .modal-overlay { padding: 10px; }
  .modal { padding: 20px 16px; }
}

/* Квадратное поле подписи (по просьбе владельца). Ширина ограничена, чтобы
   квадрат вместе с остальным окном помещался в экран. */
.sigpad {
  width: min(100%, 300px);
  height: auto;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
}
@media (max-height: 700px) {
  .sigpad { width: min(100%, 220px); height: auto; }
}
