.nok-widget {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1200;
  font-family: "Sarabun", sans-serif;
}

.nok-widget__fab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  padding: 0.75rem 1rem;
  border: 0;
  border-radius: 999px;
  background: #0f766e;
  color: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
  cursor: pointer;
  font-weight: 700;
}

.nok-widget__panel {
  position: absolute;
  right: 0;
  bottom: 4rem;
  width: min(26rem, calc(100vw - 2rem));
  height: min(38rem, calc(100vh - 7rem));
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.3);
}

.nok-widget__close {
  position: absolute;
  top: 0.5rem;
  right: 0.6rem;
  z-index: 2;
  border: 0;
  background: transparent;
  color: #475569;
  cursor: pointer;
  font-size: 1.5rem;
}

.nok-widget__context {
  display: inline-flex;
  margin: 0.75rem 3rem 0 1rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #ccfbf1;
  color: #115e59;
  font-size: 0.75rem;
  font-weight: 700;
}

.nok-widget turbo-frame {
  display: block;
  height: calc(100% - 2.5rem);
  min-height: 0;
}

.nok-widget turbo-frame > .scout-chat {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.scout-chat {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 56rem;
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  padding: 1rem;
  color: #0f172a;
}

.scout-chat__header h1 {
  margin: 0;
  font-size: 1.25rem;
}

.scout-chat__header p,
.scout-chat__hint,
.scout-chat__empty {
  margin: 0.25rem 0 0;
  color: #64748b;
  font-size: 0.85rem;
}

.scout-chat__empty p {
  margin: 0;
}

.scout-chat__offers-title {
  margin: 0.85rem 0 0.45rem;
  color: #0f172a;
  font-size: 0.82rem;
  font-weight: 700;
}

.scout-chat__offers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.scout-chat__offer {
  padding: 0.4rem 0.7rem;
  border: 1px solid #99f6e4;
  border-radius: 999px;
  background: #f0fdfa;
  color: #115e59;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: left;
}

.scout-chat__offer:hover,
.scout-chat__offer:focus-visible {
  background: #ccfbf1;
}

.scout-chat__status {
  font-size: 0.82rem;
}

.scout-chat__status-pill {
  margin-left: 0.35rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: #e2e8f0;
}

.scout-chat__status-pill.is-ok { background: #dcfce7; color: #166534; }
.scout-chat__status-pill.is-warn { background: #fef3c7; color: #92400e; }
.scout-chat__status-pill.is-bad { background: #fee2e2; color: #991b1b; }

.scout-chat__messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #f8fafc;
}

.scout-chat__bubble {
  width: fit-content;
  max-width: 88%;
  margin-bottom: 0.65rem;
  padding: 0.65rem 0.8rem;
  border-radius: 0.8rem;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.scout-chat__bubble.is-user {
  margin-left: auto;
  background: #ccfbf1;
}

.scout-chat__meta {
  margin-bottom: 0.25rem;
  color: #64748b;
  font-size: 0.75rem;
}

.scout-chat__content p { margin: 0.25rem 0; }
.scout-chat__pending { color: #0f766e; font-weight: 600; }
.scout-chat__error { padding: 0.5rem; border-radius: 0.5rem; background: #fee2e2; color: #991b1b; }

#scout_chat_form {
  flex-shrink: 0;
}

.scout-chat textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  padding: 0.55rem;
}

.scout-chat__send {
  margin-top: 0.5rem;
  padding: 0.5rem 0.9rem;
  border: 0;
  border-radius: 0.5rem;
  background: #0f766e;
  color: #fff;
  cursor: pointer;
}

.scout-chat__send:disabled { cursor: not-allowed; opacity: 0.5; }

@media (max-width: 640px) {
  .nok-widget { right: 0.75rem; bottom: 0.75rem; }
  .nok-widget__panel { bottom: 3.75rem; height: calc(100vh - 6rem); }
}
