/* Scoped conversation layout; existing brand, hero and theme remain authoritative. */
.nfz-ui .answer-body{max-height:70vh;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding:16px;min-width:0}
.nfz-ui .chat-message{display:flex;flex-direction:column;gap:5px;margin:0 0 18px;min-width:0;max-width:100%;width:100%}
.nfz-ui .chat-message-user{align-items:flex-end}
.nfz-ui .chat-message-user .chat-bubble{width:fit-content;max-width:78%;padding:10px 15px;border-radius:18px 18px 4px 18px;background:color-mix(in srgb,currentColor 8%,transparent);overflow-wrap:anywhere}
.nfz-ui .chat-message-user .chat-bubble p{margin:0}
.nfz-ui .chat-message-assistant{align-items:stretch}
.nfz-ui .chat-message-assistant .chat-bubble{width:100%;max-width:none;box-sizing:border-box;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;overflow-wrap:anywhere}
.nfz-ui .chat-message-label{font-size:.78rem;opacity:.7}
.nfz-ui .chat-bubble pre,.nfz-ui .chat-bubble table{max-width:100%;overflow-x:auto}
.nfz-ui .answer-feedback{margin-top:16px;padding-top:12px;border-top:1px solid color-mix(in srgb,currentColor 15%,transparent)}
.nfz-ui .feedback-actions{display:flex;gap:8px;flex-wrap:wrap}
.nfz-ui .feedback-form textarea{box-sizing:border-box;width:100%;margin:8px 0}
.nfz-ui .followup-actions{display:flex;justify-content:flex-end;margin-top:10px}
.nfz-ui .instruction-button{margin-top:22px;padding:11px 16px;text-align:left;border:1px solid color-mix(in srgb,currentColor 20%,transparent);border-radius:12px;background:transparent;color:inherit;cursor:pointer}
.nfz-ui .instruction-dialog{max-width:540px;width:calc(100% - 40px);box-sizing:border-box;border:1px solid color-mix(in srgb,currentColor 20%,transparent);border-radius:20px;padding:28px;background:var(--panel-bg,#fff);color:var(--text,#172b46);box-shadow:0 24px 80px #0003}
.nfz-ui .instruction-dialog::backdrop{background:#10213966;backdrop-filter:blur(3px)}
.nfz-ui .instruction-dialog li{margin:12px 0;line-height:1.6}
.nfz-ui .instruction-dialog button{padding:10px 20px;border-radius:10px;cursor:pointer}
html[data-theme="dark"] .instruction-dialog{background:#142033;color:#eef3ff}
@media(max-width:640px){.nfz-ui .answer-body{padding:10px;max-height:68vh}.nfz-ui .chat-message-user .chat-bubble{max-width:90%}.nfz-ui .instruction-dialog{padding:20px}.nfz-ui .chat-message{margin-bottom:14px}}
/* Override the previous compact layout's explicit overflow reset only inside the chat. */
html body.nfz-ui:not(.jgp22) #answerBody.answer-body{max-height:70vh!important;overflow:auto!important;padding:16px!important}
html body.nfz-ui:not(.jgp22) .chat-message-assistant .demo-response{max-width:none;width:100%;font-size:14px;line-height:1.65}
html body.nfz-ui:not(.jgp22) .chat-message-assistant .demo-response h3{font-size:16px}
html body.nfz-ui:not(.jgp22) .chat-composer{margin:8px 0 0;width:100%;box-sizing:border-box}
@media(max-width:640px){html body.nfz-ui:not(.jgp22) #answerBody.answer-body{max-height:68vh!important;padding:10px!important}}

/* 5.13: one document scroll; conversation has natural height. */
html:has(body.nfz-ui:not(.jgp22)){height:auto;min-height:100%}
html body.nfz-ui:not(.jgp22){height:auto!important;min-height:100dvh!important;overflow-x:hidden!important;overflow-y:auto!important}
html body.nfz-ui:not(.jgp22) .portal{width:100%!important;height:auto!important;min-height:100dvh!important;align-items:stretch!important}
html body.nfz-ui:not(.jgp22) .main{height:auto!important;min-width:0!important;min-height:100dvh!important}
html body.nfz-ui:not(.jgp22) #answerPanel{height:auto!important;max-height:none!important;overflow:visible!important;display:block!important}
html body.nfz-ui:not(.jgp22) #answerBody.answer-body{height:auto!important;max-height:none!important;overflow:visible!important;padding:16px!important}
html body.nfz-ui:not(.jgp22) #answerPanel.is-empty #answerBody{display:none!important}
html body.nfz-ui:not(.jgp22) .chat-message{width:100%!important;max-width:100%!important;margin:0 0 20px!important;scroll-margin-top:16px}
html body.nfz-ui:not(.jgp22) .chat-message-user .chat-bubble{font-size:14px!important;line-height:1.5!important;color:var(--text);max-width:85%!important}
html body.nfz-ui:not(.jgp22) .followup-composer{width:100%!important;max-width:none!important;margin:16px 0 0!important;box-sizing:border-box}
html body.nfz-ui:not(.jgp22) #siteFooter{margin-bottom:0!important}
html body.nfz-ui:not(.jgp22) .sidebar .instruction-button{display:flex;align-items:center;gap:12px;width:100%;font-family:inherit;font-weight:700;color:var(--nfz-control-text,var(--text));background:var(--nfz-control-bg,var(--control-bg));border:1px solid var(--nfz-control-border,var(--control-border));margin-top:12px}
html body.nfz-ui:not(.jgp22) .instruction-button .icon-slot{width:24px;height:24px;flex:0 0 24px}
html body.nfz-ui:not(.jgp22) .instruction-button .icon-svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
@media(max-width:920px){html body.nfz-ui:not(.jgp22) .sidebar{height:auto!important;min-height:0!important;position:relative!important}html body.nfz-ui:not(.jgp22) .sidebar .instruction-button{margin-top:8px;justify-content:center}html body.nfz-ui:not(.jgp22) .instruction-button .icon-slot{width:18px;height:18px;flex-basis:18px}html body.nfz-ui:not(.jgp22) .instruction-button .icon-svg{width:18px;height:18px}}
@media(max-width:640px){html body.nfz-ui:not(.jgp22) #answerBody.answer-body{padding:12px!important}html body.nfz-ui:not(.jgp22) .chat-message-user .chat-bubble{max-width:95%!important}}

html body.nfz-ui:not(.jgp22) .sidebar .instruction-button{margin-top:12px!important}
@media(max-width:920px){html body.nfz-ui:not(.jgp22) .portal{display:flex!important;flex-direction:column!important}html body.nfz-ui:not(.jgp22) .main{flex:1 0 auto!important;min-height:0!important}html body.nfz-ui:not(.jgp22) .sidebar{flex:0 0 auto!important}}

@media(max-width:1180px){html body.nfz-ui:not(.jgp22) .main::before{right:0!important;width:auto!important;max-width:100%!important}}

/* 5.16 — delikatny retusz UI. Tylko prezentacja; bez zmian logiki, źródeł i API. */
html body.nfz-ui:not(.jgp22) #answerBody.answer-body{
  padding:14px 10px 18px!important;
}
html body.nfz-ui:not(.jgp22) .chat-message{
  gap:6px!important;
  margin-bottom:22px!important;
}
html body.nfz-ui:not(.jgp22) .chat-message-label{
  font-size:11px!important;
  letter-spacing:.04em!important;
  opacity:.68;
}
html body.nfz-ui:not(.jgp22) .chat-message-user .chat-message-label{
  padding-right:6px;
}
html body.nfz-ui:not(.jgp22) .chat-message-user .chat-bubble{
  max-width:min(72%,760px)!important;
  padding:11px 15px!important;
  border:1px solid color-mix(in srgb,var(--blue) 20%,var(--panel-border))!important;
  border-radius:18px 18px 5px 18px!important;
  background:color-mix(in srgb,var(--blue) 8%,var(--panel-bg-soft))!important;
  box-shadow:0 6px 18px color-mix(in srgb,var(--blue) 7%,transparent);
}
html body.nfz-ui:not(.jgp22) .chat-message-assistant .chat-bubble{
  width:100%!important;
  max-width:none!important;
}
html body.nfz-ui:not(.jgp22) .answer-feedback{
  margin-top:20px;
  padding-top:14px;
}
html body.nfz-ui:not(.jgp22) .answer-feedback> b{
  display:block;
  margin-bottom:9px;
  font-size:13px;
}
html body.nfz-ui:not(.jgp22) .feedback-actions{
  gap:7px;
}
html body.nfz-ui:not(.jgp22) .feedback-button{
  min-height:36px!important;
  padding:7px 11px!important;
  font-size:12px!important;
}
html body.nfz-ui:not(.jgp22) .feedback-form{
  margin-top:10px;
}
html body.nfz-ui:not(.jgp22) #followupForm.followup-composer{
  max-width:none!important;
  margin-top:18px!important;
  padding:10px 11px!important;
  border-radius:16px!important;
}
html body.nfz-ui:not(.jgp22) #followupForm .followup-actions{
  margin-top:2px;
  padding-top:10px;
  border-top:1px solid color-mix(in srgb,currentColor 10%,transparent);
}
html body.nfz-ui:not(.jgp22) #newConversationButton{
  border-radius:999px;
}
html body.nfz-ui:not(.jgp22) .sidebar .instruction-button{
  margin-top:20px!important;
  opacity:.96;
}
html body.nfz-ui:not(.jgp22) .instruction-dialog{
  max-width:560px;
  padding:30px;
}
html body.nfz-ui:not(.jgp22) .instruction-dialog h2{
  margin:0 0 18px;
  font-size:24px;
  line-height:1.2;
}
html body.nfz-ui:not(.jgp22) .instruction-dialog ol{
  list-style:none;
  counter-reset:instruction-step;
  margin:0 0 22px;
  padding:0;
}
html body.nfz-ui:not(.jgp22) .instruction-dialog li{
  counter-increment:instruction-step;
  position:relative;
  min-height:34px;
  margin:0;
  padding:7px 0 14px 46px;
  line-height:1.55;
}
html body.nfz-ui:not(.jgp22) .instruction-dialog li::before{
  content:counter(instruction-step);
  position:absolute;
  left:0;
  top:4px;
  width:30px;
  height:30px;
  display:grid;
  place-items:center;
  border-radius:50%;
  border:1px solid color-mix(in srgb,var(--blue) 24%,var(--panel-border));
  background:color-mix(in srgb,var(--blue) 8%,var(--panel-bg-soft));
  color:var(--blue);
  font-weight:800;
  font-size:12px;
}
html body.nfz-ui:not(.jgp22) .instruction-dialog form{
  display:flex;
  justify-content:flex-end;
  margin-top:4px;
}
html body.nfz-ui:not(.jgp22) .instruction-dialog button{
  min-height:40px;
  padding:9px 18px;
  border:1px solid var(--control-border);
  background:var(--control-bg);
  color:var(--text);
  font:700 13px/1 var(--ui);
}

@media(max-width:640px){
  html body.nfz-ui:not(.jgp22) #answerBody.answer-body{
    padding:10px 2px 16px!important;
  }
  html body.nfz-ui:not(.jgp22) .chat-message{
    margin-bottom:18px!important;
  }
  html body.nfz-ui:not(.jgp22) .chat-message-user .chat-bubble{
    max-width:94%!important;
    padding:10px 13px!important;
  }
  html body.nfz-ui:not(.jgp22) #followupForm.followup-composer{
    grid-template-columns:minmax(0,1fr) 44px!important;
    gap:8px!important;
    margin-top:14px!important;
    padding:9px!important;
  }
  html body.nfz-ui:not(.jgp22) #followupForm .followup-actions{
    justify-content:stretch!important;
  }
  html body.nfz-ui:not(.jgp22) #newConversationButton{
    width:100%;
    min-height:44px;
  }
  html body.nfz-ui:not(.jgp22) .instruction-dialog{
    width:calc(100% - 24px);
    max-height:calc(100dvh - 24px);
    overflow:auto;
    padding:22px 18px;
    border-radius:16px;
  }
  html body.nfz-ui:not(.jgp22) .instruction-dialog h2{
    font-size:21px;
  }
  html body.nfz-ui:not(.jgp22) .instruction-dialog li{
    padding-left:42px;
  }
  html body.nfz-ui:not(.jgp22) .instruction-dialog form,
  html body.nfz-ui:not(.jgp22) .instruction-dialog button{
    width:100%;
  }
}

/* UI 5.17: long XML identifiers and source titles stay inside the chat. */
html body.nfz-ui:not(.jgp22) .answer-content code,
html body.nfz-ui:not(.jgp22) .chat-message code,
html body.nfz-ui:not(.jgp22) .answer-text code,
html body.nfz-ui:not(.jgp22) .answer-sources a {
  white-space:normal;overflow-wrap:anywhere;word-break:break-word;max-width:100%;
}
html body.nfz-ui:not(.jgp22) code {white-space:normal;overflow-wrap:anywhere;word-break:break-word;}
