#ekorren-root{
  --ek-primary:#5c6f3b;--ek-primary-dark:#475629;--ek-accent:#F7B918;
  --ek-cream:#f6f0e7;--ek-text:#4b4b4b;--ek-head:#2f3a1d;--ek-line:#e7e0d3;--ek-bg:#f8f8f8;
  position:fixed;bottom:20px;z-index:99990;font-family:inherit;font-size:16px;line-height:1.5;color:var(--ek-text);
}
#ekorren-root.ek-left{left:20px}
#ekorren-root.ek-right{right:20px}
#ekorren-root *{box-sizing:border-box}
#ekorren-root button{font-family:inherit;cursor:pointer}

/* Launcher */
.ek-launcher{
  width:68px;height:68px;border-radius:50%;border:3px solid var(--ek-accent);background:var(--ek-cream);
  display:flex;align-items:center;justify-content:center;padding:0;
  box-shadow:0 6px 20px rgba(0,0,0,.25);transition:transform .2s ease,box-shadow .2s ease;
}
.ek-launcher:hover{transform:translateY(-2px) scale(1.05);box-shadow:0 10px 26px rgba(0,0,0,.3)}
.ek-launcher:focus-visible,.ek-icon-btn:focus-visible,.ek-send:focus-visible,.ek-chip:focus-visible,.ek-consent-btn:focus-visible{outline:3px solid var(--ek-accent);outline-offset:2px}
.ek-launcher img{height:46px;width:46px;object-fit:contain;display:block;pointer-events:none}
.ek-launcher.ek-pulse::after{
  content:"";position:absolute;inset:0;border-radius:50%;border:3px solid var(--ek-accent);
  animation:ek-pulse 2.4s ease-out 3;pointer-events:none;
}
.ek-launcher-wrap{position:relative}
@keyframes ek-pulse{0%{transform:scale(1);opacity:.8}100%{transform:scale(1.55);opacity:0}}
#ekorren-root.ek-open .ek-launcher-wrap{display:none}

/* Nudge */
.ek-nudge{
  position:absolute;bottom:80px;width:max-content;max-width:240px;background:#fff;border:1px solid var(--ek-line);border-radius:14px;
  padding:10px 30px 10px 14px;box-shadow:0 8px 24px rgba(0,0,0,.16);color:var(--ek-head);font-size:15px;
  animation:ek-in .3s ease;
}
.ek-left .ek-nudge{left:0}.ek-right .ek-nudge{right:0}
.ek-nudge button{position:absolute;top:4px;right:6px;border:0;background:none;color:#9a9a9a;font-size:18px;line-height:1;padding:2px 4px}
.ek-nudge[hidden]{display:none}
.ek-nudge span{cursor:pointer}
.ek-nudge::after{content:"";position:absolute;bottom:-6px;width:12px;height:12px;background:#fff;border-right:1px solid var(--ek-line);border-bottom:1px solid var(--ek-line);transform:rotate(45deg)}
.ek-left .ek-nudge::after{left:28px}.ek-right .ek-nudge::after{right:28px}

/* Paneel */
.ek-panel{
  position:absolute;bottom:0;width:390px;max-width:calc(100vw - 24px);height:min(660px,calc(100dvh - 40px));
  background:#fff;border-radius:16px;box-shadow:0 18px 50px rgba(0,0,0,.3);display:flex;flex-direction:column;overflow:hidden;
  opacity:0;transform:translateY(14px) scale(.98);pointer-events:none;visibility:hidden;transition:opacity .22s ease,transform .22s ease,visibility .22s;
}
.ek-left .ek-panel{left:0;transform-origin:bottom left}
.ek-right .ek-panel{right:0;transform-origin:bottom right}
#ekorren-root.ek-open .ek-panel{opacity:1;transform:none;pointer-events:auto;visibility:visible}

.ek-head{background:var(--ek-primary);color:#fff;padding:14px 12px 14px 16px;display:flex;align-items:center;gap:12px;position:relative}
.ek-head::after{content:"";position:absolute;left:0;right:0;bottom:0;height:4px;background:linear-gradient(90deg,var(--ek-accent),var(--ek-primary))}
.ek-avatar{width:46px;height:46px;border-radius:50%;background:var(--ek-cream);border:2px solid var(--ek-accent);display:flex;align-items:center;justify-content:center;flex:none}
.ek-avatar img{height:32px;width:32px;object-fit:contain;display:block}
.ek-title{flex:1;min-width:0}
.ek-title strong{display:block;font-size:18px;font-weight:700;letter-spacing:.01em}
.ek-title span{display:block;font-size:13px;opacity:.88;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ek-icon-btn{width:34px;height:34px;border-radius:8px;border:0;background:transparent;color:#fff;display:flex;align-items:center;justify-content:center;padding:0;opacity:.9}
.ek-icon-btn:hover{background:rgba(255,255,255,.16);opacity:1}
.ek-icon-btn svg{width:18px;height:18px}

/* Berichten */
.ek-messages{flex:1;overflow-y:auto;padding:16px 14px 8px;background:var(--ek-bg);display:flex;flex-direction:column;gap:12px;scroll-behavior:smooth}
.ek-row{display:flex;gap:8px;align-items:flex-end;animation:ek-in .25s ease}
.ek-row.ek-user{justify-content:flex-end}
@keyframes ek-in{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.ek-mini{width:30px;height:30px;border-radius:50%;background:var(--ek-cream);border:1.5px solid var(--ek-accent);display:flex;align-items:center;justify-content:center;flex:none}
.ek-mini img{height:21px;width:21px;object-fit:contain}
.ek-bubble{max-width:82%;padding:10px 13px;border-radius:14px;word-wrap:break-word;overflow-wrap:anywhere;font-size:15.5px}
.ek-bot .ek-bubble{background:#fff;border:1px solid var(--ek-line);border-bottom-left-radius:4px;color:var(--ek-text)}
.ek-user .ek-bubble{background:var(--ek-primary);color:#fff;border-bottom-right-radius:4px}
.ek-error .ek-bubble{background:#fef2f2;border-color:#fecaca;color:#991b1b}
.ek-bubble p{margin:0 0 8px}.ek-bubble p:last-child{margin-bottom:0}
.ek-bubble ul,.ek-bubble ol{margin:0 0 8px;padding-left:20px}.ek-bubble li{margin:2px 0}
.ek-bubble a{color:var(--ek-primary);text-decoration:underline;text-underline-offset:2px;font-weight:700}
.ek-user .ek-bubble a{color:#fff}
.ek-bubble strong{color:var(--ek-head)}.ek-user .ek-bubble strong{color:#fff}
.ek-sources{display:flex;flex-wrap:wrap;gap:6px;margin:6px 0 0 38px}
.ek-sources a{font-size:13px;text-decoration:none;color:var(--ek-primary);border:1px solid var(--ek-accent);background:#fffdf3;border-radius:999px;padding:2px 10px;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ek-sources a:hover{background:var(--ek-accent);color:#3a2f00}

.ek-typing{display:flex;gap:4px;padding:4px 2px}
.ek-typing i{width:7px;height:7px;border-radius:50%;background:var(--ek-accent);animation:ek-bounce 1.1s infinite ease-in-out}
.ek-typing i:nth-child(2){animation-delay:.15s}.ek-typing i:nth-child(3){animation-delay:.3s}
@keyframes ek-bounce{0%,60%,100%{transform:translateY(0);opacity:.5}30%{transform:translateY(-5px);opacity:1}}

.ek-chips{display:flex;flex-wrap:wrap;gap:8px;padding:0 14px 10px;background:var(--ek-bg)}
.ek-chip{border:1px solid var(--ek-primary);background:#fff;color:var(--ek-primary);border-radius:999px;padding:6px 12px;font-size:14px;transition:background .15s,color .15s}
.ek-chip:hover{background:var(--ek-primary);color:#fff}

/* Toestemming */
.ek-consent{padding:18px 16px;background:var(--ek-bg);border-top:1px solid var(--ek-line);font-size:14.5px}
.ek-consent p{margin:0 0 12px}
.ek-consent a{color:var(--ek-primary);font-weight:700}
.ek-consent-btn{display:block;width:100%;border:0;border-radius:10px;background:var(--ek-primary);color:#fff;padding:11px 14px;font-size:15.5px;font-weight:700;transition:background .15s}
.ek-consent-btn:hover{background:var(--ek-primary-dark)}
.ek-consent[hidden],.ek-form[hidden],.ek-note[hidden]{display:none}

/* Invoer */
.ek-form{display:flex;align-items:flex-end;gap:8px;padding:10px 12px;border-top:1px solid var(--ek-line);background:#fff}
.ek-input{flex:1;resize:none;border:1px solid #d3d3d3;border-radius:10px;padding:10px 12px;font:inherit;font-size:15.5px;color:var(--ek-head);max-height:110px;min-height:42px;background:#fff;outline:none}
.ek-input:focus{border-color:var(--ek-primary);box-shadow:0 0 0 3px rgba(92,111,59,.2)}
.ek-send{width:42px;height:42px;border-radius:10px;border:0;background:var(--ek-primary);color:var(--ek-accent);display:flex;align-items:center;justify-content:center;padding:0;flex:none;transition:background .15s,opacity .15s}
.ek-send:hover{background:var(--ek-primary-dark)}
.ek-send:disabled{opacity:.45;cursor:not-allowed}
.ek-send svg{width:20px;height:20px}
.ek-note{padding:0 14px 10px;background:#fff;color:#6b6b6b;font-size:12px;line-height:1.4}

/* Mobiel */
@media (max-width:520px){
  #ekorren-root{bottom:14px}
  #ekorren-root.ek-left{left:14px}#ekorren-root.ek-right{right:14px}
  .ek-panel{position:fixed;inset:0;width:100%;max-width:none;height:100dvh;border-radius:0}
  .ek-nudge{max-width:200px}
}
@media (prefers-reduced-motion:reduce){
  #ekorren-root *,#ekorren-root *::after{animation:none!important;transition:none!important}
}
