/* dialogue layout from mockups/version_2. */
.vacancies-page .vacancy-detail[data-stage="dialogue"] { display: flex; flex-direction: column; overflow: hidden; overscroll-behavior-y: contain; }
.vacancy-detail[data-stage="dialogue"] .dialogue-heading { display: grid; flex: none; grid-template-rows: 1fr; transition: grid-template-rows .42s cubic-bezier(.4,0,.2,1); }
.vacancy-detail[data-stage="dialogue"] .vacancy-heading { min-height: 0; overflow: hidden; transition: opacity .42s cubic-bezier(.4,0,.2,1), transform .42s cubic-bezier(.4,0,.2,1); }
.vacancies-page .vacancy-detail[data-stage="dialogue"] .stage-dock { flex: none; margin: 26px 0 26px; transition: margin .42s cubic-bezier(.4,0,.2,1); }
/* Keep the history close to the stage dock while its edges fade during scrolling. */
.vacancy-detail[data-stage="dialogue"] .stage-pane { flex: 1; min-height: 0; margin-top: -10px; }
.vacancies-page .vacancy-detail.is-chat-condensed .dialogue-heading { grid-template-rows: 0fr; }
.vacancies-page .vacancy-detail.is-chat-condensed .vacancy-heading { opacity: 0; transform: translateY(-12px); pointer-events: none; }
.vacancies-page .vacancy-detail.is-chat-condensed .stage-dock { margin: 4px 0 18px; }
.vacancies-page .conversation { display: grid; grid-template-rows: minmax(0, 1fr) auto auto; height: 100%; min-height: 0; margin: 0; padding: 0; border: 0; }
.conversation .chat-messages { min-height: 0; overflow-y: auto; overflow-anchor: none; scrollbar-gutter: stable; overscroll-behavior-y: contain; margin: 0; padding: 8px 0 64px; gap: 14px; scrollbar-width: thin; scrollbar-color: #555 transparent; }
.vacancies-page .conversation .chat-messages { mask-image: linear-gradient(to bottom, transparent, rgba(0,0,0,.25) calc(var(--chat-fade-top, 0px) * .25), rgba(0,0,0,.75) calc(var(--chat-fade-top, 0px) * .642857), #000 var(--chat-fade-top, 0px), #000 calc(100% - 56px), rgba(0,0,0,.75) calc(100% - 36px), rgba(0,0,0,.25) calc(100% - 14px), transparent); }
.conversation .chat-composer { margin-top: 0; }
.conversation .chat-closed { display: flex; min-height: 72px; align-items: center; gap: 14px; padding: 20px 24px; border: 0; border-radius: 30px; background: #29191b; color: #e7a09c; font-size: 20px; line-height: 1.4; text-align: left; }
.conversation .chat-closed svg { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.conversation .chat-items { display: contents; }
.conversation .chat-history-sentinel { min-height: 1px; flex: none; }
.conversation .chat-update-state { margin: 0 0 8px; font-size: 13px; }
.conversation .chat-history-state { margin: 0; font-size: 13px; }
.conversation [hidden] { display: none; }
.conversation .chat-bubble { flex: none; max-width: min(78%, 640px); padding: 15px 20px 10px; border: 0; border-radius: 26px 26px 26px 8px; background: #161616; color: #f1f1f1; }
.conversation .chat-bubble.self { border-radius: 26px 26px 8px 26px; background: #2a2a2a; color: #f0f0f0; }
.conversation .chat-bubble p { margin: 0; font-size: 19px; line-height: 1.45; }
.conversation .chat-bubble small { margin-top: 5px; color: #7c7c7c; font-size: 13px; line-height: 1; text-align: right; }
.conversation .chat-bubble.self small { color: #969696; }
/* consecutive messages share a flatter corner and a smaller gap. */
.conversation .chat-bubble:not(.self) + .chat-bubble:not(.self) { margin-top: -6px; border-top-left-radius: 8px; }
.conversation .chat-bubble.self + .chat-bubble.self { margin-top: -6px; border-top-right-radius: 8px; }
.chat-day-divider { flex: none; align-self: center; margin: 6px 0 -8px; }
.chat-day-divider span { display: inline-block; padding: 6px 12px; border-radius: 999px; background: #111; color: #7a7a7a; font-size: 13px; font-weight: 600; white-space: nowrap; }
.chat-composer { position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 14px; overflow: hidden; margin-top: 14px; padding: 12px 16px 12px 22px; border: 1px solid #303030; border-radius: 32px; background: #101010; transition: border-color .18s ease, background .18s ease, box-shadow .18s ease; }
.chat-composer:focus-within { border-color: #484848; background: #121212; }
.chat-composer textarea { align-self: center; width: 100%; min-width: 0; height: 1.5em; min-height: 1.5em; max-height: min(260px, 24dvh); padding: 0; resize: none; overflow-y: auto; border: 0; outline: 0; border-radius: 0; background: transparent; color: #fff; font: inherit; font-size: 21px; line-height: 1.5; }
.chat-composer textarea::placeholder { color: #666; }
.chat-composer .form-error { grid-column: 1 / -1; grid-row: 3; margin: 0; }
.chat-composer .form-error:empty { display: none; }
.chat-composer.is-expanded { grid-template-columns: minmax(0, 1fr); }
.chat-composer textarea { grid-column: 1; grid-row: 1; }
.chat-composer.is-expanded .chat-composer-actions { grid-column: 1; grid-row: 2; }
.chat-composer[hidden] { display: none; }
.chat-composer-actions { grid-column: 2; grid-row: 1; display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.chat-ai { display: inline-flex; min-width: 102px; min-height: 60px; align-items: center; justify-content: center; gap: 11px; padding: 0 19px; border: 0; border-radius: 999px; background: #333; color: #d0d0d0; font-size: 20px; font-weight: 650; line-height: 1; transition: color .2s ease, background .2s ease, border-color .2s ease; }
.chat-ai:hover { background: #3d3d3d; color: #fff; }
.chat-ai:focus-visible { outline: 2px solid #ffd369; outline-offset: -2px; }
.chat-ai-mark { display: grid; width: 30px; height: 30px; flex: none; place-items: center; color: #ffd369; }
.chat-ai-mark svg { display: block; width: 100%; height: 100%; fill: currentColor; }
.chat-ai.is-undo { color: #ddd; }
.chat-ai.is-undo svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; animation: ai-icon-in .3s ease both; }
.chat-composer::before { content: ''; position: absolute; z-index: -1; inset: 0; pointer-events: none; opacity: 0; background: linear-gradient(110deg, transparent 20%, rgba(255,211,105,.12) 48%, transparent 76%); transform: translateX(-100%); }
.chat-composer.is-rewriting { border-color: #8b7440; box-shadow: 0 0 28px rgba(255,211,105,.08); }
.conversation .chat-composer,
.conversation .chat-composer.is-rewriting { border: 0; background: #1e1e1e; box-shadow: none; }
.conversation .chat-composer:focus-within { border: 0; background: #232323; box-shadow: none; }
.conversation .chat-composer { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px; padding: 7px; border-radius: 32px; }
.conversation .chat-composer textarea { flex: 1; width: auto; min-height: 28px; margin: 14px 10px; font-size: 19px; line-height: 28px; }
.conversation .chat-composer textarea::placeholder { color: #6a6a6a; }
.conversation .chat-composer .form-error { order: -1; flex: 1 0 100%; margin: 6px 12px 2px; }
.conversation .chat-composer-actions { gap: 8px; }
/* a long draft takes the whole width; the buttons drop to their own row */
.conversation .chat-composer.is-expanded textarea { flex-basis: 100%; margin-bottom: 4px; }
.conversation .chat-composer.is-expanded .chat-composer-actions { margin-left: auto; }
.conversation .chat-ai { min-width: 0; min-height: 56px; gap: 8px; padding: 0 18px 0 14px; background: #2c2c2c; color: #aaa; font-size: 17px; font-weight: 600; }
.conversation .chat-ai:hover { background: #363636; color: #fff; }
.conversation .chat-ai-mark { width: 24px; height: 24px; }
.conversation .chat-ai.is-undo svg { width: 24px; height: 24px; }
.conversation .chat-send { width: 56px; height: 56px; min-width: 56px; background: #353535; color: #fff; }
.conversation .chat-send svg { width: 25px; height: 25px; }
.conversation .chat-send:hover:not(:disabled) { background: #414141; color: #fff; }
.chat-composer.is-rewriting::before { animation: ai-sweep .9s ease-in-out infinite; }
.is-rewriting textarea { animation: ai-text-breathe .9s ease-in-out infinite; }
.is-rewriting .chat-ai { color: #ffd369; border-color: #8b7440; }
.is-rewriting .chat-ai-mark { animation: ai-star-turn .9s ease-in-out infinite; }
.chat-ai:disabled { cursor: wait; }
.chat-send:disabled { opacity: .35; cursor: wait; }
.chat-composer.is-revealing textarea { animation: ai-text-in .4s ease-out both; }
.chat-send { display: grid; width: 60px; height: 60px; min-width: 60px; place-items: center; padding: 0; border: 0; border-radius: 50%; background: #f3f3f3; color: #080808; }
.chat-send svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.5; }
.chat-send:hover { background: #dedede; }
@keyframes ai-sweep { to { transform: translateX(100%); opacity: 1; } 20%, 80% { opacity: 1; } }
@keyframes ai-star-turn { 50% { transform: rotate(90deg) scale(.75); } to { transform: rotate(180deg); } }
@keyframes ai-text-breathe { 50% { opacity: .4; } }
@keyframes ai-text-in { from { opacity: .35; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes ai-icon-in { from { opacity: 0; transform: rotate(-45deg) scale(.7); } to { opacity: 1; transform: rotate(0) scale(1); } }
@media (min-width: 821px) {
  .vacancies-page .vacancy-detail[data-stage="dialogue"] { overflow: visible; }
  .vacancies-page .conversation .chat-messages { margin-right: -12px; padding-right: 12px; }
}
@media (max-width: 820px) {
  .vacancies-page .vacancy-detail[data-stage="dialogue"] { display: none; }
  .vacancies-page .has-detail .vacancy-detail[data-stage="dialogue"] { display: flex; height: max(560px, 100dvh); padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .vacancy-detail[data-stage="dialogue"] .detail-bar { flex: none; }
  .conversation .chat-bubble { max-width: 86%; }
  .conversation .chat-closed { min-height: 64px; gap: 12px; padding: 16px 18px; border-radius: 26px; font-size: 18px; }
  .chat-composer { padding: 10px 12px 10px 18px; border-radius: 28px; }
  .chat-composer textarea { min-height: 1.5em; font-size: 18px; }
  .chat-ai { min-height: 56px; }
  .chat-send { width: 56px; height: 56px; min-width: 56px; }
  .conversation .chat-bubble p { font-size: 17.5px; }
  .conversation .chat-composer { padding: 6px; border-radius: 28px; }
  .conversation .chat-composer textarea { min-height: 26px; margin: 12px 8px; font-size: 18px; line-height: 26px; }
  .conversation .chat-ai { min-height: 50px; padding: 0 16px 0 12px; font-size: 16px; }
  .conversation .chat-send { width: 50px; height: 50px; min-width: 50px; }
}
@media (prefers-reduced-motion: reduce) {
  .vacancy-detail[data-stage="dialogue"] .dialogue-heading, .vacancy-detail[data-stage="dialogue"] .vacancy-heading, .vacancies-page .vacancy-detail[data-stage="dialogue"] .stage-dock, .chat-composer, .chat-ai { transition: none; }
  .chat-composer::before, .chat-composer textarea, .chat-ai svg, .chat-ai-mark { animation: none !important; }
}
