* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    height: 100vh;
    overflow: hidden;
}

/* ==================== LAYOUT ==================== */
.app {
    display: flex;
    height: 100vh;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    width: 340px;
    background: #fff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: #7c3aed;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.username {
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
}

.icon-btn {
    width: 34px;
    height: 34px;
    border: none;
    background: #f3f4f6;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

/* Search */
.sidebar-search {
    padding: 12px 16px;
}

.sidebar-search input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    background: #f9fafb;
    transition: border-color 0.2s;
}

.sidebar-search input:focus {
    border-color: #7c3aed;
    background: #fff;
}

.sidebar-search input::placeholder {
    color: #9ca3af;
}

/* Platform Filters */
.platform-filters {
    display: flex;
    padding: 0 16px 12px;
    gap: 6px;
}

.filter-btn {
    padding: 6px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    background: #fff;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.filter-btn:hover {
    border-color: #7c3aed;
    color: #7c3aed;
}

.filter-btn.active {
    background: #7c3aed;
    border-color: #7c3aed;
    color: #fff;
}

/* Conversations List */
.conversations-list {
    flex: 1;
    overflow-y: auto;
}

.conversations-list::-webkit-scrollbar {
    width: 4px;
}

.conversations-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid #f3f4f6;
}

.conversation-item:hover {
    background: #f9fafb;
}

.conversation-item.active {
    background: #ede9fe;
}

/* Avatar */
.conv-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
    position: relative;
}

.conv-avatar.chatbox { background: #7c3aed; }
.conv-avatar.whatsapp { background: #25d366; }
.conv-avatar.telegram { background: #0088cc; }
.conv-avatar.telegram_bot { background: #229ED9; }

.conv-avatar .platform-icon {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* Conversation Content */
.conv-content {
    flex: 1;
    min-width: 0;
}

.conv-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.conv-name {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-time {
    font-size: 11px;
    color: #9ca3af;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 8px;
}

.conv-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.conv-last-msg {
    font-size: 13px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.conv-badges {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    margin-left: 8px;
}

.mode-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.mode-badge.ai {
    background: #dcfce7;
    color: #16a34a;
}

.mode-badge.human {
    background: #fef3c7;
    color: #d97706;
}

/* ==================== CHAT AREA ==================== */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f0f2f5;
    min-width: 0;
}

/* Empty State */
.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #9ca3af;
}

.chat-empty h3 {
    font-size: 18px;
    color: #6b7280;
}

.chat-empty p {
    font-size: 14px;
}

/* Active Chat */
.chat-active {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Chat Header */
.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.back-btn {
    display: none;
    width: 34px;
    height: 34px;
    border: none;
    background: none;
    cursor: pointer;
    color: #6b7280;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
}

.back-btn:hover {
    background: #f3f4f6;
}

.chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.chat-header-info {
    flex: 1;
    min-width: 0;
}

.chat-header-name {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
}

.chat-header-meta {
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

.platform-badge {
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.platform-badge.chatbox {
    background: #ede9fe;
    color: #7c3aed;
}

.platform-badge.whatsapp {
    background: #dcfce7;
    color: #16a34a;
}

.platform-badge.telegram {
    background: #dbeafe;
    color: #2563eb;
}

.platform-badge.telegram_bot {
    background: #e0f2fe;
    color: #0284c7;
}

.status-badge {
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.status-badge.idle {
    background: #f3f4f6;
    color: #6b7280;
}

.status-badge.in_conversation {
    background: #fef3c7;
    color: #d97706;
}

.status-badge.closed {
    background: #f3f4f6;
    color: #9ca3af;
}

.chat-header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.mode-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: #ef4444;
    color: #fff;
}

.mode-btn.ai-mode {
    background: #22c55e;
}

/* ==================== MESSAGES ==================== */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #f0f2f5;
}

.messages-container::-webkit-scrollbar {
    width: 5px;
}

.messages-container::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

/* Message Bubble */
.message {
    display: flex;
    flex-direction: column;
    max-width: 65%;
    animation: msgIn 0.15s ease;
}

@keyframes msgIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes msgPop {
    0% { opacity: 0; transform: translateY(20px) scale(0.9); }
    50% { transform: translateY(-4px) scale(1.02); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.message.new-msg {
    animation: msgPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Conversation flash on new message */
@keyframes convFlash {
    0% { background: transparent; box-shadow: none; }
    15% { background: #c4b5fd; box-shadow: inset 4px 0 0 #7c3aed; }
    30% { background: #ede9fe; }
    50% { background: #c4b5fd; box-shadow: inset 4px 0 0 #7c3aed; }
    100% { background: transparent; box-shadow: none; }
}

.conversation-item.flash {
    animation: convFlash 2s ease;
}

.conversation-item.has-new {
    background: #faf5ff;
    border-left: 3px solid #7c3aed;
}

/* Unread dot */
.unread-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #7c3aed;
    flex-shrink: 0;
    animation: unreadPulse 2s infinite;
}

@keyframes unreadPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(124, 58, 237, 0); }
}

.message.customer {
    align-self: flex-start;
}

.message.agent {
    align-self: flex-end;
}

.message-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.45;
    word-wrap: break-word;
    white-space: pre-wrap;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.message.customer .message-bubble {
    background: #fff;
    color: #1a1a2e;
    border-bottom-left-radius: 4px;
}

.message.agent .message-bubble {
    background: #7c3aed;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    padding: 0 4px;
}

.message-sender {
    font-size: 11px;
    font-weight: 500;
    color: #9ca3af;
}

.message-time {
    font-size: 11px;
    color: #9ca3af;
}

.message.agent .message-meta {
    justify-content: flex-end;
}

/* Date Separator */
.date-separator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    color: #9ca3af;
    font-size: 12px;
}

.date-separator::before,
.date-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    background: #f0f2f5;
    flex-shrink: 0;
}

.typing-dots {
    display: flex;
    gap: 3px;
}

.typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9ca3af;
    animation: typingBounce 1.4s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

.typing-text {
    font-size: 12px;
    color: #9ca3af;
    font-style: italic;
}

/* ==================== CHAT INPUT ==================== */
.chat-input {
    display: flex;
    gap: 10px;
    padding: 14px 20px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    align-items: flex-end;
    flex-shrink: 0;
    position: relative;
}

.chat-input textarea {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    resize: none;
    max-height: 120px;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input textarea:focus {
    border-color: #7c3aed;
}

.chat-input textarea::placeholder {
    color: #9ca3af;
}

.send-btn {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: #7c3aed;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.send-btn:hover {
    background: #6d28d9;
}

/* ==================== UTILITIES ==================== */
.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
}

/* ==================== LOGIN PAGE ==================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f2f5;
}

.login-card {
    background: #fff;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    width: 400px;
    max-width: 90%;
}

.login-card h1 {
    font-size: 24px;
    color: #7c3aed;
    margin-bottom: 8px;
}

.login-card p {
    color: #6b7280;
    margin-bottom: 24px;
}

.login-card input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    margin-bottom: 12px;
    outline: none;
}

.login-card input:focus {
    border-color: #7c3aed;
}

.login-card button {
    width: 100%;
    padding: 12px;
    background: #7c3aed;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.login-card button:hover {
    background: #6d28d9;
}

.login-error {
    color: #ef4444;
    font-size: 13px;
    margin-bottom: 12px;
    display: none;
}

/* ==================== BAN ==================== */
.ban-icon-btn:hover {
    color: #ef4444 !important;
    background: #fef2f2 !important;
}

.ban-icon-btn.banned {
    background: #ef4444 !important;
    color: #fff !important;
}

.ban-icon-btn.banned:hover {
    background: #22c55e !important;
    color: #fff !important;
}

.banned-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
    background: #fef2f2;
    color: #ef4444;
}

/* ==================== PROFILE SIDEBAR ==================== */
.profile-sidebar {
    position: fixed;
    top: 0;
    right: -340px;
    width: 340px;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0,0,0,0.1);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}

.profile-sidebar.open {
    right: 0;
}

.profile-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.profile-sidebar-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a2e;
}

.profile-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-close-btn:hover { background: #e5e7eb; }

.profile-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.profile-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
}

.profile-avatar-large {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 600;
    color: #fff;
}

.profile-name {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a2e;
}

.profile-platform-badge {
    font-size: 12px;
    padding: 3px 12px;
    border-radius: 12px;
    font-weight: 500;
}

.profile-platform-badge.chatbox { background: #ede9fe; color: #7c3aed; }
.profile-platform-badge.whatsapp { background: #dcfce7; color: #16a34a; }
.profile-platform-badge.telegram { background: #dbeafe; color: #2563eb; }
.profile-platform-badge.telegram_bot { background: #e0f2fe; color: #0284c7; }

.profile-info-card {
    background: #f9fafb;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.profile-info-card h4 {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.profile-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
}

.profile-info-row:last-child { border-bottom: none; }

.profile-info-label {
    font-size: 13px;
    color: #6b7280;
}

.profile-info-value {
    font-size: 13px;
    font-weight: 500;
    color: #1a1a2e;
    text-align: right;
    word-break: break-all;
    max-width: 60%;
}

.profile-notes {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    resize: none;
    outline: none;
    margin-bottom: 8px;
}

.profile-notes:focus { border-color: #7c3aed; }

.profile-save-btn {
    width: 100%;
    padding: 8px;
    border: none;
    border-radius: 8px;
    background: #7c3aed;
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.profile-save-btn:hover { background: #6d28d9; }

/* ==================== EMOJI PICKER ==================== */
.emoji-picker {
    position: absolute;
    bottom: 65px;
    left: 20px;
    width: 320px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    z-index: 50;
    overflow: hidden;
}

.emoji-search {
    padding: 10px 12px 6px;
}

.emoji-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
}

.emoji-search input:focus { border-color: #7c3aed; }

.emoji-categories {
    display: flex;
    gap: 2px;
    padding: 6px 12px;
    overflow-x: auto;
    border-bottom: 1px solid #f3f4f6;
}

.emoji-cat-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.emoji-cat-btn:hover { background: #f3f4f6; }
.emoji-cat-btn.active { background: #ede9fe; }

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    padding: 8px 12px 12px;
    max-height: 220px;
    overflow-y: auto;
}

.emoji-btn {
    width: 100%;
    aspect-ratio: 1;
    border: none;
    background: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emoji-btn:hover { background: #f3f4f6; transform: scale(1.2); }

/* ==================== CHAT TOOLBAR ==================== */
.chat-toolbar {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.toolbar-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    transition: all 0.2s;
}

.toolbar-btn:hover {
    background: #f3f4f6;
    color: #7c3aed;
}

/* ==================== CANNED MESSAGES POPUP ==================== */
.canned-popup {
    position: absolute;
    bottom: 70px;
    left: 20px;
    right: 20px;
    max-width: 420px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    flex-direction: column;
    max-height: 400px;
    z-index: 50;
    overflow: hidden;
}

.canned-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px 10px;
    border-bottom: 1px solid #f3f4f6;
}

.canned-popup-header h4 {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
}

.canned-close-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
}

.canned-close-btn:hover { background: #e5e7eb; }

.canned-popup-search {
    padding: 8px 16px;
}

.canned-popup-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
}

.canned-popup-search input:focus { border-color: #7c3aed; }

.canned-popup-categories {
    display: flex;
    gap: 6px;
    padding: 6px 16px;
    overflow-x: auto;
    flex-shrink: 0;
}

.canned-cat-btn {
    padding: 4px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #fff;
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    white-space: nowrap;
}

.canned-cat-btn.active {
    background: #7c3aed;
    border-color: #7c3aed;
    color: #fff;
}

.canned-popup-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px;
    max-height: 200px;
}

.canned-item {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    margin-bottom: 4px;
}

.canned-item:hover { background: #f9fafb; }

.canned-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.canned-shortcut {
    font-size: 12px;
    font-weight: 600;
    color: #7c3aed;
    background: #ede9fe;
    padding: 2px 6px;
    border-radius: 4px;
}

.canned-title {
    font-size: 13px;
    font-weight: 500;
    color: #1a1a2e;
    flex: 1;
}

.canned-item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.canned-item:hover .canned-item-actions { opacity: 1; }

.canned-edit-btn, .canned-delete-btn {
    width: 26px;
    height: 26px;
    border: none;
    background: none;
    cursor: pointer;
    color: #9ca3af;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.canned-edit-btn:hover { color: #7c3aed; background: #ede9fe; }
.canned-delete-btn:hover { color: #ef4444; background: #fef2f2; }

.canned-item-text {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
}

.canned-empty {
    text-align: center;
    color: #9ca3af;
    font-size: 13px;
    padding: 20px 0;
}

.canned-popup-footer {
    padding: 8px 16px 12px;
    border-top: 1px solid #f3f4f6;
}

.canned-add-btn {
    width: 100%;
    padding: 8px;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #7c3aed;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.canned-add-btn:hover { background: #faf5ff; border-color: #7c3aed; }

/* Canned Form */
.canned-form {
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    border-top: 1px solid #e5e7eb;
    background: #faf5ff;
}

.canned-form h4 {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 4px;
}

.canned-form input, .canned-form textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    resize: none;
}

.canned-form input:focus, .canned-form textarea:focus { border-color: #7c3aed; }

.canned-form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.canned-form-cancel {
    padding: 6px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    color: #6b7280;
}

.canned-form-save {
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    background: #7c3aed;
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.canned-form-save:hover { background: #6d28d9; }

/* ==================== SLASH DROPDOWN ==================== */
.slash-dropdown {
    position: absolute;
    bottom: 70px;
    left: 60px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    min-width: 240px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 50;
    padding: 6px;
}

.slash-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
}

.slash-item:hover { background: #f9fafb; }

.slash-shortcut {
    font-size: 13px;
    font-weight: 600;
    color: #7c3aed;
}

.slash-title {
    font-size: 13px;
    color: #6b7280;
}

/* ==================== TOAST ==================== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1a1a2e;
    color: #fff;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 10;
        transition: transform 0.3s;
    }

    .sidebar.hidden {
        transform: translateX(-100%);
    }

    .back-btn {
        display: flex;
    }

    .chat-area {
        width: 100%;
    }
}
