/* Shared Aira widget. One layout and one focus boundary on every page. */
html .chat-widget {
    --chat-gutter: 20px;
    position: fixed;
    z-index: 60;
    right: max(var(--chat-gutter), env(safe-area-inset-right));
    bottom: calc(max(var(--chat-gutter), env(safe-area-inset-bottom)) + var(--chat-keyboard-offset, 0px));
    font-family: var(--font-sans);
    color: #CCD3D9;
}
html .chat-widget__toggle {
    display: flex; align-items: center; gap: 13px;
    min-height: 68px; padding: 12px 16px 12px 12px;
    border: 1px solid #667D8C; border-radius: 2px;
    background: #2D3B44; color: #DFE7ED;
    box-shadow: 0 8px 24px #10171C33;
    text-align: left; line-height: 1.3;
    transition: background .18s, border-color .18s;
}
html .chat-widget__toggle:hover { background: #394D5A; border-color: #A5BAC9; }
html .chat-widget__mark, html .chat-panel__avatar {
    display: grid; place-items: center; flex: 0 0 40px;
    width: 40px; height: 40px; border: 1px solid #718996;
    color: #C9D9E3; background: #243139;
}
html .chat-widget__label { display: grid; gap: 3px; }
html .chat-widget__label strong { font-size: 15px; font-weight: 500; }
html .chat-widget__label small { font-size: 11px; color: #A9BAC5; }
html .chat-widget__arrow { margin-left: 7px; flex: 0 0 18px; }
html .chat-widget.is-open .chat-widget__toggle, html .chat-panel[hidden] { display: none; }
html .chat-panel {
    width: min(432px, calc(var(--chat-viewport-width, 100vw) - var(--chat-gutter) * 2));
    height: min(620px, calc(var(--chat-viewport-height, 100dvh) - var(--chat-gutter) * 2));
    display: flex; flex-direction: column;
    overflow: hidden; direction: ltr; unicode-bidi: isolate;
    background: #1E282F; border: 1px solid #647B8A; border-radius: 2px;
    box-shadow: 0 16px 56px #10171C66;
    animation: aira-panel-in .2s ease-out;
}
@keyframes aira-panel-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
html .chat-panel__header {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    flex: 0 0 auto; padding: 18px 20px;
    border-bottom: 1px solid #42545F; background: #2D3B44;
}
html .chat-panel__title { display: flex; align-items: center; gap: 12px; min-width: 0; }
html .chat-panel__avatar { font-size: 25px; font-weight: 300; line-height: 1; }
html .chat-panel__title strong { display: block; font: 500 18px/1.3 var(--font-sans); color: #E1E8ED; }
html .chat-panel__brand { font-size: 11px; font-weight: 400; color: #A6B9C5; white-space: nowrap; }
html .chat-panel__title small { display: block; margin-top: 4px; font-size: 11.5px; line-height: 1.4; color: #B1C0CA; }
html .chat-panel__close {
    display: grid; place-items: center; flex: 0 0 40px;
    width: 40px; height: 40px; padding: 0;
    border: 1px solid transparent; border-radius: 2px;
    color: #B8C8D2; background: transparent;
    transition: background .15s, color .15s;
}
html .chat-panel__close:hover { background: #40535F; color: #F0F4F7; }
html .chat-panel__log {
    flex: 1 1 auto; min-height: 0; min-width: 0;
    display: flex; flex-direction: column; align-items: stretch; gap: 20px;
    overflow: auto; overscroll-behavior: contain;
    padding: 24px 20px;
    scrollbar-width: thin; scrollbar-color: #647B8A transparent;
}
html .chat-panel .msg { flex: 0 0 auto; }
html .chat-panel .msg__bubble {
    max-width: 100%; font-size: 14px; line-height: 1.7;
    border-radius: 2px; overflow-wrap: anywhere;
}
html .chat-panel .msg--bot .msg__bubble { padding: 0; background: transparent; color: #CCD8E0; }
html .chat-panel .msg--user .msg__bubble {
    max-width: 88%; padding: 11px 14px;
    background: #354B59; border: 1px solid #4B6474; color: #E2EBF0;
}
html .chat-panel .msg--err .msg__bubble { padding: 12px 14px; background: #422F32; color: #EDBFC1; }
html .chat-panel__suggestions { display: grid; gap: 7px; }
html .chat-panel__suggestions button {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    min-height: 42px; padding: 10px 12px;
    border: 1px solid #425764; border-radius: 2px;
    background: #26353F; color: #C9D9E3; text-align: left; font-size: 13px; line-height: 1.4;
    transition: border-color .15s, background .15s;
}
html .chat-panel__suggestions button::after { content: '↗'; color: #91ADBF; }
html .chat-panel__suggestions button:hover { background: #314550; border-color: #6F8A9B; }
html .chat-panel__suggestions[hidden] { display: none; }
html .chat-panel__toolbar { flex: 0 0 auto; padding: 10px 20px; border-top: 1px solid #3D505C; background: #26333C; }
html .chat-panel__toolbar[hidden] { display: none; }
html .chat-panel__check { display: flex; align-items: center; gap: 9px; color: #C1D0DA; font-size: 12px; cursor: pointer; }
html .chat-panel__check input { width: 16px; height: 16px; margin: 0; flex: 0 0 16px; accent-color: #B8C6D1; }
html .chat-panel__form { flex: 0 0 auto; margin: 0; padding: 16px 20px 0; border-top: 1px solid #42545F; background: #26333C; }
html .chat-panel__composer {
    display: flex; align-items: flex-end; gap: 6px; padding: 6px;
    border: 1px solid #637B8A; border-radius: 2px; background: #1C272E;
    transition: border-color .15s;
}
html .chat-panel__composer:has(textarea:focus) { border-color: #C4D4E0; }
html .chat-panel__composer textarea,
html .chat-panel__composer textarea:is(:focus,:focus-visible) {
    flex: 1 1 auto; display: block; width: 100%; min-width: 0;
    min-height: 44px; max-height: 140px; height: 44px;
    margin: 0; padding: 11px 8px;
    border: 0 !important; border-radius: 0; outline: none !important; box-shadow: none !important;
    background: transparent; color: #DFE7ED; font: 400 14px/22px var(--font-sans);
    resize: none; overflow-x: hidden; overflow-y: hidden;
    scrollbar-width: thin; scrollbar-gutter: auto; scrollbar-color: #647B8A transparent;
}
html .chat-panel__send {
    display: grid; place-items: center; flex: 0 0 44px;
    width: 44px; height: 44px; padding: 0;
    border: 1px solid #B8C6D1; border-radius: 2px;
    color: #1E2A32; background: #B8C6D1;
    transition: background .15s, border-color .15s, color .15s;
}
html .chat-panel__send:hover:not(:disabled) { background: #DAE5EC; border-color: #DAE5EC; }
html .chat-panel__send:disabled { opacity: 1; cursor: default; color: #8098A7; background: #2A3B46; border-color: #405968; }
html .chat-panel__keys { display: flex; justify-content: space-between; gap: 8px; padding-top: 8px; font-size: 10px; line-height: 1.5; color: #9DB2BF; }
html .chat-panel__hint { flex: 0 0 auto; padding: 12px 20px 16px; font-size: 10.5px; line-height: 1.5; text-align: left; color: #A3B5C1; background: #26333C; }
@media (max-width: 520px) {
    html .chat-widget { --chat-gutter: 10px; }
    html .chat-widget__toggle { min-height: 60px; padding: 9px 13px 9px 9px; gap: 10px; }
    html .chat-widget__mark { width: 36px; height: 36px; flex-basis: 36px; }
    html .chat-widget__label strong { font-size: 14px; }
    html .chat-panel { height: min(660px, calc(var(--chat-viewport-height, 100dvh) - 20px)); }
    html .chat-panel__header { padding: 14px; gap: 8px; }
    html .chat-panel__title { gap: 10px; }
    html .chat-panel__log { padding: 20px 14px; gap: 18px; }
    html .chat-panel__form { padding: 14px 14px 0; }
    html .chat-panel__toolbar { padding-inline: 14px; }
    html .chat-panel__hint { padding: 10px 14px 14px; }
    html .chat-panel__keys { display: none; }
}
@media (max-width: 360px) {
    html .chat-panel__brand { display: none; }
    html .chat-panel__title small { font-size: 10.5px; }
}
@media (prefers-reduced-motion: reduce) { html .chat-panel { animation: none; } }
@media print { html .chat-widget { display: none; } }
