/*
 * Общие стили сайта (стилистика fintablo.ru).
 * Стили конкретных страниц — в public/shared/css/pages/<отдел>/<slug>.css.
 * Классы с префиксом ft- принадлежат общим блокам (хидер, футер, формы, попапы) — на страницах их не переопределять.
 */

@font-face { font-family: 'LabGrotesque'; src: url('../fonts/LabGrotesque-300.woff') format('woff'); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: 'LabGrotesque'; src: url('../fonts/LabGrotesque-400.woff') format('woff'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'LabGrotesque'; src: url('../fonts/LabGrotesque-500.woff') format('woff'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'LabGrotesque'; src: url('../fonts/LabGrotesque-700.woff') format('woff'); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  --color-primary: #2951ca;
  --color-primary-dark: #1c3c9b;
  --color-link: #0260e8;
  --color-text: #091a4e;
  --color-muted: #404c72;
  --color-muted-light: #818ab0;
  --color-bg: #ffffff;
  --color-bg-alt: #f3f6ff;
  --color-border: #dde6ff;
  --color-footer: #091a4e;
  --color-footer-link: #c9c9c9;
  --color-error: #e53935;

  --font-base: 'LabGrotesque', Arial, sans-serif;
  --radius: 6px;
  --space-xs: 8px;
  --space-s: 16px;
  --space-m: 24px;
  --space-l: 48px;
  --space-xl: 80px;
  --container: 1200px;
  --header-h: 80px;
}

*, *::before, *::after { box-sizing: border-box; }

html.ft-lock { overflow: hidden; }

body {
  margin: 0;
  font-family: var(--font-base);
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-primary); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 var(--space-s); font-weight: 700; }
button { font: inherit; }
[hidden] { display: none !important; }

/* ---------- Утилиты для страниц ---------- */

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter, 20px);
}

.button,
.ft-form .ft-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-md, 8px);
  font-family: var(--font-base);
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s;
}

.button {
  min-height: 56px;
  padding: 14px 32px;
  background: var(--color-primary);
  color: #fff;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.2;
}
.button:hover { background: var(--color-primary-dark); }
.button--outline { background: #fff; border-color: var(--color-primary); color: var(--color-primary); }
.button--outline:hover { background: var(--color-primary-soft, #E4EAFB); color: var(--color-primary-dark); }

.ft-form .ft-btn { min-height: 48px; padding: 10px 24px; font-size: 16px; font-weight: 500; line-height: 1.2; }
.ft-form .ft-btn--primary { background: var(--color-primary); color: #fff; }
.ft-form .ft-btn--primary:hover { background: var(--color-primary-dark); }
.ft-form .ft-btn--xl { width: 100%; min-height: 56px; font-size: 17px; }

.sj-sheet + main > svg:first-child + section,
.sj-sheet + main > div:first-child > section:first-child { margin-top: -78px; border-top: 78px solid transparent; background-origin: border-box; }
@media (max-width: 1023.98px) {
  .sj-sheet + main > svg:first-child + section,
  .sj-sheet + main > div:first-child > section:first-child { margin-top: -70px; border-top-width: 70px; }
}

@keyframes ft-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Попапы ---------- */

/* Окно центрируется через margin: auto — так у высокого окна не обрезается верх, и оно прокручивается */
.ft-popup { position: fixed; inset: 0; z-index: 2000; display: flex; padding: 20px 0; overflow-y: auto; font-family: var(--font-base); }
.ft-popup__overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); animation: ft-fade-in .25s ease; }
.ft-popup__window { position: relative; margin: auto; animation: ft-popup-in .3s ease; }
@keyframes ft-popup-in { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
/* Контейнер формы регистрации — аналог .t868 .t-popup__container из regform.css */
.ft-popup__window--regform { width: 475px; max-width: 98%; background: #FEFEFE; border-radius: 15px; }
.ft-popup__window--regform .regform .close-modal { position: absolute; top: 20px; right: 20px; }
.ft-popup__window--side { width: 560px; max-width: 98%; padding: 35px 45px 45px; background: #fff; border-radius: 15px; }
.ft-popup__close {
  position: absolute;
  top: 22px; right: 22px;
  z-index: 1;
  display: flex;
  padding: 6px;
  border: 0;
  background: none;
  color: #8f8f8f;
  cursor: pointer;
}
.ft-popup__close:hover { color: var(--color-text); }
.ft-popup .ft-form--demo { padding: 0; box-shadow: none; }

@media (max-width: 450px) {
  .ft-popup { padding: 0; }
  .ft-popup__window--regform { width: 100%; max-width: 100%; min-height: 100%; margin: 0; border-radius: 0; }
}

@media (max-width: 640px) {
  .ft-popup { padding: 0; }
  .ft-popup__window--side { width: 100%; max-width: 100%; min-height: 100%; margin: 0; padding: 50px 20px 30px; border-radius: 0; }
}

/* ---------- Формы (регистрация, демо) ---------- */

.ft-form {
  max-width: 475px;
  margin: 0 auto;
  padding: 40px 50px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 40px rgba(9, 26, 78, .12);
  color: var(--color-text);
  font-family: var(--font-base);
  text-align: left;
}
.ft-form--demo { max-width: 560px; }
.ft-form__title { margin: 0; padding-right: 20px; font-size: 26px; font-weight: 700; line-height: 1.15; }
.ft-form--demo .ft-form__title { font-weight: 500; }
.ft-form__title--center { padding: 0 10px; text-align: center; }
.ft-form__subtitle { margin: 12px 0 0; color: var(--color-muted); font-size: 14px; line-height: 1.2; }
.ft-form--demo .ft-form__subtitle { font-size: 16px; line-height: 1.3; }
.ft-form__subtitle--center { text-align: center; }
.ft-form__form { display: flex; flex-direction: column; gap: 16px; margin-top: 24px; }
.ft-form--demo .ft-form__form { gap: 25px; }
.ft-form__hint { margin: -6px 0 4px; padding-left: 14px; color: var(--color-primary); font-size: 12px; line-height: 1.2; position: relative; }
.ft-form__hint::before {
  content: '';
  position: absolute;
  left: 0; top: 2px;
  width: 10px; height: 10px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Ccircle cx='5' cy='5' r='4.4' fill='none' stroke='%232951ca' stroke-width='1.1'/%3E%3Cpath d='M5 4.3v3M5 2.5v.9' stroke='%232951ca' stroke-width='1.1'/%3E%3C/svg%3E") no-repeat center / contain;
}
.ft-form__hint--gray { margin: -8px 0 0; padding-left: 0; color: var(--color-muted-light); font-size: 13px; }
.ft-form__hint--gray::before { content: none; }
.ft-form__note { margin: -4px 0 0; color: var(--color-muted-light); font-size: 11px; text-align: center; }
.ft-form__success { padding: 20px 0; }
.ft-form__success a { color: var(--color-primary); }
.ft-form__send-error { margin: -8px 0 0; color: var(--color-error); font-size: 14px; }
.ft-btn.is-loading { opacity: .7; pointer-events: none; }

.ft-field { display: flex; flex-direction: column; gap: 8px; }
.ft-field__label { color: var(--color-text); font-size: 13px; font-weight: 700; letter-spacing: .3px; }
.ft-field__req { color: var(--color-error); }
.ft-field__opt { color: var(--color-muted); font-weight: 400; }
.ft-field__input {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  border: 1px solid #cfd6ea;
  border-radius: var(--radius);
  background: #fff;
  color: var(--color-text);
  font: 400 17px/1.2 var(--font-base);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  appearance: none;
}
.ft-field__input::placeholder { color: #7d869f; }
.ft-field__input:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(41, 81, 202, .12); }
.ft-field__input--lg { height: 60px; padding: 0 20px; border-color: #c7cdda; border-radius: 5px; font-size: 16px; }
.ft-field__error { display: none; color: var(--color-error); font-size: 12px; }
.ft-field.is-error .ft-field__input { border-color: var(--color-error); }
.ft-field.is-error .ft-field__error { display: block; }

.ft-select { position: relative; }
.ft-select::after {
  content: '';
  position: absolute;
  right: 20px; top: 27px;
  border: 5px solid transparent;
  border-top: 6px solid var(--color-text);
  pointer-events: none;
}
.ft-select select { padding-right: 44px; cursor: pointer; }
.ft-select select:invalid { color: var(--color-text); }

.ft-phone { position: relative; display: block; }
.ft-phone__flag {
  position: absolute;
  left: 14px; top: 50%;
  width: 18px; height: 12px;
  margin-top: -6px;
  border: 1px solid #e3e3e3;
  background: linear-gradient(#fff 33.3%, #0039a6 33.3% 66.6%, #d52b1e 66.6%);
}
.ft-phone__flag::after {
  content: '';
  position: absolute;
  left: 23px; top: 3px;
  border: 3.5px solid transparent;
  border-top: 4px solid #666;
}
.ft-phone__input { padding-left: 48px; }
.ft-field__input--lg.ft-phone__input { padding-left: 56px; }
.ft-phone:has(.ft-field__input--lg) .ft-phone__flag { left: 20px; }

.ft-check { position: relative; display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.ft-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ft-check__box {
  flex: none;
  position: relative;
  width: 22px; height: 22px;
  border: 1.5px solid var(--color-primary);
  border-radius: 4px;
  background: #fff;
}
.ft-check input:checked + .ft-check__box::after {
  content: '';
  position: absolute;
  left: 6px; top: 2px;
  width: 6px; height: 11px;
  border: solid var(--color-primary);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.ft-check input:focus-visible + .ft-check__box { box-shadow: 0 0 0 3px rgba(41, 81, 202, .2); }
.ft-check.is-error .ft-check__box { border-color: var(--color-error); }
.ft-check__text { color: #6b7394; font-size: 13px; line-height: 1.35; }
.ft-check__text a { color: var(--color-primary); }
.ft-check--lg .ft-check__box { width: 20px; height: 20px; border: 2px solid var(--color-text); border-radius: 2px; }
.ft-check--lg input:checked + .ft-check__box::after { left: 5px; top: 1px; border-color: var(--color-text); }
.ft-check--lg .ft-check__text { color: var(--color-text); font-size: 16px; line-height: 1.15; }
.ft-check--lg .ft-check__text a { text-decoration: none; }
.ft-btn:disabled { opacity: .55; cursor: not-allowed; }

@media (max-width: 640px) {
  .ft-form { padding: 30px 20px; }
  .ft-form__title { font-size: 22px; }
}
