/* Chat asisten NU Pelem — tombol melayang + panel */
.nai-fab {
    position: fixed;
    right: 18px;
    bottom: 20px;
    z-index: 1000001;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 0;
    background: #166534;
    color: #fff;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}
.nai-fab svg { width: 26px; height: 26px; }
.nai-fab:hover { background: #0c4523; }
.nai-panel {
    position: fixed;
    right: 18px;
    bottom: 160px;
    z-index: 1000002;
    width: min(360px, calc(100vw - 36px));
    height: min(500px, calc(100vh - 220px));
    min-height: 320px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.nai-panel[hidden] { display: none; }
.nai-phead {
    background: #166534;
    color: #fff;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.nai-phead b { display: block; font-size: 14px; }
.nai-phead span { display: block; font-size: 11px; opacity: 0.85; }
.nai-phead button {
    border: 0; background: rgba(255, 255, 255, 0.2); color: #fff;
    width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.nai-pbody { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.nai-msg {
    max-width: 88%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}
.nai-bot { background: #f1f5f2; color: #1c2420; align-self: flex-start; }
.nai-user { background: #166534; color: #fff; align-self: flex-end; }
.nai-msg a { color: #0c4523; font-weight: 700; }
.nai-user a { color: #fff; }
.nai-typing { opacity: 0.7; font-style: italic; }
.nai-chips { display: flex; gap: 6px; padding: 0 12px 8px; flex-wrap: wrap; }
.nai-chips button {
    border: 1px solid #166534; background: #fff; color: #166534;
    border-radius: 16px; padding: 5px 11px; font-size: 12px; cursor: pointer;
}
.nai-pform { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid #e6ebe8; }
.nai-pform input {
    flex: 1; border: 1px solid #cfd8d1; border-radius: 10px;
    padding: 9px 12px; font-size: 13.5px; font-family: inherit; min-width: 0;
}
.nai-pform button {
    border: 0; background: #166534; color: #fff; border-radius: 10px;
    width: 42px; cursor: pointer; font-size: 16px;
}
.nai-disc {
    font-size: 10px; color: #9aa5a0; text-align: center; padding: 0 12px 8px;
}
@media (max-width: 768px) {
    .nai-fab { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }
    .nai-panel { bottom: calc(214px + env(safe-area-inset-bottom, 0px)); }
}
html[data-theme="dark"] .nai-panel { background: #161e19; }
html[data-theme="dark"] .nai-bot { background: #1d2620; color: #e7ede9; }
html[data-theme="dark"] .nai-pform input { background: #0e1411; border-color: #263129; color: #e7ede9; }
html[data-theme="dark"] .nai-chips button { background: #161e19; }
