.ai-page { max-width: 1100px; }
.ai-page-intro { display: flex; align-items: end; justify-content: space-between; gap: 30px; padding: 52px 0 30px; }
.ai-page-intro h1 { margin-bottom: 12px; }
.ai-connection { display: inline-flex; align-items: center; gap: 9px; padding-bottom: 6px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.ai-connection .status-dot.warning { background: var(--gold-deep); box-shadow: 0 0 0 3px rgba(155, 108, 23, .12); }
.ai-chat-panel { overflow: hidden; }
.ai-chat-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 21px 24px; border-bottom: 1px solid var(--line); }
.ai-identity { display: flex; align-items: center; gap: 11px; min-width: 0; }
.ai-identity > span:last-child { display: block; min-width: 0; }
.ai-identity strong, .ai-identity small { display: block; }
.ai-identity strong { font-size: 14px; }
.ai-identity small { color: var(--muted); margin-top: 3px; font-size: 10px; }
.ai-avatar { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 11px; color: var(--gold-deep); background: #f2ead7; }
.ai-avatar svg { width: 20px; height: 20px; }
.ai-messages { display: grid; gap: 13px; min-height: 410px; max-height: 57vh; overflow-y: auto; padding: 25px; background: #fbfbf8; }
.ai-message { width: min(78%, 680px); padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px 13px 13px 4px; background: var(--surface); box-shadow: 0 6px 18px rgba(20, 21, 18, .035); }
.ai-message.user { justify-self: end; border-color: var(--ink); border-radius: 13px 13px 4px 13px; color: #fff; background: var(--ink); }
.ai-message.error { border-color: #e6c5c0; background: #fff8f6; color: var(--error); }
.ai-message-label { margin-bottom: 5px; color: var(--muted); font: 500 10px Calibri, "Segoe UI", system-ui, sans-serif; letter-spacing: .04em; }
.ai-message.user .ai-message-label { color: #b7b9b1; }
.ai-message p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.6; }
.ai-message.pending p::after { content: ""; display: inline-block; width: 4px; height: 4px; margin-left: 6px; border-radius: 50%; background: var(--gold-deep); box-shadow: 8px 0 0 var(--gold-deep), 16px 0 0 var(--gold-deep); animation: ai-pulse 1.1s infinite ease-in-out; }
.ai-composer { display: flex; align-items: end; gap: 11px; padding: 18px 24px 10px; border-top: 1px solid var(--line); background: var(--surface); }
.ai-composer textarea { min-height: 44px; max-height: 150px; flex: 1; resize: none; overflow-y: auto; border: 1px solid #cfd0c7; border-radius: 10px; outline: 0; padding: 11px 13px; color: var(--ink); background: #fff; line-height: 1.4; transition: border .2s ease, box-shadow .2s ease; }
.ai-composer textarea:focus { border-color: var(--gold-deep); box-shadow: 0 0 0 3px rgba(155, 108, 23, .12); }
.ai-composer textarea::placeholder { color: #aeb0a7; }
.ai-composer .button { flex: 0 0 auto; min-width: 87px; }
.ai-form-hint { margin: 0; padding: 0 24px 20px; color: #999b91; font: 10px Calibri, "Segoe UI", system-ui, sans-serif; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@keyframes ai-pulse { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }

@media (max-width: 780px) {
  .ai-page-intro { display: block; padding: 36px 0 25px; }
  .ai-connection { margin-top: 18px; }
  .ai-chat-header { align-items: flex-start; flex-direction: column; padding: 18px; }
  .ai-messages { min-height: 50vh; max-height: none; padding: 18px; }
  .ai-message { width: 88%; }
  .ai-composer { align-items: stretch; flex-direction: column; padding: 14px 18px 8px; }
  .ai-composer .button { width: 100%; }
  .ai-form-hint { padding: 0 18px 18px; }
}
