/* 1084 Portal chatbot + PWA install UI: authenticated mobile viewport pin */
#nictm-chatbot-root{
  position:fixed!important;
  right:16px!important;
  bottom:16px!important;
  top:auto!important;
  left:auto!important;
  width:auto!important;
  height:auto!important;
  max-width:calc(100vw - 32px)!important;
  max-height:calc(100vh - 32px)!important;
  z-index:2147483646!important;
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color:#0f172a;
  pointer-events:none!important;
  isolation:isolate!important;
  contain:none!important;
  overflow:visible!important;
  transform:none!important;
  translate:none!important;
  margin:0!important;
}

/* Body-direct dock wins over sticky header/sidebar shells. */
html body > #nictm-chatbot-root,
html body > #nictm-chatbot-root.nictm-chatbot-docked{
  position:fixed!important;
  right:16px!important;
  bottom:16px!important;
  top:auto!important;
  left:auto!important;
  transform:none!important;
  translate:none!important;
  z-index:2147483646!important;
  margin:0!important;
}

/* 1084: On authenticated mobile pages JS uses explicit viewport top/left.
   This avoids old Android/WebView fixed-bottom bugs caused by h-screen/overflow shells. */
html body > #nictm-chatbot-root[data-viewport-pinned="1"]{
  position:fixed!important;
  left:var(--nictm-chatbot-left,calc(100vw - 72px))!important;
  top:var(--nictm-chatbot-top,calc(100vh - 76px))!important;
  right:auto!important;
  bottom:auto!important;
  contain:none!important;
  overflow:visible!important;
}

html body > #nictm-chatbot-root .nictm-chatbot-panel{
  position:fixed!important;
  right:16px!important;
  bottom:86px!important;
  top:auto!important;
  left:auto!important;
  transform:none!important;
  translate:none!important;
}


/* 1084: the open panel is docked as a BODY child, separate from the small launcher. */
html body > .nictm-chatbot-panel[data-nictm-chatbot-panel]{
  position:fixed!important;
  z-index:2147483646!important;
  transform:none!important;
  translate:none!important;
  contain:none!important;
}
html body > .nictm-chatbot-panel[data-nictm-chatbot-panel][data-viewport-pinned="1"],
html body > .nictm-chatbot-panel[data-nictm-chatbot-panel].is-open[data-viewport-pinned="1"]{
  left:var(--nictm-chatbot-panel-left,12px)!important;
  top:var(--nictm-chatbot-panel-top,24px)!important;
  right:auto!important;
  bottom:auto!important;
  width:var(--nictm-chatbot-panel-width,calc(100vw - 24px))!important;
  max-width:var(--nictm-chatbot-panel-width,calc(100vw - 24px))!important;
  max-height:var(--nictm-chatbot-panel-max-height,calc(100vh - 112px))!important;
  min-width:0!important;
}

/* If any stale/unmanaged copy somehow remains in layout sections, hide it. */
header #nictm-chatbot-root,
.mp-sidebar #nictm-chatbot-root,
#mp-main #nictm-chatbot-root{
  display:none!important;
}

#nictm-chatbot-root *, .nictm-chatbot-panel, .nictm-chatbot-panel *{box-sizing:border-box}

/* 1084: force chatbot text colors because dark login shells set body text to white.
   Without this, bot answers were present in the DOM/API 200 response but invisible
   inside the light grey assistant bubbles on the public login page. */
.nictm-chatbot-panel{color:#0f172a!important}
.nictm-chatbot-panel .nictm-chatbot-messages,
.nictm-chatbot-panel .nictm-chatbot-quick,
.nictm-chatbot-panel .nictm-chatbot-form{color:#0f172a!important}
.nictm-chatbot-panel .nictm-msg-bot{color:#0f172a!important;background:#f1f5f9;border:1px solid #e2e8f0}
.nictm-chatbot-panel .nictm-msg-bot .nictm-msg-title,
.nictm-chatbot-panel .nictm-msg-bot div:not(.nictm-links):not(.nictm-msg-source){color:#0f172a!important}
.nictm-chatbot-panel .nictm-msg-user{color:#fff!important}
.nictm-chatbot-panel .nictm-msg-user div{color:#fff!important}
.nictm-chatbot-panel .nictm-chatbot-input{color:#0f172a!important;background:#fff!important}
.nictm-chatbot-panel .nictm-chatbot-input::placeholder{color:#94a3b8!important}
.nictm-chatbot-button,.nictm-chatbot-panel{pointer-events:auto!important}
.nictm-chatbot-button{
  position:relative!important;
  min-width:3.6rem;
  width:3.6rem;
  min-height:3.6rem;
  height:3.6rem;
  border-radius:999px!important;
  border:0!important;
  background:linear-gradient(135deg,#0B830B,#050570)!important;
  color:#fff!important;
  font-weight:900;
  box-shadow:0 18px 42px rgba(15,23,42,.32)!important;
  display:flex!important;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  transition:transform .16s ease,box-shadow .16s ease,background .16s ease;
  line-height:1;
  z-index:2147483647!important;
  visibility:visible!important;
  opacity:1!important;
}
.nictm-chatbot-button:hover{transform:translateY(-1px);box-shadow:0 24px 52px rgba(15,23,42,.38)!important}
#nictm-chatbot-root.is-open .nictm-chatbot-button{display:flex!important;background:linear-gradient(135deg,#6B1611,#050570)!important}
.nictm-chatbot-button:focus{outline:none;box-shadow:0 0 0 4px rgba(14,165,233,.22),0 20px 52px rgba(15,23,42,.32)!important}
.nictm-chatbot-icon{font-size:1.35rem;display:block}
.nictm-chatbot-label{display:none}
.nictm-chatbot-dot{position:absolute;right:.25rem;top:.25rem;width:.9rem;height:.9rem;border-radius:999px;background:#22c55e;border:2px solid #fff}
#nictm-chatbot-root.is-open .nictm-chatbot-dot{display:none!important}

.nictm-chatbot-panel{
  position:fixed!important;
  right:16px!important;
  bottom:86px!important;
  top:auto!important;
  left:auto!important;
  width:400px;
  max-width:calc(100vw - 32px);
  max-height:calc(100vh - 112px);
  display:none;
  overflow:hidden;
  border-radius:1.4rem;
  background:rgba(255,255,255,.98);
  color:#0f172a!important;
  border:1px solid rgba(226,232,240,.95);
  box-shadow:0 30px 80px rgba(15,23,42,.3);
  z-index:2147483646!important;
}
.nictm-chatbot-panel.is-open{display:flex!important;flex-direction:column!important}
.nictm-chatbot-head{padding:1rem 1rem .85rem;background:linear-gradient(135deg,#07142f,#0B5C7A);color:#fff;display:flex;align-items:center;justify-content:space-between;gap:.75rem}
.nictm-chatbot-title{font-size:.95rem;font-weight:900;letter-spacing:-.015em}
.nictm-chatbot-subtitle{font-size:.75rem;color:rgba(226,232,240,.82);margin-top:.15rem}
.nictm-chatbot-close{border:0;background:rgba(255,255,255,.12);color:#fff;width:2rem;height:2rem;border-radius:.8rem;cursor:pointer;font-weight:900}
.nictm-chatbot-messages{padding:1rem;overflow-y:auto;display:flex;flex-direction:column;gap:.75rem;min-height:14rem}
.nictm-msg{max-width:88%;border-radius:1.05rem;padding:.75rem .85rem;font-size:.88rem;line-height:1.45}
.nictm-msg-bot{align-self:flex-start;background:#f1f5f9;border:1px solid #e2e8f0}
.nictm-msg-user{align-self:flex-end;background:#0B830B;color:#fff}
.nictm-msg-title{font-weight:900;margin-bottom:.25rem}
.nictm-links{display:flex;flex-wrap:wrap;gap:.45rem;margin-top:.65rem}
.nictm-links a{font-size:.76rem;font-weight:850;text-decoration:none;border-radius:999px;padding:.38rem .62rem;background:#fff;border:1px solid #cbd5e1;color:#0f172a}
.nictm-chatbot-quick{padding:0 1rem .85rem;display:flex;gap:.45rem;flex-wrap:wrap}
.nictm-chip{border:1px solid #dbe3ef;background:#fff;border-radius:999px;padding:.45rem .65rem;font-size:.76rem;font-weight:850;color:#334155;cursor:pointer}
.nictm-chatbot-form{border-top:1px solid #e2e8f0;padding:.75rem;display:flex;gap:.5rem;background:#fff}
.nictm-chatbot-input{flex:1;min-width:0;border:1px solid #cbd5e1;border-radius:1rem;padding:.72rem .8rem;font-size:.88rem;outline:none}
.nictm-chatbot-input:focus{border-color:#0ea5e9;box-shadow:0 0 0 4px rgba(14,165,233,.13)}
.nictm-chatbot-send{border:0;border-radius:1rem;padding:.72rem .9rem;background:#050570;color:#fff;font-weight:900;cursor:pointer}
.nictm-pwa-install{display:none;margin:.75rem 1rem 0;border:1px solid #bbf7d0;background:#ecfdf5;color:#065f46;border-radius:1rem;padding:.7rem .8rem;align-items:center;justify-content:space-between;gap:.65rem;font-size:.78rem;font-weight:800}
.nictm-pwa-install.is-ready{display:flex}
.nictm-pwa-install button{border:0;background:#0B830B;color:#fff;border-radius:.8rem;padding:.48rem .7rem;font-weight:900;cursor:pointer}
.nictm-msg-source{margin-top:.45rem;font-size:.68rem;font-weight:800;text-transform:uppercase;letter-spacing:.08em;color:#64748b}
.nictm-msg-user .nictm-msg-source{color:rgba(255,255,255,.72)}

@media(max-width:640px){
  #nictm-chatbot-root,
  html body > #nictm-chatbot-root,
  html body > #nictm-chatbot-root.nictm-chatbot-docked{
    right:14px!important;
    bottom:18px!important;
    top:auto!important;
    left:auto!important;
    max-width:calc(100vw - 28px)!important;
    max-height:calc(100vh - 36px)!important;
  }
  html body > #nictm-chatbot-root[data-viewport-pinned="1"]{
    left:var(--nictm-chatbot-left,calc(100vw - 72px))!important;
    top:var(--nictm-chatbot-top,calc(100vh - 76px))!important;
    right:auto!important;
    bottom:auto!important;
  }
  .nictm-chatbot-button{width:3.45rem;min-width:3.45rem;height:3.45rem;min-height:3.45rem}
  .nictm-chatbot-panel,
  html body > #nictm-chatbot-root .nictm-chatbot-panel{
    position:fixed!important;
    left:.75rem!important;
    right:.75rem!important;
    bottom:84px!important;
    top:auto!important;
    width:auto!important;
    max-width:none!important;
    max-height:calc(100vh - 112px);
    border-radius:1.25rem;
  }
  .nictm-msg{max-width:94%}
  .nictm-chatbot-messages{min-height:12rem}
  .nictm-chatbot-subtitle{font-size:.7rem}
  .nictm-chatbot-quick{overflow-x:auto;flex-wrap:nowrap;padding-bottom:.75rem}
  .nictm-chip{white-space:nowrap}
  .nictm-chatbot-form{gap:.4rem}
  .nictm-chatbot-send{padding-left:.8rem;padding-right:.8rem}
}
@media(max-width:390px){
  .nictm-chatbot-panel{left:.5rem!important;right:.5rem!important;bottom:80px!important}
  .nictm-chatbot-head{padding:.9rem}
  .nictm-chatbot-messages{padding:.85rem}
  .nictm-chatbot-input{font-size:.84rem}
  .nictm-chatbot-send{font-size:.84rem}
  .nictm-pwa-install{font-size:.72rem;margin-left:.85rem;margin-right:.85rem}
}
@media(max-width:640px) and (orientation:landscape){.nictm-chatbot-panel{max-height:calc(100vh - 96px);left:1rem!important;right:1rem!important;bottom:76px!important}}

/* 1084 hard guard: viewport-pinned panel must be measured against the phone viewport,
   not against the small launcher button. This fixes Android/WebView clipping where
   only the right slice of the open panel was visible. */
html body > #nictm-chatbot-root[data-viewport-pinned="1"] .nictm-chatbot-panel,
html body > #nictm-chatbot-root[data-viewport-pinned="1"] .nictm-chatbot-panel.is-open{
  position:fixed!important;
  left:var(--nictm-chatbot-panel-left,12px)!important;
  top:var(--nictm-chatbot-panel-top,24px)!important;
  right:auto!important;
  bottom:auto!important;
  width:var(--nictm-chatbot-panel-width,calc(100vw - 24px))!important;
  max-width:var(--nictm-chatbot-panel-width,calc(100vw - 24px))!important;
  max-height:var(--nictm-chatbot-panel-max-height,calc(100vh - 112px))!important;
  min-width:0!important;
  transform:none!important;
  translate:none!important;
  contain:none!important;
  overflow:hidden!important;
}

@media print{#nictm-chatbot-root{display:none!important}}
