/* Дизайн из Claude Design «Заявка на исследование.dc.html»:
   тёплая бумажная тема, TT Hoves + IBM Plex Sans + мономер для меток.
   Шрифты подхватываются из static/fonts/, при их отсутствии — системный fallback. */

[hidden] { display: none !important; }

@font-face { font-family: 'TT Hoves'; src: url('fonts/TTHoves-DemiBold.otf') format('opentype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'TT Hoves'; src: url('fonts/TTHoves-Bold.otf') format('opentype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; src: url('fonts/IBMPlexSans-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; src: url('fonts/IBMPlexSans-Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; src: url('fonts/IBMPlexSans-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }

:root {
  --bg: #ded9d3;          /* фон-бумага */
  --panel: #ede8e3;       /* панели */
  --white: #ffffff;
  --ink: #141413;         /* чернила */
  --ink-2: #3a3a38;
  --ink-3: #555555;
  --muted: #696969;
  --faint: #8e8b85;
  --orange: #F37338;      /* акцент */
  --orange-deep: #CF4500;
  --orange-ink: #9A3A0A;
  --line: rgba(20, 20, 19, .12);
  --line-mid: rgba(20, 20, 19, .16);
  --line-strong: rgba(20, 20, 19, .28);
  --font: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  --font-head: 'TT Hoves', 'IBM Plex Sans', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(20,20,19,.14); border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@keyframes pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .02em;
}


/* ---------- КАРКАС ---------- */
.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 24px;
  max-width: 1560px;
  margin: 0 auto;
  overflow: hidden;
}

.main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 18px;
}

/* ---------- TOP BAR ---------- */
.topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--panel);
  border-radius: 999px;
  padding: 12px 14px 12px 26px;
  box-shadow: 0 6px 24px 0 rgba(0, 0, 0, .05);
}
.topbar__left { display: flex; align-items: center; gap: 14px; }
.topbar__brand {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -.03em;
}
.topbar__section {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted);
}
.topbar__pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-mid);
  font-size: 13px; font-weight: 500;
  color: var(--ink-2);
}

/* ---------- ПАНЕЛИ ---------- */
.chat, .card {
  background: var(--panel);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* ---------- ЧАТ ---------- */
.chat__head {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 22px 26px 16px;
}
.chat__label {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 13px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
}
.chat__meta { color: var(--muted); }

.chat__log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 26px 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scroll-behavior: smooth;
}

.msgw { max-width: 80%; display: flex; flex-direction: column; gap: 6px; animation: pop .18s ease; }
.msgw--agent { align-self: flex-start; }
.msgw--user { align-self: flex-end; align-items: flex-end; }

.msg__meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 0 2px;
}

.msg {
  padding: 14px 18px;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg--agent {
  background: var(--white);
  border-radius: 20px 20px 20px 6px;
  color: #1c1b18;
}
.msg--user {
  background: var(--ink);
  color: var(--panel);
  border-radius: 20px 20px 6px 20px;
}
.msg--typing { color: var(--faint); background: var(--white); border-radius: 20px 20px 20px 6px; }

.msg--error {
  align-self: center;
  max-width: 92%;
  background: transparent;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--orange-ink);
  font-size: 13.5px;
  text-align: center;
  padding: 10px 14px;
}
.msg--error button {
  margin-left: 8px;
  border: 1.5px solid var(--ink);
  background: var(--ink);
  color: var(--panel);
  border-radius: 999px;
  padding: 4px 14px;
  cursor: pointer;
  font-size: 12.5px;
  font-family: inherit;
}

/* кнопки-варианты под вопросом агента */
.suggestions {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: -6px 0 2px 2px;
  max-width: 80%;
  align-self: flex-start;
}
.suggestion {
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 16px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.suggestion:hover { background: var(--ink); color: var(--panel); }

/* ---------- COMPOSER ---------- */
.chat__composer {
  flex-shrink: 0;
  padding: 16px 26px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.composer__banner {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px dashed var(--line-strong);
  color: var(--orange-ink);
  font-size: 13px;
}

.composer__row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--white);
  border: 1px solid var(--line-mid);
  border-radius: 14px;
  padding: 8px 8px 8px 18px;
}

.composer__input {
  flex: 1;
  resize: none;
  max-height: 160px;
  padding: 10px 0;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
}
.composer__input::placeholder { color: var(--faint); }

.btn-round {
  flex-shrink: 0;
  width: 44px; height: 44px;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all .15s;
}
.btn-round--ghost {
  border: 1.5px solid var(--ink);
  background: var(--white);
  color: var(--ink);
}
.btn-round--ghost:hover { background: var(--bg); }
.btn-round--ghost.is-recording { border-color: var(--orange-deep); color: var(--orange-deep); animation: pulse 1.2s infinite; }
.btn-round--dark {
  border: none;
  background: var(--ink);
  color: var(--panel);
}
.btn-round--dark:hover { background: #000; }
.btn-round:disabled { opacity: .45; cursor: not-allowed; }

.composer__rec {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
}
.rec__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--orange-deep); animation: pulse 1s infinite; }
.rec__label { font-size: 13.5px; color: var(--orange-ink); }
.rec__time { color: var(--orange-ink); margin-left: auto; font-variant-numeric: tabular-nums; }
.btn-stop {
  border: none; background: var(--ink); color: var(--panel);
  padding: 6px 16px; border-radius: 999px; cursor: pointer;
  font-size: 13px; font-family: inherit;
}
.btn-ghost {
  border: 1px solid var(--line-strong); background: transparent; color: var(--ink-2);
  padding: 6px 14px; border-radius: 999px; cursor: pointer;
  font-size: 13px; font-family: inherit;
}

.composer__hint { margin: 0; color: var(--faint); }

/* ---------- КАРТОЧКА ---------- */
.card__head {
  flex-shrink: 0;
  padding: 22px 26px 16px;
  border-bottom: 1px solid var(--line);
}
.card__titlerow {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 18px;
}
.card__label {
  font-size: 13px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
}
.card__status {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
}

.card__progress { display: flex; flex-direction: column; gap: 14px; }
.progress { display: flex; flex-direction: column; gap: 8px; }
.progress__row { display: flex; align-items: center; justify-content: space-between; }
.progress__label { font-size: 13px; color: var(--ink-3); }
.progress__val { color: var(--ink); font-variant-numeric: tabular-nums; }
.progress__track { height: 8px; border-radius: 999px; background: var(--white); overflow: hidden; }
.progress__fill { height: 100%; width: 0; border-radius: 999px; transition: width .4s ease; }
.progress__fill--hard { background: var(--ink); }
.progress__fill--soft { background: var(--orange); }

.card__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 26px 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.card__section { display: flex; flex-direction: column; gap: 10px; }
.card__section-title {
  font-size: 13px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted);
}

/* заполненное поле — белая плитка */
.field {
  background: var(--white);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--faint);
}
.field__value { font-size: 15px; line-height: 1.45; color: var(--ink); }
.field__value a { color: #3860BE; text-decoration: none; }

/* незаполненное — пунктирная плашка */
.field--empty {
  background: transparent;
  border: 1px dashed var(--line-strong);
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
}
.field--empty .field__hint { font-size: 13px; color: var(--faint); flex: none; }

/* компактная сетка «О вас» */
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field-grid .field { padding: 12px 14px; }
.field-grid .field__value { font-size: 14px; }

/* редактирование в S7 */
.field__edit {
  border: none;
  border-bottom: 1.5px solid var(--line-strong);
  background: transparent;
  padding: 2px 0 4px;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  outline: none;
  width: 100%;
}
.field__edit:focus { border-bottom-color: var(--orange-deep); }
.field__edit::placeholder { color: var(--faint); }

/* похожие исследования */
.similar__item {
  background: var(--white);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 5px;
}
.similar__title { font-size: 14.5px; font-weight: 600; }
.similar__meta { font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); }
.similar__meta a { color: #3860BE; text-decoration: none; }
.similar__finding { font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.similar__reaction { font-size: 12.5px; color: var(--orange-ink); }

.design__text { font-size: 14px; line-height: 1.5; color: var(--ink-2); white-space: pre-line; }

/* сабмит */
.card__submit {
  flex-shrink: 0;
  padding: 16px 26px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.btn-primary {
  width: 100%;
  height: 52px;
  border: none;
  border-radius: 999px;
  background: var(--ink);
  color: var(--panel);
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.btn-primary:hover { background: #000; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.card__priority {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--muted);
}

/* ---------- ФИНАЛЬНЫЙ ЭКРАН ---------- */
.final {
  position: fixed; inset: 0;
  background: rgba(222, 217, 211, .85);
  backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.final__box {
  background: var(--panel);
  border-radius: 20px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, .12);
  padding: 40px 48px;
  max-width: 480px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.final__check {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--panel);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 6px;
}
.final__title {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 24px;
  letter-spacing: -.02em;
}
.final__id { margin: 0; color: var(--muted); }
.final__score {
  margin: 0;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-size: 13.5px;
  color: var(--ink-2);
}
.final__steps { font-size: 14px; line-height: 1.55; color: var(--ink-3); }
.final__box .btn-primary { margin-top: 14px; width: auto; padding: 0 36px; }
