/* Ajustes visuais (set/2026) - carregado por ultimo para prevalecer. */

/* 1) Pipeline: colunas com largura minima (rolagem horizontal se nao couber) e card simples (nome + telefone). */
.pipeline-board {
    grid-template-columns: repeat(8, minmax(200px, 1fr)) !important;
    overflow-x: auto !important;
    padding-bottom: 8px;
}
.pipeline-column-cards { gap: 8px !important; padding: 8px 2px !important; }
.pipeline-card.pl-simple {
    display: block !important;
    padding: 10px 12px !important;
    border-radius: 10px !important;
    background: #1f2021 !important;
    border: 1px solid rgba(255, 255, 255, 0.07) !important;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
    gap: 0 !important;
}
.pipeline-card.pl-simple:hover { border-color: #25D366 !important; background: #242626 !important; }
.pipeline-card.pl-simple .pl-name {
    font-size: 13px !important;
    font-weight: 600;
    color: #e9edef;
    line-height: 1.3 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 !important;
}
.pipeline-card.pl-simple .pl-phone {
    font-size: 12px !important;
    color: #8696a0;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
body.light .pipeline-card.pl-simple { background: #ffffff !important; border-color: #e5e7eb !important; }
body.light .pipeline-card.pl-simple:hover { border-color: #25D366 !important; }
body.light .pipeline-card.pl-simple .pl-name { color: #111b21; }
body.light .pipeline-card.pl-simple .pl-phone { color: #667781; }

/* 3) Contatos: busca com o mesmo visual dos outros campos do CRM. */
.contacts-search-wrap input {
    background: var(--input-bg, #2E2F2F) !important;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08)) !important;
    border-radius: 12px !important;
    color: #e2e8f0 !important;
}
.contacts-search-wrap input:focus { border-color: #25D366 !important; }
body.light .contacts-search-wrap input { background: #f0f2f5 !important; color: #111b21 !important; border-color: #e5e7eb !important; }

/* 5) Configuracoes > Bandeiras */
#sectionBandeiras .bandeira-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; max-width: 520px; }
#sectionBandeiras .bandeira-row .form-input { flex: 1; }
#sectionBandeiras .bandeira-del { background: none; border: none; color: #8696a0; cursor: pointer; padding: 6px 8px; font-size: 14px; }
#sectionBandeiras .bandeira-del:hover { color: #ef4444; }
#sectionBandeiras .bandeira-add { display: flex; gap: 8px; align-items: center; margin-top: 14px; max-width: 520px; }
#sectionBandeiras .bandeira-add .form-input { flex: 1; }
#sectionBandeiras .bandeira-actions { margin-top: 16px; display: flex; gap: 12px; align-items: center; }
#sectionBandeiras .bandeira-msg, #sectionBandeiras .bandeira-empty { color: #8696a0; font-size: 13px; }
#sectionBandeiras .bandeira-save { padding: 10px 18px; border-radius: 10px; border: none; cursor: pointer; color: #fff; font-weight: 600; }

/* 4) Contatos: 5 cards na prateleira (Total, Abertos, Fechados, Ativos, Custo total). */
.contacts-summary-row { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 900px) { .contacts-summary-row { grid-template-columns: 1fr; } }

/* Produtos por bandeira (set/2026): sub-abas dentro de Configuracoes > Produtos. */
.produtos-bandeira-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.produtos-bandeira-tab { background: #262827; color: #d1d7db; border: 1px solid rgba(255,255,255,.08); border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
.produtos-bandeira-tab:hover { border-color: #25D366; }
.produtos-bandeira-tab.active { background: #25D366; color: #fff; border-color: #25D366; }
.produtos-bandeira-tab .pb-count { display: inline-block; min-width: 18px; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: rgba(0,0,0,.25); font-size: 11px; }
.produtos-bandeira-empty { color: #8696a0; font-size: 13px; padding: 10px 2px; }
.produto-bandeira-label { color: #8696a0; font-size: 13px; margin-bottom: 10px; }
body.light .produtos-bandeira-tab { background: #f0f2f5; color: #111b21; border-color: #e5e7eb; }
body.light .produtos-bandeira-tab.active { background: #25D366; color: #fff; }

/* Marcador da bandeira (set/2026): "ticket" com a cor da bandeira, na lista de conversas e no cabecalho do chat. */
.crm-bandeira-tag { --bd: #8696a0; display: inline-flex; align-items: center; gap: 5px; max-width: 100%; margin-top: 4px; padding: 2px 9px 2px 7px; border-radius: 4px 999px 999px 4px; border-left: 3px solid var(--bd); background: color-mix(in srgb, var(--bd) 20%, transparent); color: color-mix(in srgb, var(--bd) 55%, #ffffff); font-size: 10px; font-weight: 700; letter-spacing: .03em; line-height: 14px; text-transform: uppercase; white-space: nowrap; overflow: hidden; vertical-align: middle; box-sizing: border-box; }
.crm-bandeira-tag i { font-size: 9px; color: var(--bd); flex: 0 0 auto; }
.crm-bandeira-tag span { overflow: hidden; text-overflow: ellipsis; }
body.light .crm-bandeira-tag { color: color-mix(in srgb, var(--bd) 65%, #000000); }
.crm-bandeira-tag--header { margin: 0 0 0 10px; font-size: 11px; padding: 3px 10px 3px 8px; }
.chat-bandeira-badge { display: none; align-items: center; }
#sectionBandeiras .bandeira-row { max-width: 760px; }
#sectionBandeiras .bandeira-add { max-width: 760px; }
#sectionBandeiras .bandeira-cor { width: 40px; height: 38px; padding: 3px; border: 1px solid rgba(255,255,255,.12); border-radius: 8px; background: transparent; cursor: pointer; flex: 0 0 auto; }
#sectionBandeiras .bandeira-preview { flex: 0 0 auto; max-width: 220px; overflow: hidden; }
#sectionBandeiras .bandeira-preview .crm-bandeira-tag { margin-top: 0; }

/* Marcador no card: coluna da direita, abaixo da data e acima do setor/canal. */
.conv-meta .crm-bandeira-tag--card { align-self: flex-end; margin: 2px 0 1px; max-width: 140px; font-size: 9px; padding: 1px 7px 1px 5px; line-height: 13px; }
.conv-meta .crm-bandeira-tag--card i { font-size: 8px; }

/* Opcao A (set/2026): faixa lateral na cor da bandeira + ponto com o nome ao lado da data. */
.conv-item.has-bandeira { position: relative; }
.conv-item.has-bandeira::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--bd, #8696a0); pointer-events: none; z-index: 1; }
.crm-bandeira-dot { --bd: #8696a0; display: inline-flex; align-items: center; gap: 5px; margin-right: 6px; max-width: 120px; vertical-align: middle; color: color-mix(in srgb, var(--bd) 60%, #ffffff); font-size: 10px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-bandeira-dot i { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--bd); box-shadow: 0 0 0 2px color-mix(in srgb, var(--bd) 25%, transparent); }
body.light .crm-bandeira-dot { color: color-mix(in srgb, var(--bd) 70%, #000000); }

/* Painel "Informacoes do Contato" (set/2026): visual mais limpo + foto ampliavel. */
#customerInfoSidebar { background: #111b21 !important; box-shadow: -8px 0 24px rgba(0,0,0,.35); }
#customerInfoSidebar .modal-header { padding: 16px 18px !important; background: #1a2329; border-bottom: 1px solid rgba(255,255,255,.06) !important; }
#customerInfoSidebar .modal-header h3 { color: #e9edef !important; font-size: 15px !important; font-weight: 600; letter-spacing: .01em; }
#customerInfoSidebar .modal-header span[onclick] { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #aebac1 !important; font-size: 22px !important; line-height: 1; transition: background .15s, color .15s; }
#customerInfoSidebar .modal-header span[onclick]:hover { background: rgba(255,255,255,.08); color: #ff5c5c !important; }
#customerInfoSidebar .customer-info-card { padding: 0 0 20px !important; text-align: center; }
#customerInfoSidebar .customer-info-card > .customer-info-avatar { margin: 26px auto 14px !important; }
#customerInfoSidebar #infoAvatar { position: relative; width: 132px !important; height: 132px !important; box-shadow: 0 0 0 3px #111b21, 0 0 0 5px #25D366, 0 10px 24px rgba(0,0,0,.35); overflow: hidden; }
#customerInfoSidebar #infoAvatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
#customerInfoSidebar #infoAvatar.ci-zoomable { cursor: zoom-in; }
#customerInfoSidebar #infoAvatar.ci-zoomable::after { content: '\f00e'; font-family: 'Font Awesome 6 Free', 'Font Awesome 5 Free'; font-weight: 900; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 26px; color: #fff; background: rgba(0,0,0,.45); border-radius: 50%; opacity: 0; transition: opacity .18s; }
#customerInfoSidebar #infoAvatar.ci-zoomable:hover::after { opacity: 1; }
#customerInfoSidebar #infoName { color: #e9edef !important; font-size: 20px !important; margin: 0 !important; line-height: 1.3; }
#customerInfoSidebar .customer-info-card > div:nth-child(2) { padding: 0 18px; margin-bottom: 18px; }
#customerInfoSidebar .customer-info-card > div:nth-child(2) .fa-pen { padding: 6px; border-radius: 50%; }
#customerInfoSidebar .customer-info-card > div:nth-child(2) .fa-pen:hover { color: #25D366 !important; background: rgba(37,211,102,.1); }
#customerInfoSidebar .customer-info-grid { margin: 0 14px; gap: 0 !important; background: #1a2329; border: 1px solid rgba(255,255,255,.05); border-radius: 12px; overflow: hidden; text-align: left; }
#customerInfoSidebar .customer-info-item { flex-direction: column; align-items: flex-start !important; justify-content: flex-start !important; gap: 3px; padding: 12px 16px !important; border-bottom: 1px solid rgba(255,255,255,.05) !important; }
#customerInfoSidebar .customer-info-item:last-of-type { border-bottom: none !important; }
#customerInfoSidebar .customer-info-label { display: flex; align-items: center; gap: 7px; color: #8696a0 !important; font-size: 11px !important; font-weight: 600 !important; text-transform: uppercase; letter-spacing: .06em; }
#customerInfoSidebar .customer-info-label i { width: 14px; text-align: center; color: #25D366; font-size: 11px; }
#customerInfoSidebar .customer-info-value { color: #e9edef !important; font-size: 14px !important; text-align: left !important; line-height: 1.4; word-break: break-word; padding-left: 21px; }
#customerInfoSidebar .customer-info-value .fa-pen, #customerInfoSidebar .customer-info-value .fa-edit, #customerInfoSidebar .customer-info-value .fa-pencil-alt { color: #8696a0; margin-left: 6px; cursor: pointer; }
#customerInfoSidebar .ci-hist-wrap { padding: 16px 14px 0 !important; }
#customerInfoSidebar .ci-hist-wrap button { background: transparent !important; border: 1px solid rgba(37,211,102,.5) !important; color: #25D366 !important; border-radius: 10px !important; padding: 11px !important; font-size: 14px; transition: background .15s; }
#customerInfoSidebar .ci-hist-wrap button:hover { background: rgba(37,211,102,.1) !important; }
#customerInfoSidebar #historyList { padding: 10px 14px 0 18px !important; max-height: 340px !important; text-align: left; }
#customerInfoSidebar #historyList > div { position: relative; background: transparent !important; margin: 0 !important; padding: 0 0 14px 16px !important; border-left: 2px solid rgba(37,211,102,.35); border-radius: 0 !important; font-size: 13px !important; color: #d1d7db; line-height: 1.4; }
#customerInfoSidebar #historyList > div::before { content: ''; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: #25D366; box-shadow: 0 0 0 3px #111b21; }
#customerInfoSidebar #historyList > div:last-child { border-left-color: transparent; }
#customerInfoSidebar #historyList > div > div:first-child { font-size: 11px; margin-bottom: 2px; }
body.light #customerInfoSidebar { background: #f0f2f5 !important; }
body.light #customerInfoSidebar .modal-header { background: #ffffff; border-bottom-color: #e5e7eb !important; }
body.light #customerInfoSidebar .modal-header h3, body.light #customerInfoSidebar #infoName, body.light #customerInfoSidebar .customer-info-value { color: #111b21 !important; }
body.light #customerInfoSidebar .customer-info-grid { background: #ffffff; border-color: #e5e7eb; }
body.light #customerInfoSidebar .customer-info-item { border-bottom-color: #eef0f2 !important; }
body.light #customerInfoSidebar #infoAvatar { box-shadow: 0 0 0 3px #f0f2f5, 0 0 0 5px #25D366, 0 10px 24px rgba(0,0,0,.15); }
body.light #customerInfoSidebar #historyList > div { color: #3b4a54; }
body.light #customerInfoSidebar #historyList > div::before { box-shadow: 0 0 0 3px #f0f2f5; }

/* Foto ampliada */
.ci-lightbox { position: fixed; inset: 0; z-index: 99999; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(8,12,15,.88); backdrop-filter: blur(4px); cursor: zoom-out; animation: ciFade .16s ease; }
.ci-lightbox img { max-width: min(90vw, 640px); max-height: 78vh; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.6); object-fit: contain; background: #111b21; }
.ci-lightbox .ci-lb-name { color: #e9edef; font-size: 16px; font-weight: 600; }
.ci-lightbox .ci-lb-close { position: absolute; top: 18px; right: 22px; width: 40px; height: 40px; border-radius: 50%; border: none; background: rgba(255,255,255,.1); color: #fff; font-size: 22px; cursor: pointer; }
.ci-lightbox .ci-lb-close:hover { background: rgba(255,255,255,.2); }
@keyframes ciFade { from { opacity: 0; } to { opacity: 1; } }
