:root {
      --bg: #0d1117;
      --surface: #161b22;
      --surface-2: #21262d;
      --surface-3: #30363d;
      --text: #e6edf3;
      --text-muted: #8b949e;
      --text-subtle: #6e7681;
      --border: #30363d;
      --accent: #3fb950;
      --accent-muted: rgba(63,185,80,0.12);
      --accent-text: #e6edf3;
      --user-bubble: #1f6feb;
      --bot-bubble: #21262d;
      --agent-bubble: #2d333b;
      --radius: 14px;
      --radius-sm: 8px;
      --shadow: 0 16px 48px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04);
    }
    *{box-sizing:border-box;margin:0;padding:0}
    body{
      font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
      background:linear-gradient(135deg,#0d1117 0%,#0f1923 100%);
      color:var(--text);height:100vh;display:flex;
      justify-content:center;align-items:center;padding:16px;
    }
    .chat-app{
      width:100%;max-width:800px;height:92vh;
      background:var(--surface);
      border:1px solid var(--border);
      border-radius:20px;display:flex;flex-direction:column;
      overflow:hidden;box-shadow:var(--shadow);
      position:relative;
    }
    /* Header */
    .header{
      padding:16px 20px;
      background:linear-gradient(180deg,rgba(22,27,34,1) 0%,rgba(22,27,34,0.95) 100%);
      border-bottom:1px solid var(--border);
      display:flex;align-items:center;gap:14px;
      position:relative;flex-shrink:0;
    }
    .header-avatar{
      width:42px;height:42px;border-radius:50%;
      background:linear-gradient(135deg,#3fb950,#1a7f37);
      display:grid;place-items:center;flex-shrink:0;
      box-shadow:0 0 0 3px rgba(63,185,80,0.2);
      overflow:hidden;
    }
    .header-avatar img{width:100%;height:100%;object-fit:cover}
    .header-info{flex:1;min-width:0}
    .header-name{font-size:15px;font-weight:600;color:var(--text)}
    .header-status{font-size:12px;color:var(--text-muted);display:flex;align-items:center;gap:5px;margin-top:2px}
    .status-dot{width:7px;height:7px;border-radius:50%;background:var(--accent);flex-shrink:0;box-shadow:0 0 6px var(--accent)}
    .status-dot.agent{background:#a371f7;box-shadow:0 0 6px #a371f7}
    .status-dot.typing{animation:pulse 1s ease infinite}
    @keyframes pulse{0%,100%{opacity:1}50%{opacity:0.4}}
    .new-chat-btn{
      padding:8px 14px;border:1px solid var(--border);border-radius:var(--radius-sm);
      background:transparent;color:var(--text-muted);font-size:13px;font-weight:500;
      cursor:pointer;transition:all 0.15s;flex-shrink:0;
    }
    .new-chat-btn:hover{border-color:var(--accent);color:var(--text);background:var(--accent-muted)}
    .notify-btn{
      width:36px;height:36px;border:1px solid var(--border);border-radius:50%;
      background:transparent;color:var(--text-muted);font-size:16px;cursor:pointer;
      display:grid;place-items:center;transition:all .15s;flex-shrink:0;
    }
    .notify-btn:hover{border-color:var(--accent);color:var(--text);background:var(--accent-muted)}
    .notify-btn.on{color:var(--accent);border-color:rgba(63,185,80,.55);background:var(--accent-muted)}
    /* Messages */
    .messages{
      flex:1;overflow-y:auto;padding:20px;
      display:flex;flex-direction:column;gap:2px;
      scroll-behavior:smooth;
    }
    .messages::-webkit-scrollbar{width:5px}
    .messages::-webkit-scrollbar-track{background:transparent}
    .messages::-webkit-scrollbar-thumb{background:var(--surface-3);border-radius:4px}
    /* Message rows */
    .msg-group{display:flex;flex-direction:column;gap:2px;margin-bottom:16px}
    .msg-group.from-user{align-items:flex-end}
    .msg-group.from-bot,.msg-group.from-agent,.msg-group.from-system{align-items:flex-start}
    .msg-row{display:flex;gap:8px;align-items:flex-end;width:100%}
    .msg-group.from-user .msg-row{flex-direction:row-reverse}
    .msg-group.from-system .msg-row{justify-content:center}
    /* Avatars */
    .avatar{
      width:32px;height:32px;border-radius:50%;flex-shrink:0;
      display:grid;place-items:center;font-size:11px;font-weight:700;
      overflow:hidden;border:1.5px solid var(--border);
    }
    .avatar.bot{background:linear-gradient(135deg,#3fb950,#1a7f37);color:#0d1117}
    .avatar.user{background:linear-gradient(135deg,#1f6feb,#1158c7);color:white}
    .avatar.agent{background:linear-gradient(135deg,#a371f7,#7c3aed);color:white}
    .avatar.system{background:var(--surface-3);color:var(--text-muted)}
    .avatar img{width:100%;height:100%;object-fit:cover}
    /* Ghost avatar for consecutive messages */
    .avatar-ghost{width:32px;flex-shrink:0}
    /* Bubbles */
    .bubble{
      max-width:74%;padding:11px 14px;border-radius:18px;
      line-height:1.55;white-space:pre-wrap;overflow-wrap:break-word;word-break:break-word;
      font-size:14.5px;
    }
    .msg-group.from-user .bubble{
      background:var(--user-bubble);color:white;
      border-bottom-right-radius:5px;
    }
    .msg-group.from-bot .bubble{
      background:var(--bot-bubble);color:var(--text);
      border-bottom-left-radius:5px;border:1px solid var(--border);
    }
    .msg-group.from-agent .bubble{
      background:var(--agent-bubble);color:var(--text);
      border-bottom-left-radius:5px;border:1px solid rgba(163,113,247,0.25);
    }
    .bubble.system-bubble{
      max-width:85%;background:rgba(139,148,158,0.08);
      color:var(--text-muted);font-size:13px;text-align:center;
      border:1px solid var(--border);border-radius:var(--radius-sm);
    }
    /* Sender label */
    .sender-label{
      font-size:11.5px;font-weight:600;color:var(--text-muted);
      margin-bottom:5px;padding-left:2px;
    }
    .msg-group.from-user .sender-label{text-align:right;padding-right:2px}
    /* Timestamp */
    .bubble-time{
      font-size:10.5px;color:var(--text-subtle);
      margin-top:4px;padding:0 2px;
    }
    .msg-group.from-user .bubble-time{text-align:right}
    /* Typing indicator */
    .typing-indicator{display:flex;gap:4px;align-items:center;padding:12px 14px}
    .typing-indicator span{
      width:7px;height:7px;border-radius:50%;
      background:var(--text-muted);
      animation:bounce 1.2s ease infinite;
    }
    .typing-indicator span:nth-child(2){animation-delay:0.2s}
    .typing-indicator span:nth-child(3){animation-delay:0.4s}
    @keyframes bounce{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(-6px)}}
    /* Quick action buttons */
    .quick-actions{
      display:flex;gap:8px;flex-wrap:wrap;
      padding:4px 0 0 40px;margin-bottom:12px;
    }
    .qa-btn{
      padding:8px 16px;border-radius:999px;font-size:13px;font-weight:500;
      cursor:pointer;transition:all 0.15s;border:1px solid var(--border);
      background:var(--surface-2);color:var(--text);
    }
    .qa-btn:hover{border-color:var(--accent);background:var(--accent-muted);color:var(--text)}
    .qa-btn.primary{background:var(--accent);color:#0d1117;border-color:var(--accent);font-weight:600}
    .qa-btn.primary:hover{opacity:0.9}
    /* Input area */
    .input-area{
      padding:14px 16px 16px;
      background:var(--surface);
      border-top:1px solid var(--border);
      flex-shrink:0;
    }
    .input-row{display:flex;gap:10px;align-items:flex-end}
    textarea{
      flex:1;resize:none;min-height:48px;max-height:140px;
      padding:13px 15px;border-radius:14px;
      border:1.5px solid var(--border);
      background:var(--surface-2);color:var(--text);
      font-size:14.5px;font-family:inherit;outline:none;
      line-height:1.5;transition:border-color 0.15s;
    }
    textarea::placeholder{color:var(--text-subtle)}
    textarea:focus{border-color:var(--accent)}
    .send-btn{
      width:48px;height:48px;border-radius:12px;border:none;
      background:var(--accent);color:#0d1117;
      display:grid;place-items:center;cursor:pointer;
      transition:all 0.15s;flex-shrink:0;
    }
    .send-btn:hover{background:#46c95a;transform:scale(1.03)}
    .send-btn:disabled{opacity:0.45;cursor:not-allowed;transform:none}
    .send-btn svg{width:20px;height:20px}
    .input-hint{font-size:11.5px;color:var(--text-subtle);margin-top:8px;text-align:center}
    /* Empty state */
    .empty-start{
      flex:1;display:flex;flex-direction:column;
      align-items:center;justify-content:center;gap:16px;
      padding:40px;text-align:center;
    }
    .empty-icon{
      width:60px;height:60px;border-radius:50%;
      background:var(--accent-muted);display:grid;place-items:center;
      font-size:28px;
    }
    .empty-title{font-size:20px;font-weight:600}
    .empty-desc{font-size:14px;color:var(--text-muted);max-width:320px;line-height:1.6}
    /* Mobile */
    @media(max-width:600px){
      body{padding:0}
      .chat-app{height:100vh;border-radius:0;border:none}
      .bubble{max-width:85%}
    }
