/* Resident panel: one scrolling transcript, with a fixed composer. */
.arfaon-guide__panel { max-height: calc(100dvh - 112px); overflow-y: auto; overscroll-behavior: contain; }
.arfaon-guide [hidden] { display: none !important; }
#arfaonGuide[data-resident-enabled="true"] #arfaonGuidePanel {
  box-sizing: border-box; width: min(480px, calc(100vw - 24px));
  height: min(640px, calc(100dvh - 112px)); overflow: hidden;
}
#arfaonGuide[data-resident-enabled="true"] .arfaon-guide__visual,
#arfaonGuide[data-resident-enabled="true"] .arfaon-guide__persona,
#arfaonGuide[data-resident-enabled="true"] .arfaon-guide__fallback,
#arfaonGuide[data-resident-enabled="true"] #arfaonGuideForm,
#arfaonGuide[data-resident-enabled="true"] .arfaon-guide__examples,
#arfaonGuide[data-resident-enabled="true"] .arfaon-guide__choices,
#arfaonGuide[data-resident-enabled="true"] .arfaon-guide__how,
#arfaonGuide[data-resident-enabled="true"] .resident-intro { display: none; }
#arfaonGuide[data-resident-enabled="true"] .arfaon-guide__body {
  box-sizing: border-box; height: 100%; padding: 16px;
  display: flex; flex-direction: column; min-height: 0;
}
#arfaonGuide[data-resident-enabled="true"] #arfaonGuideTitle {
  flex-shrink: 0; margin: 6px 40px 4px 0; font-size: 20px; line-height: 1.2;
}
#residentChat { flex: 1; min-height: 0; margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
#residentChat .resident-persona { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
#residentChat .resident-persona label { font-size: 12px; color: #aebcc5; }
#residentChat select, #residentChat textarea {
  box-sizing: border-box; color: #f3f5f7; background: #111b2a;
  border: 1px solid rgba(255,255,255,.2); border-radius: 12px;
  padding: 9px 10px; font: inherit; font-size: 16px;
}
#residentChat select { flex: 1; min-width: 0; width: auto; height: 38px; }
#residentChat textarea { width: 100%; height: 54px; min-height: 54px; max-height: 54px; resize: none; }
#residentMessages {
  flex: 1; min-height: 0; max-height: none; overflow-y: auto;
  overscroll-behavior: contain; overflow-wrap: anywhere; white-space: pre-wrap;
  margin: 0; padding: 4px 2px; scrollbar-width: thin;
}
#residentMessages:empty::before {
  content: "Напишите «Привет» или задайте вопрос. Ответ появится здесь.";
  display: block; padding: 14px 10px; color: #94a5b0; font-size: 13px;
}
#residentMessages .resident-turn {
  margin: 0 14px 10px 0; padding: 10px 12px; border-radius: 14px;
  background: rgba(255,255,255,.055); color: #e5edf2; font-size: 14px; line-height: 1.5;
}
#residentMessages .resident-turn strong { display: block; margin-bottom: 3px; color: #e9c692; font-size: 11px; }
#residentMessages .resident-turn--user { margin-left: 30px; margin-right: 0; background: rgba(233,198,146,.09); }
#residentChat #residentForm { flex-shrink: 0; display: grid; gap: 6px; margin: 0; }
#residentChat .resident-send { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
#residentChat .resident-send button { min-height: 40px; margin: 0; padding: 8px 14px; font-size: 13px; }
#residentChat #residentClear { background: transparent; color: #aebcc5; border-color: rgba(255,255,255,.15); }
#residentChat button:disabled { opacity: .6; }
#residentChat #residentStatus { margin: 0; font-size: 12px; line-height: 1.35; }
#residentChat #residentStatus:empty { display: none; }
#residentChat #residentDiagnose { flex-shrink: 0; margin: 0; min-height: 36px; padding: 8px; font-size: 12px; text-align: center; }
#residentChat #residentLogin { flex-shrink: 0; margin: 0; padding: 8px; text-decoration: underline; }
#residentChat .resident-memory-note { flex-shrink: 0; margin: 0; font-size: 11px; line-height: 1.3; }
@media (max-width:600px) {
  #arfaonGuide[data-resident-enabled="true"] #arfaonGuidePanel { width: calc(100vw - 20px); height: calc(100dvh - 96px); max-height: calc(100dvh - 96px); }
}
@media (max-height:480px) {
  #arfaonGuide[data-resident-enabled="true"] .arfaon-guide__eyebrow,
  #residentChat .resident-memory-note, #residentChat #residentDiagnose { display: none; }
  #arfaonGuide[data-resident-enabled="true"] .arfaon-guide__body { padding: 10px; }
  #residentChat { gap: 4px; margin-top: 4px; }
  #residentChat textarea { height: 40px; min-height: 40px; max-height: 40px; }
}
