.tn-chat-root {
  --tn-chat-primary: #C8102E;
  --tn-chat-header: #012169;
  --tn-chat-header-text: #fff;
  --tn-chat-bot: #ececec;
  --tn-chat-bot-text: #222;
  --tn-chat-user: #C8102E;
  --tn-chat-user-text: #C8102E;
  --tn-chat-panel: #fff;
  --tn-chat-text: #1a1a1a;
  --tn-chat-input-text: #1a1a1a;
  --tn-chat-placeholder: rgba(26,26,26,0.38);
  --tn-chat-rule: #ececec;
  --tn-chat-muted: #6b7280;
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 1090;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: Outfit, sans-serif;
}
.tn-chat-panel {
  display: none;
  flex-direction: column;
  width: min(392px, calc(100vw - 1.5rem));
  height: min(640px, calc(100vh - 7.2rem));
  background: var(--tn-chat-panel);
  color: var(--tn-chat-text);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22);
}
.tn-chat-root.is-open .tn-chat-panel { display: flex; }
.tn-chat-head {
  background: var(--tn-chat-header);
  color: var(--tn-chat-header-text);
  min-height: 56px;
  padding: 0 0.35rem;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  flex-shrink: 0;
}
.tn-chat-head strong {
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
  line-height: 1;
}
.tn-chat-icon-btn {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: inherit;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 1.25rem;
  border-radius: 10px;
}
.tn-chat-icon-btn:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.tn-chat-log {
  flex: 1;
  overflow: auto;
  padding: 0.85rem 0.95rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.tn-chat-log::before {
  content: "";
  flex: 1 1 auto;
}
.tn-chat-row {
  display: flex;
  gap: 0.55rem;
  max-width: 100%;
  align-items: flex-end;
}
.tn-chat-row-model { align-self: stretch; }
.tn-chat-row-user {
  align-self: flex-end;
  justify-content: flex-end;
}
.tn-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--tn-chat-primary);
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 1.05rem;
}
.tn-chat-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  max-width: calc(100% - 44px);
}
.tn-chat-who {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--tn-chat-muted);
  margin: 0 0 0.28rem 0.15rem;
}
.tn-chat-msg {
  padding: 0.7rem 0.9rem;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.tn-chat-msg-model {
  background: var(--tn-chat-bot);
  color: var(--tn-chat-bot-text);
  border-radius: 14px;
}
.tn-chat-msg-user {
  background: transparent;
  color: var(--tn-chat-primary);
  border: 1.5px solid var(--tn-chat-primary);
  border-radius: 18px;
  max-width: 88%;
}
.tn-chat-chips {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
  padding: 0.15rem 0 0.2rem;
}
.tn-chat-chip {
  border: 1.5px solid var(--tn-chat-primary);
  background: var(--tn-chat-panel);
  color: var(--tn-chat-primary);
  border-radius: 18px;
  padding: 0.55rem 0.95rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  line-height: 1.3;
  max-width: 92%;
}
.tn-chat-chip:hover,
.tn-chat-chip:focus-visible {
  background: var(--tn-chat-primary);
  color: #fff;
  outline: none;
}
.tn-chat-chip:disabled { opacity: 0.5; cursor: wait; }
.tn-chat-form {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.7rem 0.85rem 0.8rem;
  border-top: 1px solid var(--tn-chat-rule);
  background: var(--tn-chat-panel);
  flex-shrink: 0;
}
.tn-chat-form input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--tn-chat-input-text);
  font-size: 0.92rem;
  font-family: inherit;
  padding: 0.45rem 0.2rem;
  min-width: 0;
}
.tn-chat-form input::placeholder { color: var(--tn-chat-placeholder); }
.tn-chat-form input:focus { outline: none; }
.tn-chat-send {
  width: 38px;
  height: 38px;
  border: 0;
  background: transparent;
  color: var(--tn-chat-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  border-radius: 10px;
  font-size: 1.15rem;
  flex-shrink: 0;
}
.tn-chat-send:hover { color: var(--tn-chat-primary); }
.tn-chat-send:disabled { opacity: 0.4; cursor: wait; }
.tn-chat-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: min(392px, calc(100vw - 1.5rem));
  min-height: 58px;
  margin-top: 0.55rem;
  position: relative;
}
.tn-chat-brand {
  display: none;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: var(--tn-chat-panel);
  color: var(--tn-chat-muted);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
  pointer-events: none;
  white-space: nowrap;
}
.tn-chat-root.is-open .tn-chat-brand { display: inline-flex; }
.tn-chat-launch {
  border: 0;
  background: var(--tn-chat-primary);
  color: #fff;
  width: 58px;
  height: 58px;
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.45rem;
  position: relative;
  z-index: 1;
}
.tn-chat-launch:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.tn-chat-launch .tn-chat-launch-min { display: none; }
.tn-chat-root.is-open .tn-chat-launch .tn-chat-launch-open { display: none; }
.tn-chat-root.is-open .tn-chat-launch .tn-chat-launch-min { display: block; }
@media (max-width: 480px) {
  .tn-chat-root { right: 0.55rem; bottom: 0.55rem; left: 0.55rem; align-items: stretch; }
  .tn-chat-panel,
  .tn-chat-foot { width: 100%; }
  .tn-chat-panel { height: min(72vh, 640px); }
}
