/* Live chat widget (bottom right). The cookie notice stays bottom left; chat.js lifts the button
   above it when both would overlap (phones). Full screen panel on phones. */
.abechat { --chat-bottom: 20px; font-family: var(--font); }
.abechat [hidden] { display: none !important; }
.abechat-launcher {
    position: fixed; right: 20px; bottom: var(--chat-bottom); z-index: 80; width: 60px; height: 60px; border-radius: 50%;
    border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; cursor: pointer;
    box-shadow: 0 12px 30px -8px rgba(94, 159, 31, .55), 0 4px 12px rgba(15, 23, 42, .12); transition: transform .2s, bottom .2s;
}
.abechat-launcher:hover { transform: translateY(-2px) scale(1.04); }
.abechat-launcher:focus-visible { outline: 3px solid rgba(94, 159, 31, .45); outline-offset: 3px; }
.abechat-launcher .abechat-dot { position: absolute; right: 3px; bottom: 3px; width: 15px; height: 15px; border: 3px solid #fff; }
.abechat-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #9aa3b2; flex: none; }
.abechat.is-online .abechat-dot { background: #22c55e; }
.abechat-badge {
    position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
    background: var(--danger); color: #fff; font: 700 12px/22px var(--font); text-align: center; box-shadow: 0 0 0 2px #fff;
}
.abechat-open .abechat-launcher { transform: scale(.9); }

.abechat-panel {
    position: fixed; right: 20px; bottom: calc(var(--chat-bottom) + 72px); z-index: 81; width: 380px; max-width: calc(100vw - 40px);
    height: min(600px, calc(100vh - 140px)); height: min(600px, calc(100dvh - 140px)); display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
    animation: abechat-in .18s ease-out;
}
@keyframes abechat-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.abechat-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; background: linear-gradient(135deg, var(--brand), #4d8a18); color: #fff; }
.abechat-head img { width: 36px; height: 36px; border-radius: 50%; background: #fff; flex: none; }
.abechat-title { flex: 1; min-width: 0; line-height: 1.3; }
.abechat-title b { display: block; font-size: 16px; }
.abechat-title small { display: flex; align-items: center; gap: 6px; font-size: 12.5px; opacity: .95; }
.abechat-head .abechat-dot { border: 2px solid rgba(255, 255, 255, .8); width: 10px; height: 10px; }
.abechat-close { border: 0; background: rgba(255, 255, 255, .14); color: #fff; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; flex: none; }
.abechat-close:hover { background: rgba(255, 255, 255, .26); }

.abechat-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px; background: var(--bg-2); display: flex; flex-direction: column; gap: 8px; }
.abechat-list { display: flex; flex-direction: column; gap: 8px; }
.abechat-msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 85%; }
.abechat-msg.visitor { align-self: flex-end; align-items: flex-end; }
.abechat-bubble {
    padding: 9px 13px; border-radius: 16px 16px 16px 4px; background: #fff; border: 1px solid var(--line); color: var(--text);
    font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
}
.abechat-msg.visitor .abechat-bubble { background: var(--brand); border-color: var(--brand); color: #fff; border-radius: 16px 16px 4px 16px; }
.abechat-bubble a { text-decoration: underline; }
.abechat-meta { font-size: 11px; color: var(--muted); margin: 2px 6px 0; }
.abechat-author { font-size: 11.5px; font-weight: 600; color: var(--muted); margin: 0 6px 2px; }
.abechat-img { display: block; margin-top: 4px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.abechat-img img { max-width: 220px; max-height: 220px; width: auto; height: auto; object-fit: cover; }
.abechat-doc { display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; padding: 8px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--line); font-size: 13.5px; max-width: 100%; color: var(--text); }
.abechat-doc span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.abechat-doc small { color: var(--muted); flex: none; }
.abechat-sys { align-self: center; text-align: center; font-size: 12.5px; color: var(--muted); background: #fff; border: 1px dashed var(--line-2); border-radius: 12px; padding: 8px 12px; max-width: 100%; }
.abechat-typing { font-size: 12.5px; color: var(--muted); min-height: 0; font-style: italic; }

.abechat-start { display: flex; flex-direction: column; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-top: 4px; }
.abechat-start label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--text); }
.abechat-start input, .abechat-start textarea, .abechat-compose textarea {
    width: 100%; font: 15px/1.45 var(--font); color: var(--text); background: #fff; border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 12px; resize: none;
}
.abechat-start input:focus, .abechat-start textarea:focus, .abechat-compose textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(94, 159, 31, .15); }
.abechat-hint, .abechat-privacy { font-size: 12px; color: var(--muted); margin: -4px 0 0; line-height: 1.45; }
.abechat-privacy { margin: 0; }
.abechat-privacy a { color: var(--brand); text-decoration: underline; }
.abechat-submit { justify-content: center; width: 100%; }
.abechat-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }

.abechat-notice { padding: 9px 14px; font-size: 13px; background: #fef3c7; color: #92400e; border-top: 1px solid #fde68a; }
.abechat-notice.error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.abechat-notice.info { background: #f3f9ec; color: #3f6b12; border-color: #d9ebc4; }

.abechat-compose { border-top: 1px solid var(--line); background: #fff; padding: 10px; }
.abechat-row { display: flex; align-items: flex-end; gap: 8px; }
.abechat-compose textarea { flex: 1; min-width: 0; max-height: 120px; padding: 9px 12px; }
.abechat-attach, .abechat-send { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; cursor: pointer; }
.abechat-attach { color: var(--muted); position: relative; overflow: hidden; }
.abechat-attach:hover { background: var(--surface-2); color: var(--text); }
.abechat-attach input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.abechat-send { border: 0; background: var(--brand); color: #fff; }
.abechat-send:disabled { opacity: .55; cursor: default; }
.abechat-file { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; padding: 5px 6px 5px 12px; border-radius: 999px; background: var(--surface-2); font-size: 13px; max-width: 100%; width: max-content; }
.abechat-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.abechat-file button { border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; }

@media (max-width: 560px) {
    .abechat-launcher { right: 16px; width: 56px; height: 56px; }
    .abechat-panel { inset: 0; width: auto; max-width: none; height: auto; border-radius: 0; border: 0; }
    .abechat-open .abechat-launcher { display: none; }
    html.abechat-lock, html.abechat-lock body { overflow: hidden; }
    .abechat-msg { max-width: 90%; }
    .abechat-img img { max-width: 200px; }
}
@media (prefers-reduced-motion: reduce) { .abechat-panel { animation: none; } .abechat-launcher { transition: none; } }
@media print { .abechat { display: none; } }
