/* Вход «RUBYKZ · Агент по 1С». Композиция «Журнал 1С → сигнал»:
   строка журнала зажигается → импульс уходит по шине вниз → удар на общей
   линии пульса. Синее поле занимает целый регион только здесь; внутри
   продукта цвет работает точечно. */

@font-face { font-family: "Inter"; src: url("fonts/inter-400.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/inter-500.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/inter-600.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/inter-700.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --blue: #2C63B4;         /* акцент «Такси» — гиперссылка */
  --blue-deep: #1F4E93;
  --field: #F7E9B0;        /* кремовое поле — как панель разделов 1С */
  --field-deep: #EFD77E;
  --on-field: #2A2A2A;
  --on-field-2: rgb(42 42 42 / 0.62);
  --on-field-line: rgb(42 42 42 / 0.14);
  --bg: #F3F3F3;
  --text: #333333;
  --muted: #6B6B6B;
  --line: #DADADA;
  --danger: #B42318;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: #fff;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1, "cv11" 1;
}
::selection { background: var(--blue); color: #fff; }

.login { display: grid; grid-template-columns: minmax(0, 58fr) minmax(440px, 42fr); grid-template-rows: 100dvh; }
.panel { overflow-y: auto; }

/* ---------- Синее поле ---------- */
.field {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 40px 56px 0;
  color: var(--on-field);
  background: radial-gradient(120% 90% at 100% 100%, var(--field-deep) 0%, var(--field) 58%);
}
.field ::selection { background: var(--blue); color: #fff; }

.field-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: #F8C300; color: #1F1F1F; }

.register {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 36px 0 28px;
  padding-right: 44px; /* место под шину */
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 72px), transparent 100%);
  mask-image: linear-gradient(180deg, #000 calc(100% - 72px), transparent 100%);
}
.reg-head, .reg-row { display: grid; grid-template-columns: minmax(150px, 1.5fr) 1fr 1fr minmax(90px, 1fr); gap: 20px; align-items: center; }
.reg-head { padding: 0 14px 12px; font-size: 12px; color: var(--on-field-2); }
.reg-head span:last-child { text-align: right; }

.reg-row {
  position: relative;
  height: 50px;
  padding: 0 14px;
  border-top: 1px solid var(--on-field-line);
  border-radius: 10px;
  font-size: 14px;
  color: var(--on-field-2);
  white-space: nowrap;
  transition: background 380ms var(--ease), color 380ms var(--ease);
}
.reg-row > span { overflow: hidden; text-overflow: ellipsis; }
.reg-row .v { color: rgb(42 42 42 / 0.48); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; transition: color 380ms var(--ease); }
.reg-row .v.r { justify-self: end; }
.reg-row.is-live { background: rgb(255 255 255 / 0.6); color: var(--on-field); border-top-color: transparent; }
.reg-row.is-live + .reg-row { border-top-color: transparent; }
.reg-row.is-live .v { color: var(--blue); }

/* импульс, бегущий по нижней кромке строки к шине */
.reg-row::after {
  content: "";
  position: absolute;
  left: 0; right: -44px; bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--blue));
  transform-origin: left center;
  transform: scaleX(0);
  opacity: 0;
}
.reg-row.is-live::after { animation: blip 620ms var(--ease) both; }
@keyframes blip {
  0% { transform: scaleX(0); opacity: 1; }
  70% { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(1); opacity: 0; }
}

.bus { position: absolute; top: 108px; bottom: 58px; right: 56px; width: 2px; background: var(--on-field-line); border-radius: 2px; }
.bus-dot { position: absolute; left: -3px; top: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); opacity: 0; }

.field-title { position: relative; z-index: 1; padding-bottom: 132px; }
.title { margin: 0; font-size: clamp(40px, 4.4vw, 62px); line-height: 1.04; font-weight: 700; letter-spacing: -0.035em; }
.title .line { display: block; overflow: hidden; padding-bottom: 0.08em; }
.title .line > span { display: block; }
.title .line:first-child { color: var(--blue); font-weight: 500; }
.lede { margin: 18px 0 0; max-width: 34ch; font-size: 17px; line-height: 1.5; color: var(--on-field-2); }

.trace { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 132px; display: block; }

/* ---------- Форма ---------- */
.panel { display: grid; place-items: center; padding: 40px 32px; background: #fff; }
.form { width: 100%; max-width: 360px; }
.form h2 { margin: 0; font-size: 28px; line-height: 1.15; font-weight: 600; letter-spacing: -0.025em; }
.sub { margin: 8px 0 28px; color: var(--muted); font-size: 15px; }

.fld { display: block; margin-top: 16px; }
.fld > span:first-child { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--text); }
.fld input {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  border: 1px solid #D5DBE6;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  caret-color: var(--blue);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.fld input:hover { border-color: #B9C2D2; }
.fld input:focus-visible { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgb(44 99 180 / 0.16); }
.form.has-error .fld input { border-color: var(--danger); }
.form.has-error .fld input:focus-visible { box-shadow: 0 0 0 4px rgb(196 50 31 / 0.14); }

.pw { position: relative; display: block; }
.pw input { padding-right: 52px; }
.pw-toggle {
  position: absolute; right: 4px; top: 4px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer;
}
.pw-toggle:hover { color: var(--text); background: var(--bg); }
.pw-toggle:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }

.caps { margin: 10px 0 0; font-size: 13px; color: #8A5A00; }
.err { display: flex; gap: 8px; align-items: flex-start; margin: 14px 0 0; padding: 10px 12px; border-radius: 10px; background: #FDF0EE; color: var(--danger); font-size: 14px; line-height: 1.4; }
.err[hidden], .caps[hidden] { display: none; }
.err.shake { animation: shake 320ms ease both; }
@keyframes shake { 20% { transform: translateX(-5px); } 45% { transform: translateX(4px); } 70% { transform: translateX(-2px); } 100% { transform: none; } }

.submit {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 52px; margin-top: 24px;
  border: 0; border-radius: 12px;
  background: linear-gradient(#FFFFFF, #E6E6E6); color: #1F1F1F;
  border: 1px solid #6E8FC3; box-shadow: inset 0 0 0 1px #fff;
  font: inherit; font-size: 16px; font-weight: 600;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 120ms ease;
}
.submit:hover { background: linear-gradient(#FAFAFA, #D9D9D9); border-color: var(--blue); }
.submit:active { transform: scale(0.985); }
.submit:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.submit-icon { display: grid; transition: transform 220ms var(--ease); }
.submit:hover .submit-icon { transform: translateX(3px); }
.submit-wave { position: absolute; width: 64px; height: 16px; opacity: 0; fill: none; stroke: var(--blue); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 90; stroke-dashoffset: 90; }
.submit.is-busy { cursor: progress; }
.submit.is-busy .submit-label, .submit.is-busy .submit-icon { opacity: 0; }
.submit.is-busy .submit-wave { opacity: 1; animation: wave 1.1s linear infinite; }
@keyframes wave { to { stroke-dashoffset: -90; } }

.passkey-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 48px; margin-top: 12px; border: 1px solid #ADADAD; border-radius: 12px; background: linear-gradient(#FFFFFF, #E6E6E6); box-shadow: inset 0 0 0 1px #fff; color: var(--text); font: inherit; font-size: 15px; font-weight: 500; cursor: pointer; }
.passkey-btn:hover { border-color: var(--blue); } .passkey-btn:disabled { opacity: 0.6; cursor: progress; }
.note { display: flex; gap: 10px; margin: 28px 0 0; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13px; line-height: 1.5; color: var(--muted); }
.note svg { flex: none; margin-top: 1px; color: #8A94A6; }

/* ---------- Переход в дашборд ---------- */
.wipe { position: fixed; inset: 0; z-index: 10; background: #F3DE94; pointer-events: none; clip-path: inset(0 100% 0 0); }
.is-leaving .wipe { clip-path: inset(0 0 0 0); transition: clip-path 620ms var(--ease); }
.is-leaving .form { opacity: 0; transform: translateX(16px); transition: opacity 240ms ease, transform 240ms ease; }

/* ---------- Появление (только когда есть JS и движение разрешено) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js .title .line > span { animation: rise 900ms var(--ease) both; }
  .js .title .line:nth-child(2) > span { animation-delay: 90ms; }
  .js .lede, .js .field-brand { animation: fade-up 700ms var(--ease) 260ms both; }
  .js .reg-head, .js .reg-row { animation: fade-up 600ms var(--ease) both; animation-delay: calc(80ms + var(--i, 0) * 45ms); }
  .js .form > * { animation: fade-up 640ms var(--ease) both; animation-delay: calc(220ms + var(--i, 0) * 55ms); }
}
@keyframes rise { from { transform: translateY(105%); } to { transform: none; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .reg-row.is-live::after, .submit.is-busy .submit-wave { animation: none; }
  .is-leaving .wipe { transition: none; }
}

/* ---------- Телефон / узкий экран ---------- */
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; grid-template-rows: auto 1fr; min-height: 100dvh; }
  .panel { overflow: visible; }
  .field { padding: 20px 20px 0; min-height: 0; }
  .register { flex: none; height: 148px; margin: 18px 0 16px; padding-right: 28px; }
  .reg-head { display: none; }
  .reg-row { height: 44px; grid-template-columns: minmax(130px, 1.4fr) 1fr minmax(64px, 0.8fr); font-size: 13px; }
  .reg-row .v:nth-of-type(3) { display: none; }
  .reg-row::after { right: -28px; }
  .bus { top: 64px; bottom: 40px; right: 20px; }
  .field-title { padding-bottom: 96px; }
  .title { font-size: 38px; }
  .lede { font-size: 15px; margin-top: 12px; }
  .trace { height: 92px; }
  .panel { align-items: start; margin-top: -22px; padding: 30px 20px calc(28px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; position: relative; z-index: 2; }
  .form { max-width: 440px; }
  .form h2 { font-size: 24px; }
  .sub { margin-bottom: 20px; }
}
