/* ── Kanban ── */
.kanban-board{display:flex;gap:1rem;overflow-x:auto;padding-bottom:1rem;min-height:500px}
.kanban-column{flex:0 0 280px;background:#111827;border:1px solid #1f2937;border-radius:.75rem;padding:1rem;display:flex;flex-direction:column;gap:.75rem}
.kanban-card{background:#1f2937;border:1px solid #374151;border-radius:.5rem;padding:.75rem;cursor:grab;transition:all .15s}
.kanban-card:hover{border-color:#111827;transform:translateY(-1px);box-shadow:0 4px 12px rgba(17,24,39,.25)}
.kanban-card.dragging{opacity:.5;cursor:grabbing}
.kanban-column.drag-over{background:#1a2235;border-color:#111827}

/* ── Chat layout ── */
.chat-container{display:flex;height:calc(100dvh - 4rem);min-height:400px;overflow:hidden}
.chat-sidebar{width:320px;flex-shrink:0;border-right:1px solid #1f2937;overflow-y:auto;display:flex;flex-direction:column}
.chat-main{flex:1;display:flex;flex-direction:column;overflow:hidden;min-width:0}
.chat-messages{flex:1;overflow-y:auto;padding:1rem;display:flex;flex-direction:column;align-items:stretch;gap:.375rem}

/* ── Bolhas ── */
.message-bubble{max-width:72%;padding:.5rem .875rem;border-radius:1rem;font-size:.875rem;line-height:1.45;word-break:break-word;position:relative}
.message-bubble.outbound{background:#111827;color:white;align-self:flex-end;border-bottom-right-radius:.25rem;margin-left:auto}
.message-bubble.inbound{background:#1f2937;color:#e5e7eb;align-self:flex-start;border-bottom-left-radius:.25rem;margin-right:auto}
.message-bubble .msg-time{font-size:10px;opacity:.55;margin-top:3px;text-align:right;display:flex;align-items:center;justify-content:flex-end;gap:3px}
.message-bubble.inbound .msg-time{justify-content:flex-start}

/* Status ticks */
.tick{display:inline-block;font-size:11px;line-height:1}
.tick.sent{opacity:.6}
.tick.delivered{opacity:.8}
.tick.read{color:#60a5fa}

/* ── Respostas rapidas ── */
.quick-replies-popup{position:absolute;bottom:100%;left:0;right:0;background:#111827;border:1px solid #374151;border-radius:.5rem .5rem 0 0;max-height:220px;overflow-y:auto;z-index:10}
.quick-reply-item{padding:.5rem .875rem;cursor:pointer;font-size:.8125rem;border-bottom:1px solid #1f2937;display:flex;gap:.75rem;align-items:flex-start}
.quick-reply-item:hover{background:#1f2937}
.quick-reply-item .shortcut{color:#111827;font-weight:600;flex-shrink:0;min-width:60px}
.quick-reply-item .preview{color:#9ca3af;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* ── Notificacao toast ── */
#toast{position:fixed;top:1rem;right:1rem;z-index:9999;display:flex;flex-direction:column;gap:.5rem;pointer-events:none}
.toast-item{background:#1f2937;border:1px solid #374151;border-radius:.5rem;padding:.625rem 1rem;font-size:.8125rem;color:#f9fafb;pointer-events:auto;animation:slideIn .2s ease;max-width:280px}
.toast-item.error{border-color:#f87171;color:#f87171}
.toast-item.success{border-color:#34d399;color:#34d399}
@keyframes slideIn{from{opacity:0;transform:translateX(20px)}to{opacity:1;transform:translateX(0)}}

/* ── Mobile ── */
@media(max-width:768px){
  .chat-container{height:calc(100dvh - 3.5rem);position:relative}
  .chat-sidebar{position:absolute;inset:0;z-index:20;width:100%;transition:transform .2s}
  .chat-sidebar.slide-out{transform:translateX(-100%)}
  .chat-main{width:100%}
  .btn-back-sidebar{display:flex!important}
}
.btn-back-sidebar{display:none;align-items:center;gap:.5rem;background:transparent;border:none;color:#9ca3af;cursor:pointer;font-size:.875rem;padding:.25rem 0;margin-bottom:.5rem}

/* ── Componentes gerais ── */
.badge{display:inline-flex;align-items:center;padding:.125rem .625rem;border-radius:9999px;font-size:.75rem;font-weight:500}
.crm-table{width:100%;border-collapse:collapse}
.crm-table th{padding:.75rem 1rem;text-align:left;font-size:.75rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:#6b7280;border-bottom:1px solid #1f2937}
.crm-table td{padding:.875rem 1rem;font-size:.875rem;color:#d1d5db;border-bottom:1px solid #111827}
.crm-table tr:hover td{background:#111827}
.modal-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.7);z-index:50;display:flex;align-items:center;justify-content:center;padding:1rem}
.modal-box{background:#1f2937;border:1px solid #374151;border-radius:.75rem;padding:1.5rem;width:100%;max-width:520px;max-height:90vh;overflow-y:auto}
.form-input{width:100%;background:#111827;border:1px solid #374151;color:#f9fafb;border-radius:.5rem;padding:.5rem .75rem;font-size:.875rem;transition:border-color .15s}
.form-input:focus{outline:none;border-color:#111827;box-shadow:0 0 0 3px rgba(17,24,39,.25)}
.form-label{display:block;font-size:.8125rem;font-weight:500;color:#9ca3af;margin-bottom:.375rem}
.btn-primary{display:inline-flex;align-items:center;gap:.5rem;background:#111827;color:white;border:none;padding:.5rem 1rem;border-radius:.5rem;font-size:.875rem;font-weight:500;cursor:pointer;transition:background .15s;text-decoration:none}
.btn-primary:hover{background:#1f2937}
.btn-secondary{display:inline-flex;align-items:center;gap:.5rem;background:#374151;color:#d1d5db;border:1px solid #4b5563;padding:.5rem 1rem;border-radius:.5rem;font-size:.875rem;font-weight:500;cursor:pointer;transition:all .15s;text-decoration:none}
.btn-secondary:hover{background:#4b5563;color:white}
.btn-danger{display:inline-flex;align-items:center;gap:.5rem;background:transparent;color:#f87171;border:1px solid #f87171;padding:.4rem .875rem;border-radius:.5rem;font-size:.8125rem;cursor:pointer;transition:all .15s}
.btn-danger:hover{background:#f87171;color:white}
::-webkit-scrollbar{width:6px;height:6px}
::-webkit-scrollbar-track{background:#111827}
::-webkit-scrollbar-thumb{background:#374151;border-radius:3px}


.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop.hidden {
    display: none !important;
}

.modal-box {
    width: 100%;
    max-width: 560px;
    background: #111827;
    border: 1px solid #374151;
    border-radius: 14px;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-close {
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
}

.modal-title {
    color: #fff;
    font-size: 20px;
    font-weight: 600;
}


.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    color: #d1d5db;
    font-size: 14px;
    margin-bottom: 8px;
}

.form-input,
textarea.form-input {
    width: 100%;
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 10px;
    padding: 12px;
    color: #fff;
    font-size: 14px;
    box-sizing: border-box;
}

textarea.form-input {
    min-height: 140px;
    resize: vertical;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}


/* ── Tema Claro/Escuro ── */
:root {
  --bg-primary: #111827;
  --bg-secondary: #1f2937;
  --bg-tertiary: #374151;
  --bg-hover: #1a2235;
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --text-muted: #9ca3af;
  --border-color: #374151;
  --border-light: #1f2937;
}

html.light-mode {
  --bg-primary: #ffffff;
  --bg-secondary: #f3f4f6;
  --bg-tertiary: #e5e7eb;
  --bg-hover: #f0f0f0;
  --text-primary: #111827;
  --text-secondary: #374151;
  --text-muted: #6b7280;
  --border-color: #d1d5db;
  --border-light: #e5e7eb;
}

html.light-mode body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

html.light-mode aside {
  background-color: var(--bg-secondary);
  border-right-color: var(--border-light);
}

html.light-mode header {
  background-color: var(--bg-secondary);
  border-bottom-color: var(--border-light);
}

html.light-mode .bg-gray-900 {
  background-color: var(--bg-secondary);
}

html.light-mode .bg-gray-950 {
  background-color: var(--bg-primary);
}

html.light-mode .border-gray-800 {
  border-color: var(--border-light);
}

html.light-mode .text-white {
  color: var(--text-primary);
}

html.light-mode .text-gray-300 {
  color: var(--text-secondary);
}

html.light-mode .text-gray-400 {
  color: var(--text-muted);
}

html.light-mode .text-gray-500 {
  color: #9ca3af;
}

html.light-mode .hover\:bg-gray-800:hover {
  background-color: var(--bg-hover);
}

html.light-mode .form-input {
  background-color: var(--bg-primary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

html.light-mode .form-input:focus {
  border-color: var(--border-color);
}

html.light-mode .btn-primary {
  background-color: #4f46e5;
  color: white;
}

html.light-mode .btn-primary:hover {
  background-color: #4338ca;
}

html.light-mode .crm-table th {
  color: var(--text-muted);
  border-bottom-color: var(--border-light);
}

html.light-mode .crm-table td {
  color: var(--text-secondary);
  border-bottom-color: var(--border-light);
}

html.light-mode .crm-table tr:hover td {
  background-color: var(--bg-hover);
}

html.light-mode .modal-box {
  background-color: var(--bg-secondary);
  border-color: var(--border-color);
}

html.light-mode .divide-y.divide-gray-800 > * {
  border-bottom-color: var(--border-light);
}

html.light-mode .bg-gray-800\/30 {
  background-color: rgba(243, 244, 246, 0.3);
}

html.light-mode .bg-gray-800\/40 {
  background-color: rgba(243, 244, 246, 0.4);
}

html.light-mode .bg-gray-800\/5 {
  background-color: rgba(243, 244, 246, 0.05);
}

html.light-mode .bg-gray-800\/50 {
  background-color: rgba(243, 244, 246, 0.5);
}

/* ── Theme Toggle Button ── */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.theme-toggle:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

/* ── Versão Light (Simplificada) ── */
html.light-version {
  --sidebar-width: 56px;
}

html.light-version aside {
  width: 56px;
}

html.light-version .md\:pl-64 {
  padding-left: 56px;
}

html.light-version aside nav p,
html.light-version aside nav span:not(.badge) {
  display: none;
}

html.light-version aside nav a svg {
  margin: 0 auto;
}

html.light-version aside nav a {
  justify-content: center;
  padding: 12px;
}

html.light-version .sidebar-label {
  display: none;
}

html.light-version .sidebar-expanded-only {
  display: none;
}

.system-note{background:#1e3a2f;color:#6ee7b7;font-size:11px;padding:4px 10px;border-radius:6px;margin:4px auto;text-align:center;max-width:90%;opacity:.7;font-style:italic;}
