@font-face { font-family: Onest; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/Onest-Regular.ttf") format("truetype"); }
@font-face { font-family: Onest; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/Onest-Medium.ttf") format("truetype"); }
:root {
  color-scheme: light;
  --canvas: #FFFFFF; --surface-subtle: #F7F9FE; --surface-selected: #EDF2FF;
  --text-strong: #0D1424; --text-default: #273146; --text-secondary: #626B7E;
  --border-default: #E1E6EF; --brand-primary: #2457F5; --brand-strong: #1746DD;
  --on-brand: #FFFFFF; --success: #277752; --danger: #C43845;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px;
  --s8: 32px; --s10: 40px; --s12: 48px; --s16: 64px;
  --cycle: 33s;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--canvas); color: var(--text-default);
  font: 400 16px/24px Onest, Arial, sans-serif; display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
.skip { position: fixed; top: 8px; left: 8px; padding: 12px; background: var(--canvas); transform: translateY(-200%); z-index: 4; }
.skip:focus { transform: none; }
:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 4px; }

/* ── Шапка ─────────────────────────────────────────────── */
header { flex: 0 0 auto; border-bottom: 1px solid var(--border-default); }
.bar { max-width: 1320px; margin-inline: auto; height: 64px; padding-inline: var(--s10);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4); }
.brand { display: flex; align-items: center; gap: var(--s3); color: var(--text-strong);
  font-size: 18px; font-weight: 500; letter-spacing: -.03em; }
.brand img { display: block; width: 32px; height: 32px; }
.bar nav { display: flex; align-items: center; gap: var(--s6); }
.ghost { display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  padding-inline: var(--s2); color: var(--text-default); font-size: 14px; font-weight: 500; }
.ghost:hover { color: var(--brand-primary); }
.btn { display: inline-flex; align-items: center; justify-content: center; height: 40px;
  padding-inline: var(--s5); border: 0; border-radius: 8px; background: var(--brand-primary);
  color: var(--on-brand); font: 500 14px/20px Onest, Arial, sans-serif; cursor: default;
  transition: background 140ms; }
.btn:hover { background: var(--brand-strong); }
.btn-lg { height: 48px; padding-inline: var(--s6); }
.btn-outline { background: var(--canvas); color: var(--text-default); border: 1px solid var(--text-secondary); }
.btn-outline:hover { background: var(--surface-subtle); }

/* ── Первый экран ──────────────────────────────────────── */
main { flex: 1 1 auto; display: flex; align-items: center; }
.hero { width: 100%; max-width: 1320px; margin-inline: auto; padding: var(--s12) var(--s10);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 516px); gap: var(--s16); align-items: center; }
.hero-text { min-width: 0; }
h1 { margin: 0 0 var(--s6); color: var(--text-strong); font-size: 48px; line-height: 50px;
  font-weight: 500; letter-spacing: -.035em; max-width: 12ch; }
.lede { margin: 0 0 var(--s10); max-width: 44ch; }
.cta { display: flex; align-items: center; gap: var(--s6); flex-wrap: wrap; }
.cta .link { color: var(--brand-primary); font-size: 14px; font-weight: 500;
  min-height: 44px; display: inline-flex; align-items: center; }
.cta-mobile { display: none; }

/* ── Окно чата ─────────────────────────────────────────── */
.chat-wrap { min-width: 0; }
.chat { border: 1px solid var(--border-default); border-radius: 20px; background: var(--canvas);
  overflow: hidden; box-shadow: 0 1px 2px rgba(13, 20, 36, .04), 0 16px 40px rgba(13, 20, 36, .07); }
.viewport { position: relative; height: 396px; overflow: hidden; padding: 0 var(--s5);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 28px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 28px); }
.feed { position: absolute; inset: 0 var(--s5) var(--s4); display: flex; flex-direction: column;
  justify-content: flex-end; animation: cycle var(--cycle) linear infinite; }
@keyframes cycle { 0%, 93.9% { opacity: 1; } 95.6%, 99% { opacity: 0; } 100% { opacity: 1; } }

/* Общий контейнер сообщения: растёт от нулевой высоты, как в живой ленте */
.msg { display: grid; grid-template-rows: 0fr; opacity: 0;
  animation-duration: var(--cycle); animation-timing-function: cubic-bezier(.22,.6,.3,1);
  animation-iteration-count: infinite; }
.msg > div { overflow: hidden; min-width: 0; }
.msg + .msg { margin-top: 0; }
.pad { padding-top: var(--s4); }

/* Вопрос руководителя */
.ask { display: flex; justify-content: flex-end; padding-top: var(--s5); }
.ask p { margin: 0; max-width: 80%; padding: var(--s3) var(--s4); border-radius: 16px 16px 4px 16px;
  background: var(--surface-selected); color: var(--text-strong); font-size: 15px; line-height: 22px; }

/* Ход рассуждения агента */
.think { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: var(--s3); padding-top: var(--s4); }
.think-in { min-width: 0; padding-top: 3px; }
.th-head { display: flex; align-items: center; gap: var(--s2);
  color: var(--text-default); font-size: 14px; font-weight: 500; }
.spin { width: 13px; height: 13px; border: 2px solid var(--border-default);
  border-top-color: var(--brand-primary); border-radius: 50%; animation: spin 720ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.steps { margin: var(--s2) 0 0; padding: 0 0 0 var(--s3); border-left: 1px solid var(--border-default); }
.st { margin: 0; padding: 3px 0; color: var(--text-secondary); font-size: 13px; line-height: 19px;
  opacity: 0; animation: stepIn var(--cycle) ease infinite backwards; }
@keyframes stepIn { 0% { opacity: 0; transform: translateY(3px); } 2% { opacity: 1; transform: none; } 100% { opacity: 1; transform: none; } }
.d1 { animation-delay: 1.9s; } .d2 { animation-delay: 2.9s; } .d3 { animation-delay: 3.9s; }
.d4 { animation-delay: 11.6s; } .d5 { animation-delay: 12.6s; } .d6 { animation-delay: 13.6s; }
.d7 { animation-delay: 21.6s; } .d8 { animation-delay: 22.6s; } .d9 { animation-delay: 23.6s; }

/* Свёрнутый след рассуждения */
.thought { display: flex; align-items: center; gap: var(--s2); margin: 0 0 0 var(--s10);
  padding-top: var(--s4); color: var(--text-secondary); font-size: 12px; line-height: 16px; }
.thought svg { flex: 0 0 12px; }

/* Ответ */
.reply { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: var(--s3); padding-top: var(--s4); }
.av { width: 28px; height: 28px; border-radius: 8px; display: block; }
.answer { min-width: 0; }
.answer > p { margin: 0 0 var(--s4); font-size: 15px; line-height: 23px; color: var(--text-default); }
.answer > p:last-child { margin-bottom: 0; }

.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2);
  margin: 0 0 var(--s4); padding: var(--s4) 0; border-block: 1px solid var(--border-default); }
.kpi { min-width: 0; }
.kpi b { display: block; color: var(--text-strong); font-size: 22px; line-height: 26px;
  font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi span { display: block; margin-top: 2px; color: var(--text-secondary); font-size: 12px; line-height: 16px; }
.kpi em, .mgr em { font-style: normal; font-size: 12px; font-weight: 500; }
.down { color: var(--danger); } .up { color: var(--success); }
.mgrs { margin: 0 0 var(--s4); padding: var(--s2) 0 0; border-top: 1px solid var(--border-default); }
.mgr { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s4);
  padding: var(--s2) 0; border-bottom: 1px solid var(--border-default); font-size: 14px; }
.mgr:last-child { border-bottom: 0; }
.mgr b { color: var(--text-strong); font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.evidence { display: inline-flex; align-items: center; gap: var(--s1);
  color: var(--brand-primary); font-size: 14px; font-weight: 500; }

/* Такты ленты: 33 с, три обмена */
.m-q1 { animation-name: g-q1; } .m-th1 { animation-name: g-th1; }
.m-td1 { animation-name: g-td1; } .m-a1 { animation-name: g-a1; }
.m-q2 { animation-name: g-q2; } .m-th2 { animation-name: g-th2; }
.m-td2 { animation-name: g-td2; } .m-a2 { animation-name: g-a2; }
.m-q3 { animation-name: g-q3; } .m-th3 { animation-name: g-th3; }
.m-td3 { animation-name: g-td3; } .m-a3 { animation-name: g-a3; }

@keyframes g-q1 { 0%, .9% { grid-template-rows: 0fr; opacity: 0; } 3%, 96.5% { grid-template-rows: 1fr; opacity: 1; } 96.6%, 100% { grid-template-rows: 0fr; opacity: 0; } }
@keyframes g-th1 { 0%, 4.2% { grid-template-rows: 0fr; opacity: 0; } 6%, 13.9% { grid-template-rows: 1fr; opacity: 1; } 14.9%, 100% { grid-template-rows: 0fr; opacity: 0; } }
@keyframes g-td1 { 0%, 14.8% { grid-template-rows: 0fr; opacity: 0; } 15.8%, 96.5% { grid-template-rows: 1fr; opacity: 1; } 96.6%, 100% { grid-template-rows: 0fr; opacity: 0; } }
@keyframes g-a1 { 0%, 15.8% { grid-template-rows: 0fr; opacity: 0; } 18.2%, 96.5% { grid-template-rows: 1fr; opacity: 1; } 96.6%, 100% { grid-template-rows: 0fr; opacity: 0; } }

@keyframes g-q2 { 0%, 30.3% { grid-template-rows: 0fr; opacity: 0; } 32.4%, 96.5% { grid-template-rows: 1fr; opacity: 1; } 96.6%, 100% { grid-template-rows: 0fr; opacity: 0; } }
@keyframes g-th2 { 0%, 33.6% { grid-template-rows: 0fr; opacity: 0; } 35.5%, 45.5% { grid-template-rows: 1fr; opacity: 1; } 46.4%, 100% { grid-template-rows: 0fr; opacity: 0; } }
@keyframes g-td2 { 0%, 46.3% { grid-template-rows: 0fr; opacity: 0; } 47.3%, 96.5% { grid-template-rows: 1fr; opacity: 1; } 96.6%, 100% { grid-template-rows: 0fr; opacity: 0; } }
@keyframes g-a2 { 0%, 47.3% { grid-template-rows: 0fr; opacity: 0; } 49.7%, 96.5% { grid-template-rows: 1fr; opacity: 1; } 96.6%, 100% { grid-template-rows: 0fr; opacity: 0; } }

@keyframes g-q3 { 0%, 60.6% { grid-template-rows: 0fr; opacity: 0; } 62.7%, 96.5% { grid-template-rows: 1fr; opacity: 1; } 96.6%, 100% { grid-template-rows: 0fr; opacity: 0; } }
@keyframes g-th3 { 0%, 63.9% { grid-template-rows: 0fr; opacity: 0; } 65.8%, 75.8% { grid-template-rows: 1fr; opacity: 1; } 76.7%, 100% { grid-template-rows: 0fr; opacity: 0; } }
@keyframes g-td3 { 0%, 76.6% { grid-template-rows: 0fr; opacity: 0; } 77.6%, 96.5% { grid-template-rows: 1fr; opacity: 1; } 96.6%, 100% { grid-template-rows: 0fr; opacity: 0; } }
@keyframes g-a3 { 0%, 77.6% { grid-template-rows: 0fr; opacity: 0; } 80%, 96.5% { grid-template-rows: 1fr; opacity: 1; } 96.6%, 100% { grid-template-rows: 0fr; opacity: 0; } }

.chat-input { display: flex; align-items: center; gap: var(--s3);
  margin: 0 var(--s5) var(--s5); padding: var(--s2) var(--s2) var(--s2) var(--s4);
  border: 1px solid var(--border-default); border-radius: 999px; }
.chat-input .placeholder { flex: 1 1 auto; min-width: 0; color: var(--text-secondary);
  font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.caret { flex: 0 0 1px; width: 1px; height: 18px; background: var(--brand-primary);
  animation: caret 1.05s steps(2, start) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.send { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%; background: var(--brand-primary);
  display: grid; place-items: center; }
.send svg { display: block; }
.chat-note { margin: var(--s3) 0 0; padding-left: var(--s1);
  color: var(--text-secondary); font-size: 12px; line-height: 16px; }

/* ── Подвал ────────────────────────────────────────────── */
footer { flex: 0 0 auto; border-top: 1px solid var(--border-default); }
.foot { max-width: 1320px; margin-inline: auto; padding: var(--s5) var(--s10);
  display: flex; justify-content: space-between; gap: var(--s4); flex-wrap: wrap;
  color: var(--text-secondary); font-size: 12px; line-height: 16px; }
.foot span { display: inline-flex; gap: var(--s4); }

@media (max-width: 1160px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: var(--s12); padding: var(--s12) var(--s8); }
  h1 { font-size: 40px; line-height: 44px; max-width: 16ch; }
  .bar, .foot { padding-inline: var(--s8); }
}

/* ── Мобильный: чат вверх, действия вниз ───────────────── */
@media (max-width: 680px) {
  body { padding-bottom: 88px; }
  main { align-items: flex-start; }
  .bar, .foot { padding-inline: var(--s6); }
  .bar { height: 56px; }
  .bar nav { display: none; }
  .hero { display: flex; flex-direction: column; align-items: stretch;
    padding: var(--s8) var(--s6) var(--s10); gap: var(--s8); }
  .hero-text { display: contents; }
  h1 { order: 1; font-size: 34px; line-height: 38px; max-width: none; margin: 0; }
  .chat-wrap { order: 2; }
  .lede { order: 3; margin: 0; max-width: none; }
  .cta { display: none; }
  .cta-mobile { display: grid; position: fixed; z-index: 3; inset: auto 0 0 0;
    grid-template-columns: 1fr; gap: var(--s3);
    padding: var(--s3) var(--s6) calc(var(--s3) + env(safe-area-inset-bottom));
    background: var(--canvas); border-top: 1px solid var(--border-default); }
  .cta-mobile .btn { height: 48px; width: 100%; }
  .chat { border-radius: 16px; }
  .viewport { height: 464px; padding-inline: var(--s4); }
  .feed { inset: 0 var(--s4) var(--s3); }
  .kpis { grid-template-columns: minmax(0, 1fr); gap: var(--s3); }
  .kpi b { font-size: 20px; line-height: 24px; }
  .chat-input { margin: 0 var(--s4) var(--s4); }
}

@media (prefers-reduced-motion: reduce) {
  .feed, .msg, .st, .caret, .spin { animation: none; }
  .feed { position: static; }
  .msg { grid-template-rows: 1fr; opacity: 1; }
  .m-th1, .m-th2, .m-th3, .m-q2, .m-td2, .m-a2, .m-q3, .m-td3, .m-a3 { display: none; }
  .st { opacity: 1; }
  .viewport { height: auto; padding-bottom: var(--s4); -webkit-mask-image: none; mask-image: none; }
}
@media (forced-colors: active) {
  .chat { box-shadow: none; }
  .send { border: 1px solid ButtonText; }
}

/* P-02: local design specimen. P-00 source remains unchanged. */
#home { min-height: 100%; display: flex; flex-direction: column; }
a[data-registration] { cursor: pointer; }
.registration { --overlay: rgba(13,20,36,.44); width: 448px; max-width: calc(100% - 48px); max-height: calc(100dvh - 48px); padding: 32px; border: 0; border-radius: 12px; color: var(--text-default); background: var(--canvas); box-shadow: 0 24px 80px rgba(13,20,36,.20); overflow: auto; overscroll-behavior: contain; }
.registration::backdrop { background: var(--overlay); }
.registration[open] { animation: dialog-enter 200ms ease-out; }
@keyframes dialog-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
body:has(.registration[open]) { overflow: hidden; }
.dialog-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.dialog-top .brand { font-size: 18px; }
.close { display: grid; place-items: center; width: 44px; height: 44px; margin: -6px -10px -6px 0; border: 0; border-radius: 8px; background: transparent; color: var(--text-secondary); cursor: pointer; }
.close:hover { background: var(--surface-subtle); color: var(--text-strong); }
.close svg { width: 20px; height: 20px; }
.registration h2 { margin: 0 0 8px; color: var(--text-strong); font-size: 32px; line-height: 36px; letter-spacing: -.03em; font-weight: 500; }
.registration h2:focus { outline: none; }
.dialog-description { margin: 0 0 28px; color: var(--text-secondary); font-size: 14px; line-height: 20px; }
.field { display: block; margin-bottom: 20px; }
.field label { display: block; margin-bottom: 8px; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--text-default); }
.field input { display: block; width: 100%; min-width: 0; height: 48px; padding: 12px 14px; border: 1px solid var(--text-secondary); border-radius: 8px; background: var(--canvas); color: var(--text-strong); font: 400 16px/24px Onest,Arial,sans-serif; transition: border-color 140ms; }
.field input::placeholder { color: var(--text-secondary); opacity: 1; }
.field input:hover { border-color: var(--text-strong); }
.field input:focus-visible { border-color: var(--brand-primary); }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.field-error { display: block; margin-top: 8px; color: var(--danger); font-size: 12px; line-height: 16px; }
.field-error:empty { display: none; }
.consent { margin: 4px 0 24px; }
.consent-label { display: flex; gap: 12px; align-items: flex-start; min-height: 44px; cursor: pointer; font-size: 12px; line-height: 18px; }
.consent-label input { flex: 0 0 auto; width: 20px; height: 20px; margin: 0; accent-color: var(--brand-primary); cursor: pointer; }
.consent-label span { padding-top: 1px; }
.policy { color: var(--brand-primary); text-decoration: underline; text-underline-offset: 3px; }
.policy-note { margin: 8px 0 0 32px; padding: 12px; border-radius: 8px; background: var(--surface-subtle); font-size: 12px; line-height: 18px; color: var(--text-secondary); }
.registration .submit { width: 100%; min-height: 48px; gap: 8px; cursor: pointer; }
.submit:disabled { cursor: wait; }
.submit[aria-busy="true"]::before { content: ''; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 700ms linear infinite; }
.submit-error { margin-bottom: 20px; padding: 12px 16px; border-left: 2px solid var(--danger); background: var(--surface-subtle); color: var(--danger); font-size: 14px; line-height: 20px; }
.submit-error p { margin: 0; }
.submit-error p + p { margin-top: 4px; color: var(--text-default); }
.success { padding-top: 12px; }
.success-mark { width: 48px; height: 48px; border: 1px solid var(--border-default); border-radius: 50%; display: grid; place-items: center; color: var(--success); margin-bottom: 24px; }
.success-mark svg { width: 24px; height: 24px; }
.success .dialog-description { margin-bottom: 32px; font-size: 16px; line-height: 24px; max-width: 32ch; }
.preview-caption { position: fixed; bottom: 16px; left: 24px; z-index: 2; margin: 0; padding: 8px 12px; border-radius: 8px; background: var(--canvas); color: var(--text-secondary); font-size: 12px; line-height: 16px; pointer-events: none; }
[hidden] { display: none !important; }
@media (max-width: 600px) {
 .registration { width: 100%; max-width: none; height: 100dvh; max-height: 100dvh; margin: 0; padding: max(24px, env(safe-area-inset-top)) 24px max(32px, env(safe-area-inset-bottom)); border-radius: 0; }
 .dialog-top { margin-bottom: 36px; }
 .registration h2 { font-size: 28px; line-height: 32px; }
 .dialog-description { margin-bottom: 28px; }
 .preview-caption { display: none; }
}
@media (prefers-reduced-motion: reduce) { .registration[open], .submit[aria-busy="true"]::before { animation: none; } }
@media (forced-colors: active) { .registration { border: 1px solid CanvasText; } .registration::backdrop { background: Canvas; opacity: .85; } .submit { border: 1px solid ButtonText; } }


/* Static launch placeholder: access requests open in a later release. */
.launch-fields { margin: 0; padding: 0; border: 0; min-width: 0; }
.launch-fields:disabled input { cursor: not-allowed; color: var(--text-secondary); background: var(--surface-subtle); border-color: var(--border-default); opacity: 1; }
.launch-submit:disabled { background: var(--surface-selected); color: var(--text-secondary); cursor: not-allowed; }
.launch-note { margin: 0 0 24px; padding: 12px 16px; background: var(--surface-subtle); color: var(--text-default); font-size: 14px; line-height: 20px; border-radius: 8px; }
.dialog-description { margin-bottom: 24px; }
