/* APCO Assistant chat widget */
.apco-chat { --ac-g: #56a846; --ac-gd: #3f7d33; --ac-ink: #15181d; --ac-body: #4a5059; --ac-line: #e3e8e0; font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.5; }
.apco-chat *, .apco-chat *::before, .apco-chat *::after { box-sizing: border-box; }
.apco-chat [hidden] { display: none !important; }

.apco-chat__launcher { position: fixed; left: 20px; bottom: 20px; z-index: 9990; width: 62px; height: 62px; border: 0; border-radius: 50%; background: linear-gradient(145deg, #6cc05a, var(--ac-gd)); color: #fff; cursor: pointer; box-shadow: 0 10px 28px rgba(63, 125, 51, .45); display: grid; place-items: center; transition: transform .2s; animation: apco-chat-pop .5s cubic-bezier(.22, 1.4, .36, 1) both .6s; }
.apco-chat__launcher::after { content: ''; position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 0 rgba(86, 168, 70, .5); animation: apco-chat-ring 2.6s ease-out infinite 2s; }
.apco-chat__launcher:hover { transform: scale(1.06); }
.apco-chat__launcher svg { width: 30px; height: 30px; }
.apco-chat__launcher-close { display: none; font-size: 34px; line-height: 1; }
.apco-chat.is-open .apco-chat__launcher svg { display: none; }
.apco-chat.is-open .apco-chat__launcher-close { display: block; }
.apco-chat.is-open .apco-chat__launcher::after { animation: none; }

.apco-chat__nudge { position: fixed; left: 20px; bottom: 94px; z-index: 9990; max-width: 240px; padding: 12px 34px 12px 14px; background: #fff; color: var(--ac-ink); border-radius: 16px 16px 16px 4px; box-shadow: 0 12px 30px rgba(0, 0, 0, .16); font-weight: 600; font-size: 14px; cursor: pointer; animation: apco-chat-rise .4s ease-out both; }
.apco-chat__nudge-x { position: absolute; top: 4px; right: 6px; border: 0; background: none; font-size: 18px; color: #8a929b; cursor: pointer; }

.apco-chat__panel { position: fixed; left: 20px; bottom: 94px; z-index: 9991; width: 380px; max-width: calc(100vw - 24px); height: 600px; max-height: calc(100vh - 120px); display: flex; flex-direction: column; background: #f6f8f5; border-radius: 22px; overflow: hidden; box-shadow: 0 24px 60px rgba(15, 30, 15, .28); animation: apco-chat-rise .32s cubic-bezier(.22, 1, .36, 1) both; }
.apco-chat__head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 16px 18px; background: linear-gradient(135deg, #2f6b2a, var(--ac-g)); color: #fff; }
.apco-chat__avatar { width: 42px; height: 42px; border-radius: 50%; background: #fff; padding: 5px; object-fit: contain; flex: none; }
.apco-chat__head strong { display: block; font-size: 16px; color: #fff; }
.apco-chat__head span { font-size: 12.5px; opacity: .92; display: flex; align-items: center; gap: 6px; }
.apco-chat__head span i { width: 8px; height: 8px; border-radius: 50%; background: #b8f59a; box-shadow: 0 0 0 3px rgba(184, 245, 154, .3); }
.apco-chat__close { margin-left: auto; border: 0; background: rgba(255, 255, 255, .16); color: #fff; width: 34px; height: 34px; border-radius: 50%; font-size: 22px; line-height: 1; cursor: pointer; }

.apco-chat__log { flex: 1; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.apco-chat__msg { display: flex; flex-direction: column; gap: 6px; max-width: 88%; animation: apco-chat-rise .25s ease-out both; }
.apco-chat__msg--bot { align-self: flex-start; }
.apco-chat__msg--user { align-self: flex-end; align-items: flex-end; }
.apco-chat__bubble { padding: 10px 13px; border-radius: 16px 16px 16px 4px; background: #fff; color: var(--ac-body); box-shadow: 0 1px 2px rgba(0, 0, 0, .06); white-space: pre-line; word-wrap: break-word; }
.apco-chat__bubble strong { color: var(--ac-ink); }
.apco-chat__msg--user .apco-chat__bubble { background: var(--ac-g); color: #fff; border-radius: 16px 16px 4px 16px; }
.apco-chat__bubble--soft { background: #eaf5e5; color: var(--ac-gd); font-weight: 600; font-size: 14px; }
.apco-chat__links { display: flex; flex-direction: column; gap: 5px; }
.apco-chat__links a { display: block; padding: 8px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--ac-line); color: var(--ac-gd); font-weight: 600; font-size: 14px; text-decoration: none; }
.apco-chat__links a:hover { border-color: var(--ac-g); background: #f2faef; }
.apco-chat__links--grid { flex-direction: row; flex-wrap: wrap; }
.apco-chat__links--grid a { padding: 5px 10px; font-size: 13px; border-radius: 999px; }
.apco-chat__actions, .apco-chat__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.apco-chat__actions button, .apco-chat__actions a, .apco-chat__chips button { border: 1.5px solid var(--ac-g); background: #fff; color: var(--ac-gd); font: inherit; font-size: 13.5px; font-weight: 600; padding: 7px 12px; border-radius: 999px; cursor: pointer; text-decoration: none; transition: background .15s, color .15s; }
.apco-chat__actions button:hover, .apco-chat__actions a:hover, .apco-chat__chips button:hover { background: var(--ac-g); color: #fff; }
.apco-chat__actions a.is-wa { border-color: #25d366; color: #128c4b; }
.apco-chat__actions a.is-wa:hover { background: #25d366; color: #fff; }

.apco-chat__typing .apco-chat__bubble { display: flex; gap: 4px; padding: 13px 14px; }
.apco-chat__typing i { width: 7px; height: 7px; border-radius: 50%; background: #a6b0a2; animation: apco-chat-dot 1s infinite; }
.apco-chat__typing i:nth-child(2) { animation-delay: .15s; }
.apco-chat__typing i:nth-child(3) { animation-delay: .3s; }

.apco-chat__lead { align-self: stretch; max-width: none; background: #fff; border: 1px solid var(--ac-line); border-radius: 16px; padding: 12px; gap: 8px; }
.apco-chat__lead p { margin: 0; color: var(--ac-ink); font-weight: 600; }
.apco-chat__lead input { width: 100%; padding: 9px 12px; border: 1px solid #d5dcd2; border-radius: 10px; font: inherit; font-size: 14px; }
.apco-chat__lead input:focus { outline: 2px solid rgba(86, 168, 70, .35); border-color: var(--ac-g); }
.apco-chat__lead button { border: 0; border-radius: 999px; padding: 10px; background: var(--ac-g); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.apco-chat__lead button:disabled { opacity: .7; }
.apco-chat__lead.is-done { background: #eef8ea; border-color: #cfe8c5; }
.apco-chat__err { color: #c0392b; font-size: 13px; }
.apco-chat__hp { position: absolute; left: -9999px; }

.apco-chat__form { display: flex; gap: 8px; padding: 10px 12px; background: #fff; border-top: 1px solid var(--ac-line); }
.apco-chat__form input { flex: 1; border: 1px solid #d5dcd2; border-radius: 999px; padding: 11px 16px; font: inherit; font-size: 15px; min-width: 0; }
.apco-chat__form input:focus { outline: 2px solid rgba(86, 168, 70, .3); border-color: var(--ac-g); }
.apco-chat__form button { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--ac-g); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.apco-chat__form button svg { width: 20px; height: 20px; }
.apco-chat__foot { display: flex; justify-content: center; gap: 22px; padding: 2px 12px 11px; background: #fff; }
.apco-chat__foot a { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ac-gd); text-decoration: none; }
.apco-chat__foot a:hover { text-decoration: underline; }
.apco-chat__foot a.is-wa { color: #128c4b; }
.apco-chat__foot svg { width: 15px; height: 15px; flex: none; }

@keyframes apco-chat-pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes apco-chat-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes apco-chat-ring { 0% { box-shadow: 0 0 0 0 rgba(86, 168, 70, .5); } 80%, 100% { box-shadow: 0 0 0 18px rgba(86, 168, 70, 0); } }
@keyframes apco-chat-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

@media (max-width: 480px) {
	.apco-chat__launcher { left: 14px; bottom: 14px; width: 56px; height: 56px; }
	.apco-chat__nudge { left: 14px; bottom: 80px; }
	.apco-chat__panel { left: 0; right: 0; bottom: 0; width: 100vw; max-width: none; height: 100%; max-height: none; border-radius: 0; }
	.apco-chat.is-open .apco-chat__launcher { display: none; }
}
@media (prefers-reduced-motion: reduce) {
	.apco-chat *, .apco-chat__launcher, .apco-chat__launcher::after { animation: none !important; transition: none !important; }
}
