/* Product assistant widget (9-oct-2026). Independent of Tailwind's build. Brand blue = .kh-blue-bg (74,96,112). */
#kht-asst { --a-blue: rgb(74, 96, 112); --a-blue-d: rgb(54, 70, 82); --a-line: #dbe3e9; --a-bg: #f5f8fa; --a-text: #1f2a33; font-family: inherit; }
#kht-asst[hidden] { display: none; }
#kht-asst [hidden] { display: none !important; }

.kht-asst-launcher {
    position: fixed; right: max(1rem, env(safe-area-inset-right)); bottom: max(1rem, env(safe-area-inset-bottom)); z-index: 60;
    display: inline-flex; align-items: center; gap: .5rem;
    min-height: 48px; min-width: 48px; padding: 0 1rem 0 .9rem;
    background: var(--a-blue); color: #fff; border: 0; border-radius: 999px;
    box-shadow: 0 6px 18px rgba(20, 40, 55, .28); cursor: pointer; font-family: inherit; font-weight: 600; font-size: .95rem; line-height: 1;
}
.kht-asst-launcher:hover { background: var(--a-blue-d); }
.kht-asst-launcher:focus-visible, .kht-asst-panel button:focus-visible, .kht-asst-panel textarea:focus-visible, .kht-asst-panel a:focus-visible { outline: 3px solid #f2b705; outline-offset: 2px; }
/* Keep the back-to-top control above the launcher when the assistant is enabled. */
#kht-asst ~ #back-to-top { bottom: calc(max(1rem, env(safe-area-inset-bottom)) + 4rem); }
.kht-asst-launcher[aria-expanded="true"] { display: none; }

.kht-asst-panel {
    position: fixed; z-index: 70; display: flex; flex-direction: column;
    right: 1rem; bottom: 1rem; width: 400px; max-width: calc(100vw - 2rem);
    height: min(640px, calc(100dvh - 2rem)); background: #fff; color: var(--a-text);
    border: 1px solid var(--a-line); border-radius: 18px; box-shadow: 0 18px 50px rgba(15, 35, 50, .32); overflow: hidden;
}
@media (min-width: 640px) { .kht-asst-panel { right: 2rem; bottom: 2rem; } }
@media (max-width: 639.98px) {
    .kht-asst-panel { inset: 0; width: 100%; max-width: none; height: 100dvh; border-radius: 0; border: 0; }
}
.kht-asst-head { display: flex; align-items: center; gap: .25rem; padding: .75rem .5rem .75rem 1rem; background: var(--a-blue); color: #fff; }
.kht-asst-head-text { flex: 1; min-width: 0; }
.kht-asst-head h2 { margin: 0; font-family: inherit; font-weight: 700; font-size: 1.05rem; line-height: 1.2; color: #fff; display: flex; align-items: center; gap: .5rem; }
.kht-asst-head p { margin: .15rem 0 0; font-size: .8rem; opacity: .92; }
.kht-asst-badge { font-size: .68rem; font-weight: 700; padding: .12rem .4rem; border: 1px solid rgba(255,255,255,.7); border-radius: 6px; letter-spacing: .04em; }
.kht-asst-iconbtn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; background: transparent; color: #fff; border: 0; border-radius: 10px; cursor: pointer; }
.kht-asst-iconbtn:hover { background: rgba(255,255,255,.16); }

.kht-asst-body { flex: 1; min-height: 0; overflow-y: auto; background: var(--a-bg); padding: .9rem; display: flex; flex-direction: column; gap: .75rem; overscroll-behavior: contain; }
.kht-asst-log { display: flex; flex-direction: column; gap: .65rem; }
.kht-asst-msg { max-width: 92%; padding: .65rem .8rem; border-radius: 14px; font-size: .94rem; line-height: 1.45; word-wrap: break-word; overflow-wrap: anywhere; }
.kht-asst-msg.bot { align-self: flex-start; background: #fff; border: 1px solid var(--a-line); border-top-left-radius: 4px; }
.kht-asst-msg.user { align-self: flex-end; background: var(--a-blue); color: #fff; border-top-right-radius: 4px; white-space: pre-wrap; }
.kht-asst-msg.err { align-self: flex-start; background: #fff4f2; border: 1px solid #f0c4bc; color: #7a2418; }
.kht-asst-msg p { margin: 0 0 .45rem; } .kht-asst-msg p:last-child { margin-bottom: 0; }
.kht-asst-msg ul { margin: .2rem 0 .45rem 1.1rem; padding: 0; list-style: disc; }
.kht-asst-msg sup a { color: var(--a-blue-d); font-weight: 700; text-decoration: none; padding: 0 .1rem; }
.kht-asst-src { margin-top: .55rem; padding-top: .45rem; border-top: 1px dashed var(--a-line); font-size: .82rem; }
.kht-asst-src b { display: block; margin-bottom: .2rem; color: #4a5a66; font-weight: 600; }
.kht-asst-src a { display: block; color: var(--a-blue-d); text-decoration: underline; padding: .3rem 0; min-height: 44px; display: flex; align-items: center; }
.kht-asst-dots { display: inline-flex; gap: 4px; vertical-align: middle; margin-right: .4rem; }
.kht-asst-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--a-blue); animation: khtAsstDot 1s infinite ease-in-out; }
.kht-asst-dots i:nth-child(2) { animation-delay: .15s; } .kht-asst-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes khtAsstDot { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .kht-asst-dots i { animation: none; opacity: .7; } }
.kht-asst-sugg { display: flex; flex-direction: column; gap: .4rem; align-items: flex-start; }
.kht-asst-sugg button { text-align: left; background: #fff; color: var(--a-blue-d); border: 1px solid var(--a-line); border-radius: 12px; padding: .55rem .75rem; min-height: 44px; font-size: .88rem; cursor: pointer; }
.kht-asst-sugg button:hover { border-color: var(--a-blue); }

.kht-asst-notice { flex: none; background: #fff; border-top: 1px solid var(--a-line); padding: .45rem .9rem; font-size: .75rem; line-height: 1.4; color: #5a6a76; }
.kht-asst-notice a { color: var(--a-blue-d); text-decoration: underline; }
.kht-asst-secondary { min-height: 44px; padding: 0 .9rem; background: #fff; color: var(--a-blue-d); border: 1px solid var(--a-blue); border-radius: 10px; font-weight: 600; font-size: .85rem; cursor: pointer; white-space: nowrap; }
.kht-asst-mailrow { display: flex; align-items: center; gap: .6rem; padding: .5rem .9rem; background: #fff; border-top: 1px solid var(--a-line); font-size: .76rem; color: #5a6a76; }

.kht-asst-form { display: flex; align-items: flex-end; gap: .5rem; padding: .6rem .75rem; border-top: 1px solid var(--a-line); background: #fff; position: relative; }
.kht-asst-form textarea { flex: 1; resize: none; max-height: 7.5rem; min-height: 44px; padding: .65rem .75rem; border: 1px solid #b9c6cf; border-radius: 12px; font-family: inherit; font-size: 16px; line-height: 1.35; color: var(--a-text); background: #fff; }
.kht-asst-form textarea:disabled { background: #eef2f5; }
.kht-asst-send { width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--a-blue); color: #fff; border: 0; border-radius: 12px; cursor: pointer; }
.kht-asst-send:disabled { opacity: .45; cursor: not-allowed; }
.kht-asst-foot { margin: 0; padding: 0 .9rem .6rem; background: #fff; font-size: .72rem; color: #5a6a76; line-height: 1.35; }
.kht-asst-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.kht-asst-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media print { #kht-asst { display: none; } }

/* Requirements and review share the chat's bounded scroll area. */
.kht-asst-head, #kht-asst-actions, .kht-asst-form, .kht-asst-foot { flex-shrink: 0; }
.kht-asst-actions { display: flex; flex-wrap: wrap; gap: .4rem; padding: .6rem .75rem; }
.kht-asst-actions .kht-asst-secondary { white-space: normal; }
.kht-asst-workspace { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: .8rem; background: var(--a-bg); overscroll-behavior: contain; }
.kht-asst-workspace h3 { margin: .8rem 0 .4rem; font-size: 1.05rem; }
.kht-asst-workspace p { font-size: .85rem; line-height: 1.4; margin: .5rem 0; }
.kht-asst-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .65rem; }
.kht-asst-fields label { min-width: 0; }
.kht-asst-fields label:first-child, .kht-asst-fields label:last-child { grid-column: 1 / -1; }
.kht-asst-workspace label { display: block; font-size: .85rem; font-weight: 600; }
.kht-asst-workspace input, .kht-asst-workspace textarea { display: block; box-sizing: border-box; width: 100%; min-width: 0; padding: .6rem; margin-top: .25rem; border: 1px solid #b9c6cf; border-radius: 8px; background: #fff; color: var(--a-text); font: inherit; font-size: 16px; }
.kht-asst-workspace textarea { resize: vertical; min-height: 12rem; }
.kht-asst-workspace input:focus-visible { outline: 3px solid #f2b705; outline-offset: 2px; }
.kht-asst-workspace .kht-asst-actions { padding: .7rem 0; }
/* «Send til KH-Technic» (16-nov-2026): formulario vacío; la conversación va aparte en el correo. */
#kht-asst-enquiry > label:not(.kht-asst-check) { display: block; margin-bottom: .65rem; }
#kht-asst-enquiry input, #kht-asst-enquiry textarea { font-weight: 400; }
#kht-asst-enquiry .kht-asst-fields label:first-child, #kht-asst-enquiry .kht-asst-fields label:last-child { grid-column: auto; }
#kht-asst-enquiry textarea { min-height: 7rem; }
.kht-asst-workspace .kht-asst-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.kht-asst-workspace .kht-asst-check { display: flex; align-items: flex-start; gap: .5rem; margin-top: .75rem; font-weight: 400; line-height: 1.35; }
.kht-asst-workspace .kht-asst-check input { width: 1.15rem; height: 1.15rem; flex: 0 0 auto; margin: .1rem 0 0; padding: 0; accent-color: var(--a-blue); }
.kht-asst-check a { color: var(--a-blue-d); text-decoration: underline; }
.kht-asst-primary { min-height: 44px; padding: 0 1.4rem; background: var(--a-blue); color: #fff; border: 1px solid var(--a-blue); border-radius: 10px; font-weight: 700; font-size: .9rem; cursor: pointer; }
.kht-asst-primary:hover { background: var(--a-blue-d); }
.kht-asst-primary:disabled { opacity: .6; cursor: progress; }
#kht-asst-enquiry-status { font-weight: 600; }
