/* Chat demo — realistic mockup styles (multi-tab v2) */

.chat-frame {
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 40px 80px -40px rgba(0,0,0,0.18), 0 8px 20px -10px rgba(0,0,0,0.08);
  font-family: var(--sans);
  color: var(--ink);
  height: 660px;
  display: flex;
  flex-direction: column;
}

.chat-chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #f7f4ef;
  border-bottom: 1px solid var(--line);
}
.chat-dots { display: flex; gap: 6px; }
.chat-dots span { width: 11px; height: 11px; border-radius: 50%; }
.chat-url {
  display: inline-flex; align-items: center; gap: 6px;
  background: white; border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 12px; font-size: 11.5px; color: var(--ink-3);
  font-family: var(--mono);
}

.chat-body {
  flex: 1;
  display: grid;
  grid-template-columns: 200px 1fr;
  min-height: 0;
}

/* Sidebar v2 — bigger labels, clearer */
.chat-rail-v2 {
  background: #faf7f2;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 14px;
}
.chat-rail__logo { padding: 4px 6px 6px; }
.chat-rail-v2__items {
  display: flex; flex-direction: column; gap: 2px;
}
.chat-rail-v2__btn {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border: 0; background: transparent;
  border-radius: 9px;
  color: var(--ink-2);
  font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}
.chat-rail-v2__btn:hover {
  background: rgba(0,0,0,0.04);
  color: var(--ink);
}
.chat-rail-v2__btn.is-active {
  background: var(--ink);
  color: white;
}
.chat-rail-v2__icon {
  position: relative;
  display: inline-flex;
}
.chat-rail-v2__dot {
  position: absolute;
  top: -2px; right: -3px;
  width: 7px; height: 7px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 2px #faf7f2;
}
.chat-rail-v2__label { flex: 1; }

/* Tab content area */
.chat-tab-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.chat-tab-pane {
  padding: 22px 24px;
  overflow-y: auto;
  flex: 1;
}

/* ── Conversas tab ── */
.chat-grid-conv {
  flex: 1;
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 0;
}

.chat-list {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.chat-list__head {
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 10px;
}
.chat-list__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.chat-icon-btn {
  width: 28px; height: 28px;
  border: 0; background: transparent;
  border-radius: 7px;
  color: var(--ink-3);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.chat-icon-btn:hover { background: rgba(0,0,0,0.05); color: var(--ink); }

.chat-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-warm);
  border-radius: 9px;
  padding: 7px 10px;
  color: var(--ink-3);
}
.chat-search input {
  flex: 1; border: 0; background: transparent;
  font: inherit; font-size: 12.5px; color: var(--ink); outline: none;
}
.chat-tabs {
  display: flex; gap: 2px;
  background: var(--bg-warm);
  padding: 3px;
  border-radius: 9px;
}
.chat-tab {
  flex: 1;
  padding: 5px 6px;
  border: 0; background: transparent;
  font: inherit; font-size: 11.5px; font-weight: 500;
  color: var(--ink-3);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.chat-tab:hover { color: var(--ink); }
.chat-tab.is-active {
  background: white; color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.chat-list__body { flex: 1; overflow-y: auto; }

.chat-row {
  width: 100%;
  display: flex; gap: 12px;
  padding: 12px 14px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}
.chat-row:hover { background: rgba(0,0,0,0.02); }
.chat-row.is-selected { background: var(--accent-soft); }
.chat-row.is-selected .chat-row__name { color: var(--accent-deep); }

.chat-avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  color: var(--ink); flex-shrink: 0;
}
.chat-avatar--sm { width: 32px; height: 32px; font-size: 11px; }
.chat-avatar--lg { width: 56px; height: 56px; font-size: 17px; border-radius: 14px; }

.chat-row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.chat-row__top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.chat-row__name {
  font-size: 13px; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-row__time { font-size: 11px; color: var(--ink-3); flex-shrink: 0; }
.chat-row__bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.chat-row__last {
  font-size: 12px; color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1;
}
.chat-row__unread {
  background: var(--accent); color: white;
  font-size: 10px; font-weight: 600;
  border-radius: 999px; padding: 2px 6px;
  min-width: 16px; text-align: center; flex-shrink: 0;
}
.chat-row__meta {
  display: flex; gap: 6px; align-items: center; margin-top: 4px;
}
.chat-tag {
  font-size: 10px; font-weight: 500;
  padding: 2px 7px; border-radius: 999px;
  letter-spacing: 0.02em;
}
.chat-tag--open { background: rgba(13, 148, 136, 0.1); color: #0d7d70; }
.chat-tag--waiting { background: rgba(234, 88, 12, 0.12); color: var(--accent-deep); }
.chat-tag--resolved { background: rgba(0,0,0,0.06); color: var(--ink-3); }
.chat-row__tag { font-size: 10.5px; color: var(--ink-3); font-weight: 500; }

/* Thread */
.chat-thread {
  display: flex; flex-direction: column; min-height: 0;
  background: #faf8f4;
}
.chat-thread__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  background: white;
  border-bottom: 1px solid var(--line);
}
.chat-thread__body {
  flex: 1; overflow-y: auto;
  padding: 20px 24px;
  display: flex; flex-direction: column; gap: 10px;
}
.chat-day {
  align-self: center;
  font-size: 11px; color: var(--ink-3);
  letter-spacing: 0.06em; text-transform: uppercase;
  margin: 4px 0 14px;
}
.chat-msg { display: flex; flex-direction: column; max-width: 70%; }
.chat-msg--them { align-self: flex-start; align-items: flex-start; }
.chat-msg--us { align-self: flex-end; align-items: flex-end; }
.chat-msg__agent {
  font-size: 10.5px; color: var(--ink-3);
  margin-bottom: 3px; margin-right: 8px; font-weight: 500;
}
.chat-msg__bubble {
  padding: 9px 14px 8px;
  border-radius: 14px;
  font-size: 13.5px; line-height: 1.45;
  position: relative; word-break: break-word;
}
.chat-msg--them .chat-msg__bubble {
  background: white; border: 1px solid var(--line);
  border-bottom-left-radius: 4px; color: var(--ink);
}
.chat-msg--us .chat-msg__bubble {
  background: #d8f0d4; color: #1a3a17;
  border-bottom-right-radius: 4px;
}
.chat-msg__time {
  display: inline-block; margin-left: 8px;
  font-size: 10px; color: rgba(0,0,0,0.45);
  vertical-align: baseline;
}
.chat-attached {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; margin-bottom: 6px;
  background: rgba(0,0,0,0.05);
  border-radius: 8px;
  font-size: 12px; color: var(--ink-2);
}

.chat-composer {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  background: white; border-top: 1px solid var(--line);
}
.chat-composer input {
  flex: 1; border: 0;
  font: inherit; font-size: 13.5px;
  color: var(--ink); outline: none;
  padding: 8px 6px;
}
.chat-send {
  width: 34px; height: 34px;
  border: 0; border-radius: 10px;
  background: var(--accent); color: white;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.15s ease;
}
.chat-send:hover { background: var(--accent-deep); transform: scale(1.04); }

/* ── Contatos tab ── */
.contacts-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
}
.contacts-list {
  display: flex; flex-direction: column; gap: 6px;
}
.contact-card {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  cursor: pointer; text-align: left;
  font: inherit;
  transition: all 0.15s ease;
}
.contact-card:hover { border-color: var(--line-strong); }
.contact-card.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.contact-detail {
  background: var(--bg-warm);
  border-radius: 12px;
  padding: 18px;
}
.detail-rows {
  display: flex; flex-direction: column; gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.detail-row {
  display: flex; justify-content: space-between; align-items: center;
}
.chat-mini-btn {
  flex: 1;
  padding: 8px 12px;
  border: 0; border-radius: 8px;
  background: var(--ink); color: white;
  font: inherit; font-size: 12px; font-weight: 500;
  cursor: pointer;
}
.chat-mini-btn:hover { background: var(--accent); }
.chat-mini-btn--ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-strong);
}
.chat-mini-btn--ghost:hover { background: white; color: var(--ink); }

/* ── Relatórios tab ── */
.period-btn {
  padding: 7px 14px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 999px;
  font: inherit; font-size: 12.5px; font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s ease;
}
.period-btn:hover { border-color: var(--line-strong); }
.period-btn.is-active {
  background: var(--ink); color: white; border-color: var(--ink);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  padding: 16px;
  background: var(--bg-warm);
  border-radius: 12px;
}
.chart-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
}
.bars {
  display: flex; align-items: flex-end; gap: 14px;
  height: 180px;
  padding-top: 14px;
}
.bar-col {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  height: 100%;
}
.bar {
  width: 100%; max-width: 36px;
  background: var(--accent);
  border-radius: 6px 6px 0 0;
  position: relative;
  transition: height 0.4s ease;
  min-height: 4px;
}
.bar:hover { background: var(--accent-deep); }
.bar-val {
  position: absolute;
  top: -16px; left: 50%; transform: translateX(-50%);
  font-size: 10px; color: var(--ink-3); font-weight: 500;
}
.bar-lbl {
  font-size: 11px; color: var(--ink-3);
}

/* ── Chatbot tab ── */
.bot-toggle {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px;
  background: var(--bg-warm);
  border-radius: 12px;
  margin-bottom: 20px;
}
.chat-toggle {
  width: 38px; height: 22px;
  border: 0; background: rgba(0,0,0,0.18);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s ease;
}
.chat-toggle.is-on { background: var(--accent); }
.chat-toggle span {
  position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 999px;
  background: white;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.chat-toggle.is-on span { transform: translateX(16px); }

.bot-flow {
  display: flex; flex-direction: column;
}
.bot-step-wrap { display: flex; flex-direction: column; align-items: center; }
.bot-step {
  width: 100%;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 11px;
  cursor: pointer; text-align: left; font: inherit;
  transition: all 0.15s ease;
}
.bot-step:hover { border-color: var(--line-strong); }
.bot-step.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.bot-step-num {
  width: 26px; height: 26px;
  border-radius: 999px;
  background: var(--ink); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  flex-shrink: 0;
}
.bot-step.is-active .bot-step-num { background: var(--accent); }
.bot-connector {
  width: 1px; height: 16px;
  background: var(--line-strong);
}
.bot-add {
  margin-top: 14px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border: 1px dashed var(--line-strong);
  background: transparent;
  border-radius: 9px;
  font: inherit; font-size: 12px; color: var(--ink-3);
  cursor: pointer; align-self: flex-start;
  transition: all 0.15s ease;
}
.bot-add:hover {
  border-color: var(--accent);
  color: var(--accent-deep);
}

/* ── Mini Kanban (CRM tab inside chat demo) ── */
.kanban-mini {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.kanban-col {
  background: var(--bg-warm);
  border-radius: 10px;
  padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.kanban-col__head {
  display: flex; align-items: center; gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--line-strong);
}
.kanban-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}
.kanban-mv {
  flex: 1;
  height: 26px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 6px;
  font: inherit; font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
}
.kanban-mv:hover { background: var(--accent); color: white; border-color: var(--accent); }

/* ── Full CRM Kanban (section-crm.jsx) ── */
.crm-kanban-full {
  display: grid;
  grid-template-columns: repeat(5, minmax(180px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.crm-col {
  background: var(--bg-warm);
  border-radius: 12px;
  padding: 12px;
  min-width: 180px;
  display: flex; flex-direction: column; gap: 8px;
  border: 2px dashed transparent;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.crm-col.is-hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.crm-col__head {
  display: flex; align-items: center; gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--line-strong);
}
.crm-card {
  background: white;
  border-radius: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  font-size: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  cursor: grab;
  transition: all 0.15s ease;
}
.crm-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}
.crm-card:active { cursor: grabbing; }
.crm-card.is-dragging {
  opacity: 0.5;
  transform: scale(0.98);
}
.crm-mv {
  flex: 1;
  height: 24px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 6px;
  font: inherit; font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s ease;
}
.crm-mv:hover:not(:disabled) {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.crm-mv:disabled { opacity: 0.35; cursor: not-allowed; }

@media (max-width: 900px) {
  .crm-kanban-full { grid-template-columns: repeat(5, 200px) !important; }
}

/* Responsive */
@media (max-width: 1080px) {
  .chat-grid-conv { grid-template-columns: 240px 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .chat-frame { height: auto; }
  .chat-body { grid-template-columns: 1fr; }
  .chat-rail-v2 {
    flex-direction: row;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
  }
  .chat-rail-v2__items {
    flex-direction: row;
    flex: 1;
  }
  .chat-rail-v2__btn { flex: 1; justify-content: center; padding: 8px; }
  .chat-rail-v2__label { display: none; }
  .chat-grid-conv {
    grid-template-columns: 1fr;
    grid-template-rows: 280px auto;
  }
  .chat-list { border-right: 0; border-bottom: 1px solid var(--line); }
  .chat-thread { min-height: 480px; }
  .contacts-grid { grid-template-columns: 1fr; }
  .kanban-mini { grid-template-columns: repeat(2, 1fr); }
}
