:root{
  --tasii-chat-navy:#000d21;
  --tasii-chat-blue:#0872cb;
  --tasii-chat-blue-dark:#055c9f;
  --tasii-chat-ink:#162536;
  --tasii-chat-muted:#667786;
  --tasii-chat-line:#dbe4ec;
  --tasii-chat-soft:#f6f8fa;
}

.tasii-assistant{
  position:fixed;
  right:14px;
  bottom:14px;
  z-index:10000;
  width:var(--tasii-launcher-width,89px);
  height:calc(var(--tasii-launcher-height,56px) + 4px);
  pointer-events:none;
  overflow:visible;
  font-family:Inter,Arial,sans-serif;
}

.tasii-assistant button,
.tasii-assistant textarea{
  font:inherit;
}

/* Do not allow author CSS to override the HTML hidden state. This prevents
   the full launcher/mascot remaining visible behind the minimised button. */
.tasii-assistant-launcher[hidden],
.tasii-assistant-dismiss[hidden],
.tasii-assistant-minimised[hidden],
.tasii-assistant-panel[hidden]{
  display:none!important;
}

/* Homer-style compact white pill. The transparent favicon floats above it,
   rather than sitting in a square inside the button. */
.tasii-assistant-launcher{
  position:absolute;
  left:0;
  bottom:0;
  z-index:2;
  display:block;
  width:var(--tasii-launcher-width,89px);
  height:var(--tasii-launcher-height,56px);
  padding:0;
  overflow:visible;
  border:0;
  border-radius:21px;
  background:transparent;
  color:var(--tasii-chat-ink);
  box-shadow:0 12px 31px rgba(0,13,33,.18);
  cursor:pointer;
  pointer-events:auto;
  text-align:left;
  transition:transform .16s ease,box-shadow .16s ease,border-color .16s ease;
}
.tasii-assistant-launcher::before{
  content:"";
  position:absolute;
  inset:0;
  z-index:2;
  border:1px solid rgba(0,13,33,.16);
  border-radius:21px;
  background:#fff;
  box-shadow:0 12px 31px rgba(0,13,33,.18);
  pointer-events:none;
}
.tasii-assistant-launcher:hover,
.tasii-assistant-launcher:focus-visible{
  transform:translateY(-2px);
  box-shadow:none;
}
.tasii-assistant-launcher:hover::before,
.tasii-assistant-launcher:focus-visible::before{
  border-color:rgba(17,140,244,.38);
  box-shadow:0 16px 36px rgba(0,13,33,.22);
}

.tasii-assistant-launcher-image{
  position:absolute;
  left:50%;
  bottom:calc(var(--tasii-launcher-height,56px) - 8px);
  z-index:1;
  display:block;
  width:88px;
  height:88px;
  overflow:visible;
  border:0;
  border-radius:0;
  background:transparent;
  transform:translateX(-50%);
  pointer-events:none;
}
.tasii-assistant-launcher-image img{
  display:block;
  width:88px;
  height:88px;
  max-width:none;
  object-fit:contain;
  object-position:center bottom;
  background:transparent;
  border:0;
  border-radius:0;
  filter:drop-shadow(0 5px 5px rgba(0,13,33,.16));
}

.tasii-assistant-launcher-copy{
  position:absolute;
  inset:0;
  z-index:3;
  display:flex;
  align-items:center;
  justify-content:center;
  min-width:0;
  pointer-events:none;
  transform:translate(var(--tasii-launcher-text-x,0px),var(--tasii-launcher-text-y,0px));
}
.tasii-assistant-launcher-copy strong{
  color:var(--tasii-chat-navy);
  font-family:Constantia,Georgia,serif;
  font-size:.82rem;
  font-weight:700;
  line-height:1;
  text-align:center;
  white-space:nowrap;
}
.tasii-assistant-launcher-copy small{
  display:none;
}

.tasii-assistant-dismiss{
  position:absolute;
  right:var(--tasii-launcher-x-right,4px);
  bottom:var(--tasii-launcher-x-bottom,17px);
  top:auto;
  z-index:5;
  display:inline-grid;
  place-items:center;
  width:24px;
  height:24px;
  padding:0;
  border:0;
  border-radius:50%;
  background:transparent;
  color:#75838d;
  font-size:1rem;
  line-height:1;
  cursor:pointer;
  pointer-events:auto;
}
.tasii-assistant-dismiss:hover,
.tasii-assistant-dismiss:focus-visible{
  color:var(--tasii-chat-blue-dark);
}

/* Minimized state is just the transparent TASII favicon, not another pill
   or a coloured circle. */
.tasii-assistant-minimised{
  position:absolute;
  right:0;
  bottom:0;
  z-index:6;
  display:block;
  width:62px;
  height:62px;
  padding:0;
  overflow:visible;
  border:0;
  border-radius:0;
  background:transparent;
  box-shadow:none;
  cursor:pointer;
  pointer-events:auto;
}
.tasii-assistant-minimised img{
  display:block;
  width:62px;
  height:62px;
  object-fit:contain;
  background:transparent;
  border:0;
  border-radius:0;
  filter:drop-shadow(0 5px 6px rgba(0,13,33,.24));
}

/* Panel */
.tasii-assistant-panel{
  position:fixed;
  right:14px;
  bottom:92px;
  z-index:10001;
  display:grid;
  grid-template-rows:auto minmax(0,1fr) auto auto;
  width:min(400px,calc(100vw - 28px));
  height:min(620px,calc(100dvh - 112px));
  max-height:620px;
  overflow:hidden;
  border:1px solid var(--tasii-chat-line);
  border-radius:18px;
  background:#fff;
  color:var(--tasii-chat-ink);
  box-shadow:0 24px 70px rgba(0,13,33,.30);
  pointer-events:auto;
}

.tasii-assistant-header{
  min-height:70px;
  padding:10px 12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  background:var(--tasii-chat-navy);
  color:#fff;
}
.tasii-assistant-identity{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}
.tasii-assistant-identity img{
  display:block;
  width:50px;
  height:50px;
  object-fit:contain;
  border:0;
  border-radius:0;
  background:transparent;
  filter:drop-shadow(0 3px 3px rgba(0,0,0,.2));
}
.tasii-assistant-identity h2{
  margin:0;
  color:#fff;
  font-family:Constantia,Georgia,serif;
  font-size:1.3rem;
  line-height:1.05;
}
.tasii-assistant-identity p{
  margin:4px 0 0;
  color:#bdd0df;
  font-size:.74rem;
  line-height:1.2;
}
.tasii-assistant-close{
  flex:0 0 auto;
  width:36px;
  height:36px;
  padding:0;
  border:0;
  background:transparent;
  color:#fff;
  font-size:1.8rem;
  line-height:1;
  cursor:pointer;
}

.tasii-assistant-messages{
  min-height:0;
  overflow:auto;
  padding:15px;
  background:var(--tasii-chat-soft);
  overscroll-behavior:contain;
}
.tasii-assistant-message{
  display:flex;
  align-items:flex-end;
  gap:8px;
  margin-bottom:11px;
}
.tasii-assistant-message.is-user{
  justify-content:flex-end;
}
.tasii-assistant-message-avatar{
  flex:0 0 auto;
  display:block;
  width:34px;
  height:34px;
  border:0;
  border-radius:0;
  object-fit:contain;
  background:transparent;
  filter:drop-shadow(0 2px 2px rgba(0,13,33,.15));
}
.tasii-assistant-message-bubble{
  max-width:84%;
  padding:10px 12px;
  border-radius:13px;
  font-size:.88rem;
  line-height:1.45;
  overflow-wrap:anywhere;
}
.tasii-assistant-message.is-assistant .tasii-assistant-message-bubble{
  background:#fff;
  border:1px solid var(--tasii-chat-line);
  border-bottom-left-radius:4px;
}
.tasii-assistant-message.is-user .tasii-assistant-message-bubble{
  white-space:pre-wrap;
  background:var(--tasii-chat-navy);
  color:#fff;
  border-bottom-right-radius:4px;
}

/* Properly rendered assistant formatting. No visible Markdown asterisks. */
.tasii-assistant-message-bubble p{
  margin:0 0:.72em;
}
.tasii-assistant-message-bubble p:last-child{
  margin-bottom:0;
}
.tasii-assistant-message-bubble strong{
  font-weight:800;
}
.tasii-assistant-message-bubble ol,
.tasii-assistant-message-bubble ul{
  margin:.15em 0 .3em;
  padding-left:1.35em;
}
.tasii-assistant-message-bubble li{
  margin:0 0 .65em;
  padding-left:.12em;
}
.tasii-assistant-message-bubble li:last-child{
  margin-bottom:0;
}
.tasii-assistant-message-bubble a{
  color:#086fbe;
  font-weight:700;
  text-decoration:underline;
  text-underline-offset:2px;
}
.tasii-assistant-message.is-user .tasii-assistant-message-bubble a{
  color:#fff;
}

.tasii-assistant-suggestions{
  display:flex;
  gap:7px;
  overflow-x:auto;
  padding:9px 11px;
  border-top:1px solid #e6ebf0;
  background:#fff;
  scrollbar-width:none;
}
.tasii-assistant-suggestions::-webkit-scrollbar{
  display:none;
}
.tasii-assistant-suggestions button{
  flex:0 0 auto;
  min-height:34px;
  padding:7px 10px;
  border:1px solid #cfe0ed;
  border-radius:999px;
  background:#f5faff;
  color:#075f9f;
  font-size:.72rem;
  font-weight:750;
  cursor:pointer;
}
.tasii-assistant-suggestions button:hover{
  background:#eaf5ff;
}

.tasii-assistant-form{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:8px;
  padding:10px;
  border-top:1px solid #e2e8ee;
  background:#fff;
}
.tasii-assistant-form textarea{
  width:100%;
  min-height:44px;
  max-height:108px;
  resize:none;
  padding:10px 11px;
  border:1px solid #c9d5df;
  border-radius:9px;
  color:var(--tasii-chat-ink);
  background:#fff;
  line-height:1.35;
}
.tasii-assistant-form button{
  min-width:64px;
  min-height:44px;
  padding:0 14px;
  border:0;
  border-radius:9px;
  background:var(--tasii-chat-blue);
  color:#fff;
  font-size:.78rem;
  font-weight:800;
  cursor:pointer;
}
.tasii-assistant-form button:hover{
  background:var(--tasii-chat-blue-dark);
}
.tasii-assistant-form button:disabled{
  opacity:.6;
  cursor:wait;
}

.tasii-assistant-typing{
  display:inline-flex;
  gap:4px;
  align-items:center;
  min-height:18px;
}
.tasii-assistant-typing span{
  width:5px;
  height:5px;
  border-radius:50%;
  background:#80919f;
  animation:tasii-chat-dot 1s infinite ease-in-out;
}
.tasii-assistant-typing span:nth-child(2){animation-delay:.14s}
.tasii-assistant-typing span:nth-child(3){animation-delay:.28s}

@keyframes tasii-chat-dot{
  0%,70%,100%{transform:translateY(0);opacity:.45}
  35%{transform:translateY(-3px);opacity:1}
}

@media(max-width:520px){
  .tasii-assistant{
    right:10px;
    bottom:10px;
    width:var(--tasii-launcher-mobile-width,83px);
    height:calc(var(--tasii-launcher-mobile-height,54px) + 4px);
  }
  .tasii-assistant-launcher{
    width:var(--tasii-launcher-mobile-width,83px);
    height:var(--tasii-launcher-mobile-height,54px);
    border-radius:20px;
  }
  .tasii-assistant-launcher-image{
    bottom:calc(var(--tasii-launcher-mobile-height,54px) - 8px);
    width:82px;
    height:82px;
  }
  .tasii-assistant-launcher-image img{
    width:82px;
    height:82px;
  }
  .tasii-assistant-launcher-copy{
    inset:0;
    transform:translate(var(--tasii-launcher-mobile-text-x,0px),var(--tasii-launcher-mobile-text-y,0px));
  }
  .tasii-assistant-launcher-copy strong{
    font-size:.78rem;
  }
  .tasii-assistant-dismiss{
    right:var(--tasii-launcher-mobile-x-right,3px);
    bottom:var(--tasii-launcher-mobile-x-bottom,16px);
  }
  .tasii-assistant-panel{
    right:10px;
    bottom:82px;
    width:calc(100vw - 20px);
    height:min(610px,calc(100dvh - 96px));
    border-radius:16px;
  }
  .tasii-assistant-message-bubble{
    max-width:88%;
  }
}

@media(max-height:600px){
  .tasii-assistant-panel{
    top:8px;
    bottom:8px;
    height:auto;
    max-height:none;
  }
}

@media(prefers-reduced-motion:reduce){
  .tasii-assistant *{
    animation:none!important;
    transition:none!important;
  }
}
