:root{
  --tcu-surface:#ffffff;
  --tcu-bg:#f8fafc;
  --tcu-text:#111827;
  --tcu-muted:#64748b;
  --tcu-border:#e2e8f0;
  --tcu-shadow:0 18px 50px rgba(15,23,42,.10);
  --tcu-user:#971919;
  --tcu-head:#971919;
  --tcu-head-2:#7f1212;
  --tcu-head-text:#ffffff;
}

html,
body{
  margin:0 !important;
  padding:0 !important;
  height:100% !important;
  overflow-x:hidden !important;
}

#tcu-root,
#tcu-root *{
  box-sizing:border-box;
}

#tcu-root{
  position:fixed !important;
  top:var(--tcu-adminbar-h, 0px);
  left:calc(var(--tcu-sidebar-edge, 242px) - 1px);
  right:0;
  bottom:0;
  z-index:999999;
  display:flex;
  margin:0 !important;
  padding:0 !important;
  font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
  opacity:0;
  visibility:hidden;
  transition:left .24s ease, opacity .18s ease;
  overflow:hidden;
}

#tcu-root.is-ready{
  opacity:1;
  visibility:visible;
}

#tcu-root button,
#tcu-root textarea{
  font-family:inherit;
}

.tcu-wrap,
.tcu-wrap[data-layout="left"],
.tcu-wrap[data-layout="right"],
.tcu-wrap[data-layout="embed"]{
  position:relative !important;
  display:flex;
  width:100% !important;
  height:100% !important;
  min-height:100% !important;
  margin:0 !important;
  padding:0 !important;
}

.tcu-panel{
  position:relative;
  display:flex;
  flex-direction:column;
  width:100%;
  height:100%;
  min-height:100%;
  background:var(--tcu-surface);
  border:none !important;
  border-radius:0 !important;
  box-shadow:none !important;
  overflow:hidden;
  isolation:isolate;
}

.tcu-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  min-height:86px;
  padding:18px 24px;
  background:linear-gradient(135deg,var(--tcu-head) 0%, var(--tcu-head-2) 100%);
  color:var(--tcu-head-text);
  flex:0 0 auto;
  border-radius:0 !important;
}

.tcu-brand{
  display:flex;
  align-items:center;
  gap:14px;
  min-width:0;
}

.tcu-avatar,
.tcu-msg-avatar{
  position:relative;
  overflow:hidden;
  background:#ffffff;
  color:#971919;
}

.tcu-avatar{
  width:52px;
  height:52px;
  border-radius:18px;
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 52px;
  padding:3px;
  box-shadow:0 6px 18px rgba(0,0,0,.12);
}

.tcu-msg-avatar{
  width:34px;
  height:34px;
  border-radius:12px;
  border:1px solid var(--tcu-border);
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 34px;
  align-self:flex-start;
  padding:2px;
  box-shadow:0 4px 10px rgba(15,23,42,.05);
}

.tcu-avatar-img,
.tcu-msg-avatar-img{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
  border-radius:inherit;
  background:#ffffff;
}

.tcu-avatar-fallback{
  font-weight:800;
  font-size:18px;
}

.tcu-avatar.is-thinking,
.tcu-msg-avatar.is-thinking{
  animation:tcu-logo-float 1.2s ease-in-out infinite;
}

.tcu-avatar.is-thinking::after,
.tcu-msg-avatar.is-thinking::after{
  content:"";
  position:absolute;
  inset:-3px;
  border-radius:inherit;
  border:2px solid rgba(151,25,25,.22);
  animation:tcu-logo-ring 1.2s ease-out infinite;
  pointer-events:none;
}

.tcu-meta{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:4px;
}

.tcu-title{
  font-weight:800;
  font-size:20px;
  line-height:1;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.tcu-subtitle{
  font-size:13px;
  line-height:1.2;
  opacity:.92;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.tcu-body{
  flex:1 1 auto;
  min-height:0;
  display:flex;
  flex-direction:column;
  background:linear-gradient(180deg,var(--tcu-surface) 0%, var(--tcu-bg) 100%);
}

.tcu-list{
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  padding:24px;
  display:flex;
  flex-direction:column;
  gap:16px;
  scroll-behavior:smooth;
  scrollbar-width:thin;
}

.tcu-list::-webkit-scrollbar{
  width:10px;
}

.tcu-list::-webkit-scrollbar-thumb{
  background:rgba(100,116,139,.24);
  border-radius:999px;
}

.tcu-list::-webkit-scrollbar-track{
  background:transparent;
}

.tcu-form{
  flex:0 0 auto;
  padding:16px 18px 18px;
  border-top:1px solid rgba(148,163,184,.18);
  background:rgba(255,255,255,.96);
  display:flex;
  gap:12px;
  align-items:flex-end;
  margin:0 !important;
}

.tcu-inp{
  appearance:none;
  -webkit-appearance:none;
  flex:1;
  width:100%;
  min-height:58px;
  max-height:160px;
  padding:16px 18px;
  border:1px solid var(--tcu-border);
  border-radius:18px;
  resize:none;
  font:inherit;
  line-height:1.5;
  outline:none;
  background:#ffffff;
  color:var(--tcu-text);
  box-shadow:0 1px 2px rgba(15,23,42,.03);
}

.tcu-inp::placeholder{
  color:#94a3b8;
}

.tcu-inp:focus{
  border-color:rgba(151,25,25,.26);
  box-shadow:0 0 0 4px rgba(151,25,25,.08);
}

.tcu-send{
  appearance:none;
  -webkit-appearance:none;
  height:58px;
  min-width:120px;
  padding:0 22px;
  border:none;
  border-radius:18px;
  background:linear-gradient(135deg,var(--tcu-user) 0%, #7f1212 100%);
  color:#fff;
  cursor:pointer;
  font:inherit;
  font-weight:700;
  letter-spacing:.01em;
  box-shadow:0 10px 24px rgba(151,25,25,.18);
}

.tcu-send:disabled{
  opacity:.65;
  cursor:not-allowed;
  box-shadow:none;
}

.tcu-msg{
  display:flex;
  align-items:flex-end;
  gap:10px;
}

.tcu-user{
  justify-content:flex-end;
}

.tcu-user .tcu-msg-avatar{
  display:none;
}

.tcu-bubble{
  max-width:min(78%,780px);
  padding:14px 16px;
  border-radius:20px;
  font-size:15px;
  line-height:1.6;
  white-space:pre-wrap;
  word-break:break-word;
  box-shadow:0 8px 22px rgba(15,23,42,.05);
}

.tcu-user .tcu-bubble{
  background:linear-gradient(135deg,var(--tcu-user) 0%, #7f1212 100%);
  color:#fff;
  border-top-right-radius:8px;
}

.tcu-bot .tcu-bubble{
  background:#ffffff;
  color:var(--tcu-text);
  border:1px solid rgba(226,232,240,.95);
  border-top-left-radius:8px;
}

.tcu-typing .tcu-bubble{
  display:flex;
  align-items:center;
  justify-content:center;
  min-width:62px;
}

.tcu-dots{
  width:28px;
  height:10px;
  display:inline-block;
  background:radial-gradient(circle closest-side,#64748b 90%,transparent) left/7px 100% repeat-x;
  animation:tcu-d 1s steps(4) infinite;
}

@keyframes tcu-d{
  to{background-position:28px 0}
}

@keyframes tcu-logo-float{
  0%{transform:translateY(0) scale(1) rotate(0deg)}
  20%{transform:translateY(-2px) scale(1.03) rotate(-2deg)}
  50%{transform:translateY(-5px) scale(1.06) rotate(0deg)}
  80%{transform:translateY(-2px) scale(1.03) rotate(2deg)}
  100%{transform:translateY(0) scale(1) rotate(0deg)}
}

@keyframes tcu-logo-ring{
  0%{opacity:.55;transform:scale(.92)}
  70%{opacity:0;transform:scale(1.18)}
  100%{opacity:0;transform:scale(1.18)}
}

@media (max-width: 920px){
  #tcu-root{
    left:0 !important;
    right:0 !important;
    top:var(--tcu-adminbar-h, 0px);
    bottom:0 !important;
  }

  .tcu-panel{
    border-radius:0 !important;
    box-shadow:none !important;
  }

  .tcu-head{
    min-height:82px;
    padding:16px 18px;
  }

  .tcu-list{
    padding:18px;
  }

  .tcu-form{
    padding:14px;
  }

  .tcu-send{
    min-width:104px;
    padding:0 18px;
  }

  .tcu-bubble{
    max-width:88%;
  }
}