/* ============================================================
   SOKOHAI CHAT UI v2 (2026-09)
   1) Orodha ya majina (inbox) = KADI zenye block-shadow
   2) Ndani ya mazungumzo = mandhari ya aina ya WhatsApp
   3) Search bar ya juu inafanya kazi kama chat search
   Faili hii inapakiwa MWISHO — inashinda za awali kwa makusudi.
   ============================================================ */

/* ---------------- 1. INBOX: KADI ZA MAJINA ---------------- */
.ch-inbox-shell { background: #eef3f8; }
.ch-inbox-scroll { padding: 10px 12px 90px !important; background: #eef3f8; }

.ch-inbox-sec {
    font-size: 12.5px; font-weight: 900; letter-spacing: .8px; text-transform: uppercase;
    color: #64748b; padding: 12px 4px 8px;
}

/* KADI: kila jina kwenye block yake yenye kivuli */
.ch-contact {
    position: relative;
    display: flex; gap: 12px; align-items: center;
    padding: 13px 14px !important;
    margin: 0 0 10px;
    background: #ffffff !important;
    border: 1px solid #e6edf5;
    border-bottom: 1px solid #e6edf5 !important;
    border-radius: 18px !important;
    box-shadow: 0 2px 4px rgba(15,23,42,.05), 0 8px 20px rgba(15,23,42,.07);
    cursor: pointer;
    transition: transform .16s cubic-bezier(.22,1,.36,1), box-shadow .16s ease, background .16s ease;
}
.ch-contact:hover {
    background: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(15,23,42,.06), 0 14px 30px rgba(15,23,42,.12);
}
.ch-contact:active { transform: translateY(0) scale(.995); }

/* Mstari wa rangi upande wa kushoto (hali ya kadi) */
.ch-contact::before {
    content: ''; position: absolute; left: 0; top: 14px; bottom: 14px;
    width: 4px; border-radius: 0 4px 4px 0; background: transparent; transition: .16s;
}
.ch-contact.ch-unread-row::before { background: #18A982; }
.ch-contact.ch-unread-row { background: #ffffff !important; }
.ch-contact.ch-pinned {
    background: #fffdf5 !important; border-color: #f5e3b3;
    border-left: none !important;
}
.ch-contact.ch-pinned::before { background: #d4af37; }
.ch-contact.active {
    background: #f2f9ff !important; border-color: #bfdcf5;
    box-shadow: 0 0 0 2px rgba(18,104,168,.18), 0 10px 24px rgba(18,104,168,.16);
}
.ch-contact.active::before { background: #18A982; }

.ch-cc-avatar { position: relative; flex-shrink: 0; }
.ch-cc-avatar img {
    width: 50px; height: 50px; border-radius: 16px; object-fit: cover;
    box-shadow: 0 3px 8px rgba(15,23,42,.14);
}
.ch-cc-avatar .ch-dot {
    position: absolute; right: -2px; top: -2px; width: 12px; height: 12px;
    border-radius: 50%; background: #18A982; border: 2.5px solid #fff;
}
.ch-cc-name { font-size: 14px; font-weight: 800; color: #0f172a; }
.ch-cc-msg { font-size: 12.2px; color: #6b7a8c; }
.ch-cc-msg.commerce { color: #0e7490; font-weight: 700; }
.ch-cc-time { font-size: 12.5px; color: #94a3b8; font-weight: 700; }
.ch-unread {
    background: #18A982; box-shadow: 0 2px 6px rgba(24,169,130,.45);
    padding: 3px 9px; font-size: 12.5px;
}
.ch-pin-btn { align-self: flex-start; }

/* Chips za vichujio */
.ch-inbox-chips {
    display: flex; gap: 7px; overflow-x: auto; padding: 10px 12px;
    background: #eef3f8; border-bottom: 1px solid #e2e8f0;
    scrollbar-width: none;
}
.ch-inbox-chips::-webkit-scrollbar { display: none; }
.ch-tab {
    flex: 0 0 auto; padding: 8px 15px; border-radius: 99px; border: 1px solid #dbe5ef;
    background: #fff; color: #475569; font-size: 13px; font-weight: 800; cursor: pointer;
    box-shadow: 0 1px 3px rgba(15,23,42,.06);
}
.ch-tab.active {
    background: #18A982; border-color: #18A982; color: #fff;
    box-shadow: 0 4px 12px rgba(18,104,168,.32);
}

/* Search ya inbox */
.ch-inbox-search {
    display: flex; align-items: center; gap: 9px; margin: 12px; padding: 11px 14px;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 16px;
    box-shadow: 0 2px 8px rgba(15,23,42,.06);
}
.ch-inbox-search input { flex: 1; border: none; outline: none; font-size: 13.5px; background: transparent; color: #0f172a; }

/* ---------------- 2. NDANI YA CHAT: MANDHARI YA WHATSAPP --------------- */
#chatMessages {
    background-color: #efe7dd !important;
    background-image:
        radial-gradient(circle at 12% 18%, rgba(255,255,255,.55) 0 2.2px, transparent 2.4px),
        radial-gradient(circle at 68% 42%, rgba(15,23,42,.045) 0 3px, transparent 3.2px),
        radial-gradient(circle at 34% 76%, rgba(15,23,42,.04) 0 2.4px, transparent 2.6px),
        radial-gradient(circle at 88% 88%, rgba(255,255,255,.5) 0 2px, transparent 2.2px),
        linear-gradient(180deg, #efe7dd 0%, #e9e0d6 100%) !important;
    background-size: 180px 180px, 220px 220px, 260px 260px, 200px 200px, 100% 100%;
    padding: 14px 10px 18px !important;
}
/* Chat stays light even when the device uses a dark OS theme. */
@media (prefers-color-scheme: dark) {
    #chatMessages {
        background-color: #efe7dd !important;
        background-image:
            radial-gradient(circle at 12% 18%, rgba(255,255,255,.55) 0 2.2px, transparent 2.4px),
            radial-gradient(circle at 68% 42%, rgba(15,23,42,.045) 0 3px, transparent 3.2px),
            linear-gradient(180deg, #efe7dd 0%, #e9e0d6 100%) !important;
    }
}

/* Mawingu ya WhatsApp: kijani kwa mimi, nyeupe kwa mwenzangu + mkia */
.ch-msg { margin-bottom: 8px; }
.ch-msg .chat-bubble {
    position: relative;
    border-radius: 12px !important;
    padding: 7px 10px 8px !important;
    box-shadow: 0 1px 1px rgba(11,20,26,.14) !important;
    font-size: 14px; line-height: 1.45;
}
.ch-msg[data-mine="0"] .chat-bubble {
    background: #ffffff !important; color: #111b21 !important;
    border: none !important; border-top-left-radius: 4px !important;
}
.ch-msg[data-mine="1"] .chat-bubble,
.ch-msg[data-mine="1"] .chat-bubble.me {
    background: #d9fdd3 !important; color: #111b21 !important;
    border: none !important; border-top-right-radius: 4px !important;
}
.ch-msg[data-mine="0"] .chat-bubble::after,
.ch-msg[data-mine="1"] .chat-bubble::after {
    content: ''; position: absolute; top: 0; width: 9px; height: 13px;
}
.ch-msg[data-mine="0"] .chat-bubble::after {
    left: -8px;
    background: radial-gradient(circle at 100% 0, transparent 9px, #ffffff 9.5px);
}
.ch-msg[data-mine="1"] .chat-bubble::after {
    right: -8px;
    background: radial-gradient(circle at 0 0, transparent 9px, #d9fdd3 9.5px);
}
/* Mfululizo wa ujumbe wa mtu mmoja: mkia mmoja tu */
.ch-msg.ch-same + .ch-msg.ch-same .chat-bubble::after { display: none; }

/* Muda na alama za kusoma */
.ch-msg .ch-time, .ch-msg .ch-meta-time { font-size: 12.5px; color: #667781; }
.ch-msg[data-mine="1"] .ch-ticks { color: #53bdeb; }

/* Upau wa kuandika */
#chatInputBar, .ch-composer { background: #f0f2f5 !important; }

/* ---------------- 3. Search bar ya juu ikiwa CHAT MODE --------------- */
.search-wrap.skh-chat-mode input {
    background: #e8f6f1 !important;
    border-color: #18A982 !important;
}
.skh-search-mode-badge {
    display: inline-flex; align-items: center; gap: 5px;
    background: #18A982; color: #fff; font-size: 12px; font-weight: 900;
    padding: 3px 8px; border-radius: 99px; letter-spacing: .4px;
}
/* Matokeo ya haraka chini ya search bar */
#skhSearchDrop {
    position: absolute; left: 0; right: 0; top: calc(100% + 8px);
    background: #fff; border: 1px solid #e2e8f0; border-radius: 18px;
    box-shadow: 0 18px 44px rgba(15,23,42,.18); z-index: 6000;
    max-height: 60vh; overflow-y: auto; padding: 8px; display: none;
}
#skhSearchDrop.open { display: block; }
.skh-sd-sec {
    font-size: 12.5px; font-weight: 900; letter-spacing: .7px; text-transform: uppercase;
    color: #94a3b8; padding: 9px 10px 5px;
}
.skh-sd-row {
    display: flex; align-items: center; gap: 10px; padding: 10px;
    border-radius: 13px; cursor: pointer; transition: background .14s;
}
.skh-sd-row:hover { background: #f1f6fb; }
.skh-sd-row img, .skh-sd-ic {
    width: 38px; height: 38px; border-radius: 11px; object-fit: cover;
    background: #eef2f7; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.skh-sd-tx { min-width: 0; flex: 1; }
.skh-sd-tx b { display: block; font-size: 13px; color: #0f172a; font-weight: 800;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.skh-sd-tx small { font-size: 13px; color: #64748b; display: block;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.skh-sd-empty { text-align: center; padding: 22px 12px; color: #94a3b8; font-size: 12.5px; font-weight: 600; }
.search-wrap { position: relative; }

/* ============================================================
   [2026-09-14] NYONGEZA — selectors HALISI za mfumo huu.
   Zimeandikwa baada ya zote ili zishinde inline/za awali.
   ============================================================ */

/* ---- FIX 3: orodha ya majina = kadi zenye block shadow ---- */
#inboxList { background: #eef3f8 !important; padding: 10px 12px 90px !important; }

#inboxList .ch-contact {
    background: #ffffff !important;
    border-radius: 14px !important;
    margin-bottom: 10px !important;
    padding: 12px 14px !important;
    border: 1px solid #e6edf5 !important;
    /* "kaukijan" block shadow — kivuli imara cha kublock */
    box-shadow: 0 2px 0 0 #d7e2ee, 0 6px 16px -6px rgba(15, 42, 77, .22) !important;
    transition: transform .14s ease, box-shadow .14s ease !important;
}
#inboxList .ch-contact:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 0 0 #cfdcea, 0 12px 22px -8px rgba(15, 42, 77, .3) !important;
}
#inboxList .ch-contact:active { transform: translateY(0) scale(.995) !important; }

/* mstari wa rangi upande wa kushoto */
#inboxList .ch-contact { position: relative !important; overflow: hidden !important; }
#inboxList .ch-contact::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: transparent; border-radius: 14px 0 0 14px;
}
#inboxList .ch-contact.ch-unread-row::before { background: #18A982; }
#inboxList .ch-contact.ch-unread-row {
    box-shadow: 0 2px 0 0 #bfe3d5, 0 6px 18px -6px rgba(24, 169, 130, .38) !important;
}

/* ---- FIX 4: ndani ya chat = mandhari ya WhatsApp ---- */
#chatMessages {
    background-color: #ECE5DD !important;
    background-image:
        radial-gradient(rgba(0,0,0,.045) 1px, transparent 1px),
        radial-gradient(rgba(0,0,0,.035) 1px, transparent 1px) !important;
    background-size: 22px 22px, 22px 22px !important;
    background-position: 0 0, 11px 11px !important;
}
/* viputo: kijani (changu) / cheupe (chake) — kama WhatsApp */
#chatMessages .chat-bubble.me,
#chatMessages .ch-msg[data-mine="1"] .chat-bubble {
    background: #DCF8C6 !important;
    color: #0b1f16 !important;
}
#chatMessages .chat-bubble.them,
#chatMessages .ch-msg[data-mine="0"] .chat-bubble {
    background: #ffffff !important;
    color: #111b21 !important;
}
#chatMessages .chat-bubble {
    box-shadow: 0 1px 1px rgba(11, 20, 26, .13) !important;
    border-radius: 9px !important;
}
#chatMessages .ch-meta, #chatMessages .ch-meta span { color: #667781 !important; }
#chatMessages .ch-tick { color: #53bdeb !important; }

/* ============ [2026-09 PHASE 2 §3 FINAL SPEC] SOGA LIST: aina 3 za mazungumzo zinatofautishwa ============
   Contact = #FFFFFF neutral; Discussion Group = #F1F7FC very-light blue tint;
   Group Order = #FFF9E8 very-light warm/gold tint + left accent + commerce indicator.
   Subtle partial tints, not heavy cards. */
.ch-contact { background: #FFFFFF !important; }
.ch-contact.ch-tint-group { background: #F1F7FC !important; }
.ch-contact.ch-tint-group.has-go { background: #FFF9E8 !important; border-left: 3.5px solid #E6C87A !important; }
.ch-contact.ch-tint-group-order { background: #FFF9E8 !important; border-left: 3.5px solid #E6C87A !important; }
.ch-contact.ch-tint-group-order::before { background: #D4AF37 !important; }
.ch-contact.ch-tint-order { background: #FFF9E8 !important; border-left: 3.5px solid #E6C87A !important; }
.ch-contact.ch-tint-order::before { background: #D4AF37 !important; }
.ch-contact.ch-tint-wholesale { background: #FFF9E8 !important; border-left: 3.5px solid #E6C87A !important; }
.ch-ord-kind {
    font-size: 9.5px; font-weight: 800; letter-spacing: .55px; text-transform: uppercase;
    color: #0f766e; background: #ffffff; border: 1px solid #cbe9dd; border-radius: 6px; padding: 2px 7px;
}
.ch-ord-status {
    display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; color: #0f766e;
}
.ch-ord-status .dot { width: 7px; height: 7px; border-radius: 50%; background: #18A982; display: inline-block; }

/* ============ [2026-09 FINAL SPEC 74-GROUP-ORDER-SYSTEM] WORKSPACE & WIZARD ============
   Design system #1268A8 #2B82BD #0B4F7A #18A982 #D8B83A #F6F9FC Inter
   Mobile first, accessibility, empty states, subtle commerce gold #FFF9E8 */
.go-workspace { font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif; background: #F6F9FC; min-height: 100%; }
.go-header { background: #FFF9E8; border: 1px solid #ead98a; border-left: 4px solid #D8B83A; border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; }
.go-header h2 { font-size: 16px; font-weight: 900; color: #0f172a; margin: 0; }
.go-header .go-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.go-badge { font-size: 10px; font-weight: 800; padding: 4px 10px; border-radius: 8px; border: 1px solid #e2e8f0; background: #fff; }
.go-badge--gold { color: #8a6d00; background: #fff; border-color: #ead98a; }
.go-badge--blue { color: #0B4F7A; background: #eef6fc; border-color: #d3e6f5; }
.go-badge--green { color: #0f766e; background: #f0faf6; border-color: #cbe9dd; }
.go-progress { height: 8px; border-radius: 99px; background: #f1e9c6; overflow: hidden; margin-top: 10px; }
.go-progress-bar { height: 100%; background: linear-gradient(90deg,#D8B83A,#18A982); transition: width .3s; }
.go-action-panel { background: #fff; border: 1.5px solid #D8B83A; border-radius: 12px; padding: 12px; margin-bottom: 12px; display: flex; gap: 10px; align-items: center; }
.go-action-panel--pay { border-color: #18A982; background: #eef6fc; }
.go-action-panel--confirm { border-color: #18A982; background: #f0faf6; }
.go-tabs { display: flex; gap: 2px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 12px; border-bottom: 1px solid #e2e8f0; scrollbar-width: none; }
.go-tabs::-webkit-scrollbar { display: none; }
.go-tab { border: none; background: #fff; color: #64748b; font-weight: 800; font-size: 11.5px; padding: 8px 14px; border-radius: 10px; white-space: nowrap; cursor: pointer; }
.go-tab.active { background: #18A982; color: #fff; }
.go-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.go-card--gold { background: #FFF9E8; border-color: #ead98a; border-left: 4px solid #D8B83A; }
.go-card--blue { background: #F1F7FC; border-color: #d3e6f5; }
.go-wizard { max-width: 520px; margin: 0 auto; background: #fff; border-radius: 20px; overflow: hidden; box-shadow: 0 20px 50px rgba(11,22,40,.35); }
.go-wiz-step { display: inline-flex; font-size: 9px; font-weight: 900; padding: 4px 8px; border-radius: 99px; border: 1.5px solid #e2e8f0; margin-right: 4px; }
.go-wiz-step.active { background: #18A982; color: #fff; border-color: #18A982; }
.go-wiz-step.done { background: #f0faf6; color: #0f766e; border-color: #18A982; }
.go-package { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-size: 12px; }
.go-shipment { border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px; margin-top: 8px; background: #fff; }
.go-timeline { display: flex; flex-direction: column; gap: 4px; }
.go-timeline-step { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.go-timeline-dot { width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; background: #f1f5f9; border: 1.5px solid #cbd5e1; }
.go-timeline-dot.done { background: #f0faf6; border-color: #18A982; }
.go-poll { border: 1px solid #d3e6f5; border-radius: 10px; padding: 10px; margin-top: 8px; background: #fff; }
.go-poll-option { display: flex; justify-content: space-between; padding: 6px 8px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; margin-top: 4px; font-size: 12px; }
.go-poll-option.leading { background: #FFFBE8; border-color: #ead98a; }
.go-empty { text-align: center; padding: 32px 18px; color: #94a3b8; background: #fff; border: 1px dashed #dbe4ed; border-radius: 14px; margin: 8px 4px; }
.go-audit { font-size: 10.5px; padding: 3px 0; border-bottom: 1px solid #f1f5f9; display: flex; gap: 8px; }
.go-fin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 11.5px; }
.go-commerce-indicator { display: inline-flex; align-items: center; gap: 4px; font-size: 9.5px; font-weight: 800; color: #8a6d00; background: #FFF9E8; border: 1px solid #ead98a; border-radius: 6px; padding: 2px 7px; }
.go-left-accent { border-left: 3.5px solid #E6C87A; }
@media (max-width: 640px) { .go-header, .go-card, .go-action-panel { padding: 12px; } .go-tabs { gap: 4px; } }
