/* ============================================================
   NextChatAi — Inbox 3-pane layout (page-specific)
   ============================================================ */

.inbox-body { flex: 1; display: flex; overflow: hidden; }

/* Conversation list pane */
.conv-list-pane {
  width: 300px; flex-shrink: 0; background: #fff;
  border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden;
}
.conv-search-wrap { padding: 14px 16px 10px; border-bottom: 1px solid var(--border); position: relative; }
.conv-search {
  width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px 8px 34px; font-size: 13px; font-family: 'DM Sans', sans-serif; color: var(--ink); outline: none;
}
.conv-search:focus { border-color: var(--accent-mid); }
.conv-search-wrap svg {
  position: absolute; left: 26px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--muted); pointer-events: none;
}
.filter-tabs { display: flex; padding: 10px 12px 0; gap: 2px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.ftab {
  font-size: 12px; font-weight: 500; padding: 6px 10px; cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; border-radius: 4px 4px 0 0; white-space: nowrap;
}
.ftab.active { color: var(--ink); border-bottom-color: var(--ink); }
.ftab:hover:not(.active) { color: var(--ink); }
.conv-items { flex: 1; overflow-y: auto; }
.conv-items::-webkit-scrollbar { width: 3px; }
.conv-items::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
.conv-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 13px 16px;
  border-bottom: 1px solid #f0ede6; cursor: pointer; transition: background .1s; position: relative;
  animation: fadeUp .25s ease both;
}
.conv-item:hover { background: #fafaf8; }
.conv-item.active { background: var(--accent-light); border-right: 2px solid var(--accent-mid); }
.conv-item.unread .conv-item-name { font-weight: 600; }
.unread-pip { position: absolute; left: 5px; top: 50%; transform: translateY(-50%); width: 5px; height: 5px; background: var(--accent-mid); border-radius: 50%; }
.c-avatar {
  width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.conv-item-name { font-size: 13.5px; color: var(--ink); margin-bottom: 3px; }
.conv-item-preview { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.conv-item-meta { margin-left: auto; text-align: right; flex-shrink: 0; }
.conv-item-time { font-size: 10.5px; color: var(--muted); margin-bottom: 4px; }

/* Chat pane */
.chat-pane { flex: 1; display: flex; flex-direction: column; background: var(--surface); overflow: hidden; }
.chat-header { background: #fff; border-bottom: 1px solid var(--border); padding: 0 24px; height: 64px; display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.chat-header-info { flex: 1; }
.chat-header-name { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700; letter-spacing: -.2px; }
.chat-header-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.chat-header-actions { display: flex; align-items: center; gap: 8px; }
.ai-toggle-wrap { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; }
.ai-toggle-label { font-size: 12px; font-weight: 500; color: var(--muted); }
.action-btn {
  display: flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px;
  font-size: 12.5px; font-weight: 500; cursor: pointer; border: 1px solid var(--border); background: #fff; transition: all .15s; color: var(--ink);
}
.action-btn:hover { background: var(--surface); }
.action-btn svg { width: 14px; height: 14px; }
.action-btn.danger { color: var(--red); border-color: #fecaca; background: #fff5f5; }
.action-btn.danger:hover { background: #fee2e2; }
.action-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.action-btn.primary:hover { background: #145c3d; }

/* Messages */
.messages-area { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.messages-area::-webkit-scrollbar { width: 4px; }
.messages-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
.day-divider { text-align: center; font-size: 11px; font-weight: 500; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.day-divider::before, .day-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.msg-group { display: flex; flex-direction: column; gap: 4px; }
.msg-row { display: flex; align-items: flex-end; gap: 8px; }
.msg-row.out { flex-direction: row-reverse; }
.msg-avatar {
  width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif; font-size: 10px; font-weight: 700; color: #fff; flex-shrink: 0; margin-bottom: 2px;
}
.bubble { max-width: 420px; padding: 10px 14px; border-radius: 16px; font-size: 13.5px; line-height: 1.55; animation: fadeUp .2s ease both; }
.bubble.in { background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 4px; color: var(--ink); }
.bubble.out { background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.bubble.ai-out { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.bubble-time { font-size: 10.5px; color: var(--muted); padding: 0 4px; flex-shrink: 0; margin-bottom: 4px; }
.bubble-time.right { text-align: right; }
.ai-indicator { display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--violet); font-weight: 500; margin-bottom: 2px; }
.ai-indicator svg { width: 12px; height: 12px; }
.handover-banner {
  display: flex; align-items: center; gap: 10px; background: var(--amber-light); border: 1px solid #fde68a;
  border-radius: 10px; padding: 10px 16px; font-size: 12.5px; color: var(--amber);
}
.handover-banner svg { width: 16px; height: 16px; flex-shrink: 0; }
.handover-banner strong { font-weight: 600; }

/* Order card in chat */
.order-bubble { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; max-width: 300px; font-size: 13px; }
.order-bubble-title { font-family: 'Syne', sans-serif; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .06em; }
.order-bubble-item { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.order-bubble-total { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 8px; font-weight: 600; display: flex; justify-content: space-between; }

/* Typing indicator */
.typing-bubble { display: flex; align-items: center; gap: 4px; background: #fff; border: 1px solid var(--border); padding: 10px 14px; border-radius: 16px; border-bottom-left-radius: 4px; width: fit-content; }
.typing-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: typingBounce .8s ease-in-out infinite; }
.typing-dot:nth-child(2) { animation-delay: .15s; }
.typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes typingBounce { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-5px); opacity: 1; } }

/* Input */
.input-area { background: #fff; border-top: 1px solid var(--border); padding: 16px 24px; flex-shrink: 0; }
.ai-mode-bar { display: flex; align-items: center; gap: 8px; background: var(--violet-light); border-radius: 8px 8px 0 0; padding: 7px 14px; font-size: 12px; color: var(--violet); font-weight: 500; }
.ai-mode-bar svg { width: 13px; height: 13px; }
.input-box { display: flex; align-items: flex-end; gap: 10px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.input-box.ai-active { border-top-left-radius: 0; border-top-right-radius: 0; border-top-color: #c4b5fd; }
.msg-textarea { flex: 1; resize: none; background: transparent; border: none; outline: none; font-family: 'DM Sans', sans-serif; font-size: 14px; color: var(--ink); padding: 13px 14px; line-height: 1.5; max-height: 120px; }
.msg-textarea::placeholder { color: #aaa; }
.input-actions { display: flex; align-items: center; gap: 6px; padding: 10px 12px; }
.input-icon-btn { width: 32px; height: 32px; border-radius: 7px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted); transition: all .15s; }
.input-icon-btn:hover { background: var(--border); color: var(--ink); }
.input-icon-btn svg { width: 17px; height: 17px; }
.send-btn { width: 34px; height: 34px; border-radius: 8px; background: var(--ink); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all .15s; flex-shrink: 0; }
.send-btn:hover { background: var(--accent); }
.send-btn svg { width: 16px; height: 16px; color: #fff; }
.send-btn.ai-send { background: var(--accent); }

/* Detail pane */
.detail-pane { width: 270px; flex-shrink: 0; background: #fff; border-left: 1px solid var(--border); display: flex; flex-direction: column; overflow-y: auto; }
.detail-pane::-webkit-scrollbar { width: 3px; }
.detail-pane::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
.detail-section { padding: 18px 20px; border-bottom: 1px solid var(--border); }
.detail-section-title { font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.customer-hero { text-align: center; padding: 24px 20px 20px; border-bottom: 1px solid var(--border); }
.customer-avatar-lg { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: 'Syne', sans-serif; font-size: 20px; font-weight: 700; color: #fff; margin: 0 auto 12px; }
.customer-name { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700; margin-bottom: 3px; }
.customer-sub { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.customer-tags { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
.ctag { font-size: 11px; font-weight: 500; padding: 3px 8px; border-radius: 99px; border: 1px solid var(--border); color: var(--muted); }
.detail-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; }
.detail-row:last-child { margin-bottom: 0; }
.detail-icon { width: 30px; height: 30px; border-radius: 7px; background: var(--surface); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.detail-icon svg { width: 14px; height: 14px; color: var(--muted); }
.detail-key { font-size: 11px; color: var(--muted); }
.detail-val { font-size: 13px; font-weight: 500; }
.order-mini { background: var(--surface); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; font-size: 12.5px; }
.order-mini:last-child { margin-bottom: 0; }
.order-mini-top { display: flex; justify-content: space-between; margin-bottom: 4px; }
.order-mini-id { font-family: 'Syne', sans-serif; font-size: 11px; font-weight: 700; color: var(--muted); }
.order-mini-status { font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 99px; }
.s-c { background: var(--accent-light); color: var(--accent); }
.s-p { background: var(--amber-light); color: var(--amber); }
.s-f { background: var(--blue-light); color: var(--blue); }
.order-mini-item { color: var(--ink); margin-bottom: 2px; }
.order-mini-price { color: var(--muted); font-size: 12px; }
.note-textarea { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; font-family: 'DM Sans', sans-serif; color: var(--ink); resize: none; outline: none; line-height: 1.5; }
.note-textarea:focus { border-color: var(--accent-mid); }
