:root {
  --purple: #a855f7;
  --purple-dark: #7e22ce;
  --purple-glow: #a855f744;
  --green: #22c55e;
  --green-dark: #15803d;
  --red: #ef4444;
  --yellow: #eab308;
  --bg: #0f0a19;
  --bg-card: #1a1228;
  --bg-panel: #171021;
  --border: #2d1f42;
  --text: #e4e6eb;
  --text-mute: #9ca3af;
}
* { margin: 0; padding: 0; box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
body { background: var(--bg); color: var(--text); height: 100vh; overflow: hidden; }

.topbar {
  height: 56px; background: linear-gradient(90deg, #1a1228 0%, #241238 100%);
  border-bottom: 1px solid var(--purple-dark);
  display: flex; align-items: center; padding: 0 20px; gap: 20px;
  box-shadow: 0 2px 12px var(--purple-glow);
}
.logo { font-weight: 800; font-size: 18px; color: var(--purple); letter-spacing: .3px; }
.logo::before { content: "⚡ "; }
.search { flex: 1; max-width: 400px; }
.search input { width: 100%; padding: 8px 14px; background: #14091f; border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 13px; }
.search input:focus { outline: none; border-color: var(--purple); }
.user-info { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.status-ok { color: var(--green); }
.status-off { color: var(--red); }
.avatar { width: 32px; height: 32px; background: linear-gradient(135deg, var(--purple), var(--purple-dark)); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff; }

.main { display: flex; height: calc(100vh - 56px); }

/* SIDEBAR */
.sidebar { width: 280px; background: var(--bg-panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.sidebar-header h3 { font-size: 14px; font-weight: 600; }
.badge { background: var(--purple); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.conv-list { flex: 1; overflow-y: auto; }
.empty { padding: 20px; text-align: center; color: var(--text-mute); font-size: 12px; }
.conv { padding: 12px 16px; border-bottom: 1px solid #1e1330; cursor: pointer; display: flex; gap: 10px; transition: background .2s; }
.conv:hover { background: #1f1530; }
.conv.active { background: linear-gradient(90deg, #2d1f42 0%, #1a1228 100%); border-left: 3px solid var(--purple); padding-left: 13px; }
.conv-avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--purple), var(--purple-dark)); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; color: white; flex-shrink: 0; }
.conv-info { flex: 1; min-width: 0; }
.conv-name { font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; }
.conv-time { font-size: 11px; color: var(--text-mute); font-weight: 400; }
.conv-preview { font-size: 12px; color: var(--text-mute); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-tags { display: flex; gap: 4px; margin-top: 4px; align-items: center; }
.tag { font-size: 10px; padding: 1px 6px; border-radius: 6px; font-weight: 600; }
.pay-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.pay-red { background: var(--red); }
.pay-yellow { background: var(--yellow); }
.pay-green { background: var(--green); }
.unread-dot { width: 8px; height: 8px; background: var(--purple); border-radius: 50%; align-self: center; }

/* CHAT */
.chat { width: 380px; background: var(--bg); display: flex; flex-direction: column; border-right: 1px solid var(--border); flex-shrink: 0; }
.chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-mute); gap: 8px; }
.chat-empty div { font-size: 40px; }
.chat-container { display: flex; flex-direction: column; height: 100%; }
.chat-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; background: linear-gradient(90deg, #1a1228 0%, var(--bg) 100%); }
.chat-header .conv-avatar { width: 36px; height: 36px; font-size: 13px; }
.chat-header-info h4 { font-size: 14px; font-weight: 600; }
.chat-header-info p { font-size: 11px; color: var(--green); }
.chat-actions { margin-left: auto; display: flex; gap: 6px; }
.chat-actions button { background: #2d1f42; border: none; color: var(--text-mute); padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 11px; font-weight: 600; }
.chat-actions button:hover { background: var(--purple-dark); color: white; }
.messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 80%; padding: 10px 13px; border-radius: 12px; font-size: 13px; line-height: 1.45; position: relative; }
.msg.cliente { background: #1f1530; align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.atendente { background: linear-gradient(135deg, var(--purple), var(--purple-dark)); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; font-weight: 500; }
.msg.ia { background: linear-gradient(135deg, #16a34a, var(--green-dark)); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; font-weight: 500; }
.msg.ia::after { content: "🤖 auto"; position: absolute; top: -7px; right: 6px; font-size: 9px; background: #14091f; color: var(--text-mute); padding: 1px 5px; border-radius: 8px; font-weight: 600; border: 1px solid var(--border); }
.msg-time { font-size: 10px; opacity: .7; margin-top: 3px; }
.chat-input { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; }
.chat-input input { flex: 1; background: #1f1530; border: 1px solid var(--border); color: var(--text); padding: 10px 14px; border-radius: 20px; font-size: 13px; }
.chat-input input:focus { outline: none; border-color: var(--purple); }
.chat-input button { background: linear-gradient(135deg, var(--purple), var(--purple-dark)); color: #fff; border: none; padding: 8px 18px; border-radius: 20px; font-weight: 600; cursor: pointer; font-size: 13px; }

/* KANBAN */
.kanban { flex: 1; overflow-x: auto; overflow-y: hidden; display: flex; gap: 8px; padding: 12px; background: radial-gradient(ellipse at top, #1a1228 0%, var(--bg) 50%); }
.col { width: 225px; background: var(--bg-panel); border-radius: 10px; display: flex; flex-direction: column; flex-shrink: 0; max-height: 100%; }
.col-header { padding: 10px 12px; font-size: 12px; font-weight: 700; border-bottom: 2px solid; display: flex; justify-content: space-between; align-items: center; text-transform: uppercase; letter-spacing: .5px; }
.col-count { font-size: 11px; background: #2d1f42; padding: 1px 7px; border-radius: 10px; font-weight: 600; }
.col-novo { border-top: 3px solid var(--purple); } .col-novo .col-header { color: var(--purple); border-color: var(--purple-dark); }
.col-aten { border-top: 3px solid #2563eb; } .col-aten .col-header { color: #60a5fa; border-color: #1e3a8a; }
.col-orc { border-top: 3px solid #ca8a04; } .col-orc .col-header { color: #fbbf24; border-color: #78350f; }
.col-arte { border-top: 3px solid #c026d3; } .col-arte .col-header { color: #e879f9; border-color: #86198f; }
.col-pag { border-top: 3px solid #ea580c; } .col-pag .col-header { color: #fb923c; border-color: #7c2d12; }
.col-prod { border-top: 3px solid var(--red); background: linear-gradient(180deg, #2a0a14 0%, var(--bg-panel) 30%); } .col-prod .col-header { color: #f87171; border-color: #7f1d1d; }
.col-prod .col-header::after { content: "🔒 só 🟢"; font-size: 9px; background: #450a0a; padding: 2px 6px; border-radius: 4px; letter-spacing: 0; color: #fca5a5; font-weight: 600; margin-left: 6px; }
.col-pronto { border-top: 3px solid var(--green); } .col-pronto .col-header { color: #34d399; border-color: var(--green-dark); }
.col-feed { border-top: 3px solid #047857; } .col-feed .col-header { color: #6ee7b7; border-color: #022c22; }
.col-inusi { border-top: 3px solid #db2777; } .col-inusi .col-header { color: #f472b6; border-color: #831843; }
.cards { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }

.card { background: var(--bg-card); border-radius: 8px; padding: 10px; cursor: pointer; border-left: 3px solid transparent; transition: all .2s; position: relative; }
.card:hover { background: #241839; transform: translateY(-1px); }
.card.paid { background: linear-gradient(90deg, #0f2d1e 0%, var(--bg-card) 70%); border-left-color: var(--green); }
.card.partial { background: linear-gradient(90deg, #2d2410 0%, var(--bg-card) 70%); border-left-color: var(--yellow); }
.card.urgent { border-left-color: var(--red); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; gap: 6px; }
.card-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.card-price { font-size: 11px; color: var(--green); font-weight: 700; flex-shrink: 0; }
.card-desc { font-size: 11px; color: var(--text-mute); line-height: 1.3; margin-bottom: 6px; }
.card-footer { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-mute); align-items: center; }
.pay-status { font-size: 10px; font-weight: 700; padding: 2px 5px; border-radius: 4px; }
.pay-status.red { background: #450a0a; color: #fca5a5; }
.pay-status.yellow { background: #422006; color: #fde047; }
.pay-status.green { background: #052e16; color: #86efac; }

/* DETALHE */
.detail { width: 340px; background: var(--bg-panel); border-left: 1px solid var(--border); flex-shrink: 0; display: flex; flex-direction: column; overflow-y: auto; }
.detail-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: linear-gradient(90deg, #1a1228 0%, var(--bg-panel) 100%); }
.detail-header h4 { font-size: 14px; font-weight: 600; color: var(--purple); }
.detail-close { background: transparent; border: none; color: var(--text-mute); cursor: pointer; font-size: 18px; }
.detail-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

/* SCROLL */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-panel); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--purple-dark); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #450a0a; color: #fca5a5; padding: 10px 18px; border-radius: 8px; font-size: 13px; font-weight: 600; border: 1px solid #7f1d1d; display: none; z-index: 100; }
.toast.show { display: flex; gap: 8px; align-items: center; }
.toast.ok { background: #052e16; color: #86efac; border-color: #15803d; }
