 * {
   box-sizing: border-box;
   margin: 0;
 }

 body {
   background: #0b1220;
   background-image: radial-gradient(1100px 650px at 15% 0%, rgba(96, 165, 250, 0.18), transparent 60%),
     radial-gradient(900px 520px at 85% 25%, rgba(52, 211, 153, 0.12), transparent 60%);
   color: #e5e7eb;
   font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
   min-height: 100vh;
   padding: 16px;
 }

 .wrap {
   max-width: 1000px;
   margin: 0 auto;
   display: grid;
   grid-template-columns: 300px 1fr;
   gap: 14px;
 }

 .panel,
 .chatCard {
   background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02));
   border: 1px solid rgba(255, 255, 255, 0.1);
   border-radius: 20px;
   box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
   backdrop-filter: blur(2px);
 }

 .panelHeader,
 .chatHeader {
   padding: 14px 16px;
   border-bottom: 1px solid rgba(255, 255, 255, 0.08);
   display: flex;
   align-items: center;
   justify-content: space-between;
   background: rgba(0, 0, 0, 0.2);
 }

 .title {
   font-weight: 800;
   font-size: 1rem;
 }

 .sub {
   color: #9ca3af;
   font-size: 0.75rem;
   margin-top: 2px;
 }

 .pill {
   font-size: 0.7rem;
   background: rgba(255, 255, 255, 0.03);
   border: 1px solid rgba(255, 255, 255, 0.1);
   padding: 6px 12px;
   border-radius: 40px;
   color: #9ca3af;
 }

 .panelBody {
   padding: 18px;
 }

 label {
   display: block;
   font-size: 0.75rem;
   color: #9ca3af;
   margin-bottom: 6px;
 }

 input,
 button {
   border-radius: 40px;
   border: 1px solid rgba(255, 255, 255, 0.1);
   background: rgba(0, 0, 0, 0.3);
   color: white;
   padding: 10px 16px;
   width: 100%;
   outline: none;
   font-size: 0.9rem;
 }

 input::placeholder {
   color: #6b7280;
 }

 .btn,
 .sendBtn {
   background: rgba(96, 165, 250, 0.18);
   border-color: rgba(96, 165, 250, 0.4);
   font-weight: 600;
   cursor: pointer;
   margin-top: 10px;
   transition: 0.15s;
 }

 .btn:hover {
   background: rgba(96, 165, 250, 0.3);
 }

 .sendBtn {
   width: auto;
   margin-top: 0;
   background: #0ea5e9;
   border-color: rgba(52, 211, 153, 0.4);
   padding: 10px 20px;
   white-space: nowrap;
 }

 .sendBtn:hover {
   background: #1188be;
 }

 .sendBtn:disabled,
 .btn:disabled {
   opacity: 0.3;
   pointer-events: none;
 }

 .hint {
   font-size: 0.75rem;
   color: #9ca3af;
   margin-top: 14px;
   line-height: 1.4;
 }

 .chatCard {
   display: flex;
   flex-direction: column;
   height: calc(100vh - 40px);
   min-height: 600px;
 }

 .threadTitle {
   font-weight: 700;
   font-size: 1rem;
 }

 .threadSub {
   font-size: 0.75rem;
   color: #9ca3af;
   margin-top: 2px;
 }

 .badge {
   display: flex;
   align-items: center;
   gap: 6px;
   border: 1px solid rgba(255, 255, 255, 0.1);
   padding: 5px 12px;
   border-radius: 40px;
   background: rgba(0, 0, 0, 0.2);
   font-size: 0.75rem;
   color: #9ca3af;
 }

 .dot {
   width: 10px;
   height: 10px;
   border-radius: 50%;
   background: #6b7280;
 }

 .dot.live {
   background: #34d399;
   box-shadow: 0 0 6px #34d399;
 }

 .chat {
   flex: 1;
   padding: 16px;
   overflow-y: auto;
   background: rgba(0, 0, 0, 0.15);
   display: flex;
   flex-direction: column;
   gap: 8px;
 }

 .msgRow {
   display: flex;
   gap: 10px;
   align-items: flex-end;
 }

 .msgRow.me {
   justify-content: flex-end;
 }

 .avatar {
   width: 32px;
   height: 32px;
   background: #7c3aed;
   border-radius: 50%;
   display: flex;
   align-items: center;
   justify-content: center;
   font-weight: 700;
   font-size: 0.9rem;
   flex-shrink: 0;
 }

 .msgContent {
   max-width: 70%;
   display: flex;
   flex-direction: column;
 }

 /* Update bubble to handle inline content better */
 .bubble {
   background: #1f2937;
   border: 1px solid rgba(255, 255, 255, 0.1);
   padding: 8px 14px;
   border-radius: 18px 18px 18px 4px;
   font-size: 0.9rem;
   line-height: 1.5;
   word-break: break-word;
   display: inline-flex;
   flex-wrap: wrap;
   align-items: baseline;
   gap: 0.35rem;
   max-width: 100%;
 }

 .me .bubble {
   background: linear-gradient(145deg, #0ea5e9, #38bdf8);
   color: #06131a;
   border-radius: 18px 18px 4px 18px;
 }


 .inline-meta {
   display: inline-flex;
   align-items: center;
   gap: 0.25rem;
   font-size: 0.7rem;
   color: #9ca3af;
   white-space: nowrap;
   margin-left: 0.5rem;
   vertical-align: baseline;
 }

 .me .inline-meta {
   color: #c6f0ff;
 }

 .double-check {
   color: blue;
   font-size: 0.7rem;
 }

 /* typing indicator */
 .typing {
   display: flex;
   gap: 5px;
   padding: 12px 18px;
   background: #1f2937;
   border-radius: 18px;
   border: 1px solid rgba(255, 255, 255, 0.05);
   width: fit-content;
 }

 .dot-typing {
   width: 6px;
   height: 6px;
   background: #9ca3af;
   border-radius: 50%;
   animation: pulse 1.4s infinite;
 }

 .dot-typing:nth-child(2) {
   animation-delay: 0.2s;
 }

 .dot-typing:nth-child(3) {
   animation-delay: 0.4s;
 }

 @keyframes pulse {

   0%,
   60%,
   100% {
     opacity: 0.4;
     transform: translateY(0);
   }

   30% {
     opacity: 1;
     transform: translateY(-3px);
   }
 }

 .composer {
   display: flex;
   gap: 10px;
   padding: 14px;
   border-top: 1px solid rgba(255, 255, 255, 0.06);
   background: rgba(0, 0, 0, 0.15);
 }

 .composer input {
   flex: 1;
   padding: 12px 16px;
 }

 .statusLine {
   padding: 10px 18px;
   font-size: 0.75rem;
   color: #9ca3af;
   border-top: 1px solid rgba(255, 255, 255, 0.05);
 }

 @media (max-width: 700px) {
   .wrap {
     grid-template-columns: 1fr;
   }

   .chatCard {
     height: 70vh;
   }
 }