:root {
  /* ---- marca ---- */
  --accent: #2F7DFF;
  --accent-dark: #1F66DB;          /* hover do azul */
  --accent-tint: #EAF2FF;
  /* ---- neutros (tema claro) ---- */
  --bg: #F4F6FB;
  --card: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #EEF2F8;
  --border: #E4E8F1;
  --border-strong: #D3D9E8;
  --text: #171C2C;
  --text-secondary: #5B6472;
  --muted: #97A0B0;
  --input-bg: #F4F6FB;
  /* ---- status (uso exclusivo pra estado) ---- */
  --ok: #1E9E5A;     --ok-tint: #E3F6EC;
  --warn: #B7860B;   --warn-tint: #FFF4D1;
  --danger: #E5484D; --danger-tint: #FDEBEC;
  --violet: #7B5EA7;
  /* ---- extras ---- */
  --grid-line: transparent;
  --grid-dot: #DDE3F0;
  --mark-bg: #FFE9A8;
  --badge-mix: 100%;
  --scrim: rgba(16, 25, 46, 0.45);
  --login-glow: #EAF0FE;
  /* ---- barra lateral ---- */
  --sidebar-bg: linear-gradient(180deg, #10192E 0%, #1B2850 100%);
  --sidebar-border: transparent;
  --nav-fg: #8791AB;
  --nav-fg-hover: #D3DAEC;
  --nav-hover-bg: rgba(255,255,255,0.07);
  --nav-active-bg: rgba(47, 125, 255, 0.20);
  --nav-active-fg: #7FB0FF;
  --nav-active-ring: rgba(127, 176, 255, 0.35);
  /* ---- tipografia ---- */
  --font-display: 'Unbounded', 'Plus Jakarta Sans', sans-serif;
  --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* ---- forma ---- */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 3px rgba(16, 25, 46, 0.06);
  --shadow-md: 0 6px 18px rgba(16, 25, 46, 0.09);
  --shadow-lg: 0 16px 40px rgba(16, 25, 46, 0.16);
  color-scheme: light;
}

/* ================= TEMA ESCURO — "sala de operações" ================= */
[data-theme="dark"] {
  --bg: #0E1316;
  --card: #161D21;
  --surface: #161D21;
  --surface-2: #1B242A;
  --border: #212B31;
  --border-strong: #2A353C;
  --text: #E7EEF1;
  --text-secondary: #8FA1AA;
  --muted: #5C6E77;
  --input-bg: #161D21;

  --accent: #2F7DFF;
  --accent-dark: #4C8FFF;          /* hover */
  --accent-tint: #12294F;

  --ok: #35D07F;     --ok-tint: #103322;
  --warn: #F2C94C;   --warn-tint: #3A310F;
  --danger: #FF5D5D; --danger-tint: #3A1414;
  --violet: #B48CFF;

  --grid-line: #0B0F12;
  --grid-dot: #1B242A;
  --mark-bg: #4A3F12;
  --badge-mix: 62%;
  --scrim: rgba(0, 0, 0, 0.62);
  --login-glow: #12294F;

  --sidebar-bg: #161D21;
  --sidebar-border: #212B31;
  --nav-fg: #8FA1AA;
  --nav-fg-hover: #E7EEF1;
  --nav-hover-bg: #1B242A;
  --nav-active-bg: #12294F;
  --nav-active-fg: #4C8FFF;
  --nav-active-ring: transparent;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background-color: var(--bg);
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  font-size: 14px;
}

h1, h2 {
  font-family: var(--font-body);
  margin: 0;
  letter-spacing: -0.01em;
  font-weight: 700;
}
/* Unbounded só nos títulos de página e de modal — o único ponto de personalidade forte */
h1, .kanban-modal h2 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; }

input, textarea, select { background: var(--input-bg); color: var(--text); }
input, textarea, select { border-color: var(--border-strong) !important; }
::placeholder { color: var(--muted); opacity: 1; }
.mono { font-family: var(--font-mono); }

button {
  font-family: inherit;
  cursor: pointer;
  transition: all .15s ease;
}
button:active { transform: scale(0.97); }
input, textarea, select {
  font-family: inherit;
  font-size: 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-tint);
}

.app {
  display: none;
  height: 100vh;
  overflow: hidden;
}

/* ---------- Login ---------- */
.login-screen {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 20%, var(--login-glow) 0%, var(--bg) 60%);
}

.login-box {
  width: 380px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: var(--shadow-lg);
}

.login-box h1 {
  font-size: 26px;
  margin-bottom: 8px;
  text-align: center;
}

.login-box label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.login-box input {
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  font-size: 15px;
  background: var(--bg);
}

.login-box button {
  margin-top: 10px;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 6px 16px rgba(47, 125, 255, 0.38);
}
.login-box button:hover { background: var(--accent-dark); transform: translateY(-1px); }

.login-error {
  color: var(--danger);
  font-size: 13px;
  text-align: center;
  margin: 0;
  font-weight: 600;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 92px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 0;
}

.logo-placeholder {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1.5px dashed var(--border-strong);
  margin-bottom: 34px;
  box-shadow: var(--shadow-sm);
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-btn {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  border: none;
  background: transparent;
  color: var(--nav-fg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn:hover {
  background: var(--nav-hover-bg);
  color: var(--nav-fg-hover);
}
.nav-btn.active {
  background: var(--nav-active-bg);
  color: var(--nav-active-fg);
  box-shadow: inset 0 0 0 1.5px var(--nav-active-ring);
}

/* ---------- Content shell ---------- */
.content {
  flex-grow: 1;
  min-width: 0;
  position: relative;
}

.view {
  display: none;
  height: 100%;
}

.view.active {
  display: flex;
  flex-direction: column;
}

.view-header {
  height: 84px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 32px;
  background: var(--card);
}
.view-header h1 { font-size: 22px; }

/* ---------- Inbox / Clientes shared list layout ---------- */
#view-inbox.active { flex-direction: row; }
#view-clientes.active { flex-direction: row; }

.conv-list {
  width: 380px;
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.conv-list-header {
  padding: 26px 22px 16px 22px;
}
.conv-list-header h1 { font-size: 23px; }

#conv-list-items {
  overflow-y: auto;
  flex-grow: 1;
  padding: 6px 12px 18px 12px;
}

.conv-item {
  display: flex;
  gap: 13px;
  padding: 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  margin-bottom: 4px;
  position: relative;
}

.unread-dot {
  position: absolute;
  right: 12px;
  top: 18px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

.conv-item:hover { background: var(--surface-2); }
.conv-item.selected {
  background: var(--accent-tint);
  box-shadow: inset 3px 0 0 var(--accent);
}

.avatar {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  background: var(--accent);
  box-shadow: none;
}

.conv-item-body { flex-grow: 1; min-width: 0; }

.conv-item-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.conv-name { font-weight: 700; font-size: 15px; }
.conv-time { font-size: 12px; color: var(--muted); font-weight: 600; }

.conv-preview {
  font-size: 13.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 3px;
}

.badge {
  display: inline-block;
  margin-top: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .01em;
  padding: 4px 10px;
  border-radius: 20px;
}

/* ---------- Chat panel ---------- */
.chat-panel {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

.chat-empty {
  margin: auto;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
}

.conv-side-panel {
  width: 320px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--card);
  display: flex;
  flex-direction: column;
}

.side-panel-icons {
  height: 84px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.side-panel-icon-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}
.side-panel-icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.side-panel-icon-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 5px 14px rgba(47, 125, 255, 0.35);
}

.side-panel-content {
  flex-grow: 1;
  overflow-y: auto;
  padding: 24px;
  font-size: 14px;
}
.side-panel-content h2 { font-size: 16px !important; }

.stage-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  margin-bottom: 3px;
}
.stage-option:hover { background: var(--bg); }
.stage-option.current { background: var(--accent-tint); }
.stage-option .check {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.stage-option.current .check {
  width: 19px;
  height: 19px;
}

.filter-chip {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
  white-space: nowrap;
}
.filter-chip:hover { border-color: var(--accent); }
.filter-chip.active {
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}

/* ---------- Chat header ---------- */
.chat-header {
  height: 84px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 32px;
  background: var(--card);
  position: relative;
}

.chat-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tag-group {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 6px 7px 6px 12px;
}

.tag-chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.tag-chip-row:empty::before {
  content: 'Sem etiquetas';
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.tag-toggle-btn {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  border: none;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}
.tag-toggle-btn:hover { background: var(--accent); color: #fff; }

.tags-popover {
  position: absolute;
  top: 76px;
  right: 24px;
  width: 280px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 16px;
  z-index: 20;
  font-size: 13px;
}

.chat-messages {
  flex-grow: 1;
  overflow-y: auto;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bubble {
  max-width: 440px;
  padding: 13px 17px;
  font-size: 15px;
  line-height: 1.55;
  box-shadow: var(--shadow-sm);
}

.bubble.in {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px 18px 18px 18px;
}

.bubble.out {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-radius: 18px 4px 18px 18px;
}

.chat-input {
  height: 84px;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--card);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 26px;
}

.chat-input input {
  flex-grow: 1;
  padding: 13px 17px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--bg);
  font-size: 15px;
}

.chat-input button {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(47, 125, 255, 0.32);
}
.chat-input button:hover { background: var(--accent-dark); transform: translateY(-1px); }

.chat-input #chat-attach-btn,
.chat-input #chat-mic-btn {
  background: transparent;
  border: 1.5px solid var(--border);
  box-shadow: none;
}
.chat-input #chat-attach-btn:hover,
.chat-input #chat-mic-btn:hover {
  border-color: var(--accent);
  background: var(--accent-tint);
  transform: none;
}

/* ---------- Kanban ---------- */
.kanban-board {
  flex-grow: 1;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;         /* a tela do funil fica parada; só a lista de cards de cada etapa rola */
  padding: 20px 26px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 272px;
  grid-template-rows: minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

/* Cada etapa é um bloco próprio: o cliente enxerga claramente quem está em qual etapa */
.kanban-col {
  width: 272px;
  flex-shrink: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: color-mix(in srgb, var(--surface) 70%, var(--bg, var(--surface-2)));
  border: 1px solid var(--border);
  border-top: 3px solid var(--stage, var(--accent));   /* faixa colorida da etapa */
  border-radius: 14px;
  padding: 14px 10px 0 10px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.18);
}

.kanban-col-header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 8px 14px 8px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.kanban-col-title {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .03em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.kanban-count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--surface-2);
  padding: 3px 10px;
  border-radius: 20px;
}

.kanban-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  flex: 1 1 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 2px 20px 2px;
}

.kanban-cards.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
  background: var(--accent-tint);
}

.kanban-modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.kanban-modal {
  width: 420px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px;
}
.kanban-modal label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-top: 16px;
  margin-bottom: 6px;
}
.kanban-modal select,
.kanban-modal input,
.kanban-modal textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  font-size: 14px;
}
.kanban-modal textarea { min-height: 90px; }

.kanban-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: grab;
  box-shadow: var(--shadow-sm);
}
.kanban-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); transform: translateY(-1px); }

.kanban-card.dragging { opacity: 0.4; }

.kanban-card-name { font-weight: 700; font-size: 14.5px; }

.kanban-card-device {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 3px;
}

.kanban-card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

/* ---------- WhatsApp connection ---------- */
.wa-box {
  padding: 44px;
  max-width: 440px;
}

.wa-status {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 18px;
}

.wa-status.connected { color: var(--ok); }
.wa-status.pending { color: var(--warn); }

.wa-box img {
  width: 270px;
  height: 270px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

/* ---------- Pill tabs (Follow-ups / Configurações) ---------- */
.fu-tab, .cfg-tab {
  padding: 9px 17px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--card);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-secondary);
}
.fu-tab:hover, .cfg-tab:hover { border-color: var(--accent); }
.fu-tab.active, .cfg-tab.active {
  background: var(--accent-tint);
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- Dashboard ---------- */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 34px;
}
.dash-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.dash-card:hover { box-shadow: var(--shadow-md); }
.dash-card .num {
  font-family: var(--font-body);
  letter-spacing: -0.02em;
  font-size: 32px;
  font-weight: 700;
}
.dash-card .label {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 5px;
  font-weight: 600;
}

/* ================= Status (verde / amarelo / vermelho — só pra estado) ================= */
.status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.warn  { background: var(--warn);   box-shadow: 0 0 0 3px var(--warn-tint); }
.status-dot.alert { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-tint); }
.status-dot.ok    { background: var(--ok);     box-shadow: 0 0 0 3px var(--ok-tint); }

.kanban-card.status-alert { border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.kanban-card.status-warn  { border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.t-warn  { color: var(--warn) !important; }
.t-alert { color: var(--danger) !important; }

/* contador "leitura de instrumento" */
.counter-line {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 6px;
  letter-spacing: 0;
}
.counter-line .alert { color: var(--danger); font-weight: 600; }

/* botão de tema */
.theme-toggle { margin-top: auto; }
.theme-toggle + .nav-btn { margin-top: 8px; }

/* hierarquia: só o botão principal é sólido e saturado; o resto é "ghost" */
.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border-strong);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* no escuro, sombras de brilho azul ficam discretas */
[data-theme="dark"] .login-box button,
[data-theme="dark"] .chat-input button,
[data-theme="dark"] .side-panel-icon-btn.active { box-shadow: none; }
[data-theme="dark"] .kanban-card:hover { transform: none; }

/* ================= Status da conversa: aguardando / concluído ================= */
.seg-row { display: flex; flex-wrap: nowrap; gap: 5px; margin-top: 12px; }
.seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.seg-btn:hover { border-color: var(--accent); }
.seg-btn.active { background: var(--accent-tint); color: var(--accent); border-color: var(--accent); }
.seg-count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-secondary);
}
.seg-btn.active .seg-count { background: var(--accent); color: #fff; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 7px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 20px;
  white-space: nowrap;
}
.status-pill.low        { color: var(--text-secondary); background: var(--surface-2); }
.status-pill.warn       { color: var(--warn);   background: var(--warn-tint); }
.status-pill.alert      { color: var(--danger); background: var(--danger-tint); }
.status-pill.done-won   { color: var(--ok);     background: var(--ok-tint); }
.status-pill.done-lost  { color: var(--text-secondary); background: var(--surface-2); }
.status-pill.low::before, .status-pill.warn::before, .status-pill.alert::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.counter-line .warn  { color: var(--warn);   font-weight: 600; }
.counter-line .low   { color: var(--text);   font-weight: 600; }


/* ---------- Período + métricas do Kanban ---------- */
.period-bar { display:flex; align-items:center; gap:10px; margin-top:16px; font-size:13px; color:var(--text-secondary); }
.period-bar select, .period-bar input[type=date] {
  padding:7px 10px; border-radius:8px; border:1.5px solid var(--border);
  background:var(--surface); color:var(--text); font-size:13px; font-weight:600;
}
.metrics-row { display:flex; gap:12px; margin-top:12px; flex-wrap:wrap; }
.metric-card { min-width:150px; padding:12px 18px; }
.metric-sub { font-size:11.5px; color:var(--muted); margin-top:2px; }

/* ---------- Switch "Em follow up" ---------- */
.fu-switch-row { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:18px; padding-top:16px; border-top:1px solid var(--border); }
.switch { position:relative; display:inline-block; width:44px; height:24px; flex-shrink:0; }
.switch input { opacity:0; width:0; height:0; }
.switch .slider { position:absolute; inset:0; background:var(--border-strong); border-radius:24px; cursor:pointer; transition:.2s; }
.switch .slider::before { content:''; position:absolute; height:18px; width:18px; left:3px; top:3px; background:#fff; border-radius:50%; transition:.2s; }
.switch input:checked + .slider { background:var(--accent); }
.switch input:checked + .slider::before { transform:translateX(20px); }

/* ---------- Cadência de follow-up ---------- */
.fu-mode { padding:9px 17px; border-radius:var(--radius-sm); border:1.5px solid var(--border); background:var(--card); font-size:13.5px; font-weight:700; color:var(--text-secondary); }
.fu-mode:hover { border-color:var(--accent); }
.fu-mode.active { background:var(--accent-tint); color:var(--accent); border-color:var(--accent); }
.fu-hint { padding:12px 28px 0; font-size:12.5px; color:var(--muted); }
#followup-board { flex:1; }
.fu-empty { border:1.5px dashed var(--border); border-radius:var(--radius-md); padding:18px; text-align:center; color:var(--muted); font-size:13px; }
.fu-card.late { border-color:var(--danger); }
.fu-due { margin-top:10px; font-size:12.5px; font-weight:700; color:var(--text-secondary); }
.fu-due.late { color:var(--danger); }
.fu-due.soon { color:var(--warn); }
.fu-replied { margin-top:6px; font-size:12.5px; font-weight:700; color:var(--ok); }
.fu-actions { display:flex; flex-wrap:wrap; gap:6px; margin-top:12px; }
.fu-btn { padding:6px 10px; border-radius:7px; border:1px solid var(--border); background:var(--surface); color:var(--text); font-size:12px; font-weight:600; }
.fu-btn:hover { border-color:var(--accent); }
.fu-btn.primary { background:var(--accent); border-color:var(--accent); color:#fff; }
.fu-btn:disabled { opacity:.5; }
.nav-btn { position:relative; }
.nav-badge { position:absolute; top:2px; right:2px; min-width:16px; height:16px; padding:0 4px; border-radius:8px; background:var(--danger); color:#fff; font-size:10px; font-weight:800; display:flex; align-items:center; justify-content:center; }

/* Aviso discreto: WhatsApp desconectado */
.nav-dot { position:absolute; top:6px; right:6px; width:8px; height:8px; border-radius:50%; background:var(--danger); box-shadow:0 0 0 2px var(--surface); }
#wa-alert { position:fixed; top:12px; left:50%; transform:translateX(-50%); z-index:60; display:flex; align-items:center; gap:8px; padding:6px 6px 6px 12px; border-radius:999px; background:var(--surface); border:1px solid var(--border); box-shadow:var(--shadow-sm); font-size:12.5px; font-weight:600; color:var(--text-secondary); max-width:calc(100vw - 32px); white-space:nowrap; }
#wa-alert .wa-alert-dot { width:7px; height:7px; border-radius:50%; background:var(--danger); flex-shrink:0; }
#wa-alert .wa-alert-go { border:none; background:none; color:var(--accent); font-size:12.5px; font-weight:700; padding:2px 4px; cursor:pointer; }
#wa-alert .wa-alert-x { border:none; background:none; color:var(--muted); font-size:15px; line-height:1; padding:2px 6px; cursor:pointer; }


/* ---------- Conexão WhatsApp ---------- */
.wa-card { max-width:620px; background:var(--card); border:1px solid var(--border); border-radius:var(--radius-md); padding:22px; box-shadow:var(--shadow-sm); }
.wa-card-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:18px; }
.wa-card-head .wa-status { margin:0; }
.wa-btn { padding:8px 14px; border-radius:9px; border:1.5px solid var(--accent); background:var(--accent-tint); color:var(--accent); font-size:13px; font-weight:700; }
.wa-btn:disabled { opacity:.6; }
.wa-card-body { display:flex; gap:26px; align-items:center; flex-wrap:wrap; }
.wa-qr-slot { width:240px; height:240px; display:flex; align-items:center; justify-content:center; background:#fff; border-radius:14px; border:1px solid var(--border); text-align:center; padding:8px; box-sizing:border-box; }
.wa-qr-slot img { width:100%; height:100%; object-fit:contain; }
.wa-qr-loading { color:#6b7280; font-size:13px; line-height:1.5; }
.wa-steps { margin:0; padding-left:20px; font-size:14px; line-height:2; color:var(--text-secondary); }
.wa-steps b { color:var(--text); }
.wa-note { margin:18px 0 0; font-size:12.5px; color:var(--muted); }


/* ---------- Tela de importação do WhatsApp ---------- */
#wa-sync-overlay { position:fixed; inset:0; background:var(--bg); z-index:200; display:flex; align-items:center; justify-content:center; padding:16px; }
.sync-card { width:100%; max-width:460px; background:var(--card); border:1px solid var(--border); border-radius:var(--radius-md); padding:28px; box-shadow:var(--shadow-md); }
.sync-title { font-family:var(--font-display); font-weight:700; font-size:19px; }
.sync-sub { margin:8px 0 18px; font-size:13.5px; color:var(--text-secondary); line-height:1.5; }
.sync-bar { height:10px; border-radius:6px; background:var(--surface-2); overflow:hidden; }
.sync-bar-fill { height:100%; width:0; background:var(--accent); border-radius:6px; transition:width .4s; }
.sync-bar-fill.indeterminate { width:35%; animation:sync-slide 1.3s ease-in-out infinite; }
@keyframes sync-slide { 0% { margin-left:-35%; } 100% { margin-left:100%; } }
.sync-percent { height:18px; margin-top:6px; text-align:right; font-size:12.5px; font-weight:700; color:var(--accent); }
.sync-steps { list-style:none; margin:14px 0 0; padding:0; display:flex; flex-direction:column; gap:10px; font-size:13.5px; color:var(--muted); }
.sync-steps li { display:flex; align-items:center; gap:10px; }
.sync-steps li em { font-style:normal; color:var(--text-secondary); }
.sync-ico { width:22px; height:22px; border-radius:50%; border:1.5px solid var(--border-strong); display:inline-flex; align-items:center; justify-content:center; font-size:11px; font-weight:800; flex-shrink:0; }
.sync-steps li.active { color:var(--text); font-weight:700; }
.sync-steps li.active .sync-ico { border-color:var(--accent); color:var(--accent); }
.sync-steps li.done { color:var(--text-secondary); }
.sync-steps li.done .sync-ico { background:var(--ok); border-color:var(--ok); color:#fff; }
.sync-foot { margin-top:20px; font-size:12px; color:var(--muted); line-height:1.5; }

.wa-days { display:grid; grid-template-columns:repeat(auto-fill,minmax(72px,1fr)); gap:6px; margin-top:12px; max-width:620px; }
.wa-day { display:flex; flex-direction:column; align-items:center; padding:6px 4px; border-radius:8px; border:1px solid var(--border); background:var(--surface); font-size:11.5px; color:var(--text-secondary); }
.wa-day b { font-size:14px; color:var(--text); }
.wa-day.empty b { color:var(--muted); font-weight:500; }

.sync-eta { margin:-6px 0 16px; font-size:13px; font-weight:700; color:var(--accent); }


/* ---------- Configurações: navegação e cabeçalho ---------- */
.cfg-header { justify-content: space-between; }
.cfg-account { margin-top: 4px; font-size: 13px; color: var(--text-secondary); }
.admin-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 11px; border: none;
  background: linear-gradient(135deg, var(--accent), var(--violet)); color: #fff; font-size: 13.5px; font-weight: 800;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 40%, transparent); cursor: pointer;
}
.admin-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.cfg-nav { display: flex; gap: 10px; padding: 16px 32px; background: var(--card); border-bottom: 1px solid var(--border); flex-shrink: 0; flex-wrap: wrap; }
.cfg-nav .cfg-tab {
  display: inline-flex; align-items: center; gap: 9px; padding: 11px 20px; font-size: 14px; border-radius: 12px;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text-secondary); font-weight: 700;
  transition: background .15s, border-color .15s, color .15s, transform .15s;
}
.cfg-nav .cfg-tab:hover { border-color: var(--accent); color: var(--text); transform: translateY(-1px); }
.cfg-nav .cfg-tab.active {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 40%, transparent);
}
.cfg-content { padding: 28px 32px; overflow-y: auto; max-width: 760px; width: 100%; box-sizing: border-box; }

/* ---------- Painel Admin ---------- */
.admin-body { flex: 1; min-height: 0; display: flex; }
.admin-side { width: 330px; flex-shrink: 0; border-right: 1px solid var(--border); background: var(--card); padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.admin-new { padding: 12px; border-radius: 11px; border: none; background: var(--accent); color: #fff; font-weight: 800; font-size: 14px; cursor: pointer; }
.acc-card { padding: 14px 16px; border-radius: 13px; border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; margin-bottom: 10px; }
.acc-card:hover { border-color: var(--accent); }
.acc-card.selected { border-color: var(--accent); background: var(--accent-tint); }
.acc-name { font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.acc-meta { margin-top: 6px; font-size: 12.5px; color: var(--text-secondary); }
.pill { font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 20px; background: var(--surface-2); color: var(--text-secondary); }
.pill.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.pill.off { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.pill.here { background: var(--accent); color: #fff; }
.admin-detail { flex: 1; min-width: 0; padding: 28px 32px; overflow-y: auto; }
.admin-empty { color: var(--muted); font-size: 14px; padding: 40px 0; text-align: center; }
.admin-detail h2 { font-size: 20px; margin: 0; }
.admin-sect { margin-top: 26px; }
.admin-sect h3 { font-size: 14px; margin: 0 0 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 16px; }
.stat-box { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); }
.stat-box b { display: block; font-size: 20px; }
.stat-box span { font-size: 12px; color: var(--text-secondary); }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.form-row input, .form-row select, .inp { padding: 10px 12px; border-radius: 9px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font-size: 14px; flex: 1; min-width: 160px; box-sizing: border-box; }
.btn-primary { padding: 10px 16px; border-radius: 9px; border: none; background: var(--accent); color: #fff; font-weight: 700; font-size: 13.5px; cursor: pointer; }
.btn-ghost { padding: 10px 16px; border-radius: 9px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font-weight: 700; font-size: 13.5px; cursor: pointer; }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.err-text { color: var(--danger); font-size: 13px; margin: 6px 0 0; }
.adm-user { display:flex; justify-content:space-between; align-items:center; gap:10px; flex-wrap:wrap; padding:12px 0; border-bottom:1px solid var(--border); }

/* ---------- Aviso "você está em outra conta" ---------- */
#account-bar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 160; display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 18px; border-radius: 30px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 700; box-shadow: 0 8px 28px rgba(0,0,0,.35); }
#account-bar button { padding: 6px 12px; border-radius: 20px; border: none; background: #fff; color: var(--accent); font-weight: 800; font-size: 12.5px; cursor: pointer; }

/* Valor em orçamento por etapa do funil */
.kanban-col-total {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 0 6px 12px 6px;
  margin-top: -6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.kanban-col-total b { font-size: 14px; font-weight: 800; color: var(--accent); letter-spacing: -.01em; }
.kanban-col-total b.zero { color: var(--muted); font-weight: 600; }
.kanban-col-total small { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.kanban-col .kanban-col-add {
  width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-secondary); font-size: 17px; line-height: 1; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.kanban-col .kanban-col-add:hover { background: var(--accent-tint); color: var(--accent); border-color: var(--accent); }
.kanban-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  flex: 1; min-height: 140px; color: var(--muted); text-align: center; font-size: 13px; font-weight: 600;
}
.kanban-empty svg { opacity: .7; margin-bottom: 4px; }
.kanban-empty small { font-size: 12px; font-weight: 500; opacity: .8; }
.kv-eye {
  margin-left: auto;
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.kv-eye:hover { background: var(--surface-2); }
.kv-eye svg { width: 18px; height: 18px; }

.kanban-cards > * { flex-shrink: 0; }

.kanban-col .kanban-col-header { min-height: 58px; align-items: flex-start; padding-bottom: 10px; }

/* ---- Gravação de áudio ---- */
.chat-input.recording > :not(.rec-bar) { display: none !important; }
.rec-bar { display: flex; align-items: center; gap: 12px; width: 100%; }
.rec-bar .rec-btn { box-shadow: none; }
.rec-bar .rec-cancel { background: var(--surface-2); color: var(--danger); }
.rec-bar .rec-cancel:hover { background: var(--surface-2); filter: brightness(1.1); }
.rec-bar .rec-pause { background: var(--surface-2); color: var(--text); }
.rec-bar .rec-pause:hover { background: var(--surface-2); filter: brightness(1.1); }
.rec-bar .rec-send:disabled { opacity: .5; }
.rec-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--danger); flex-shrink: 0; animation: recPulse 1s ease-in-out infinite; }
.rec-bar.is-paused .rec-dot { animation: none; opacity: .4; }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 16px; min-width: 42px; }
.rec-status { font-size: 13px; color: var(--text-secondary); flex-shrink: 0; }
.rec-preview { flex: 1; min-width: 0; display: flex; justify-content: flex-end; }
.rec-preview audio { height: 36px; max-width: 100%; }
@keyframes recPulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.35); opacity: .45; } }
.sending-bubble { display: inline-flex; align-items: center; gap: 8px; opacity: .85; }
.send-spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: sendSpin .7s linear infinite; }
@keyframes sendSpin { to { transform: rotate(360deg); } }
.rec-bar.is-paused .rec-status { display: none; }
.rec-preview { min-width: 0; }
.rec-bar.is-paused .rec-preview { min-width: 150px; }
.rec-preview audio { width: 100%; }

/* ---- Player de áudio ---- */
.wa-audio { display: flex; align-items: center; gap: 12px; min-width: 240px; padding: 2px 2px; }
.wa-audio audio { display: none; }
.wa-play {
  position: relative; width: 40px; height: 40px; border-radius: 50%; border: none; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
  background: #fff; color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,.18); transition: transform .12s;
}
.wa-play:hover { transform: scale(1.06); }
.wa-audio.in .wa-play { background: var(--accent); color: #fff; }
.wa-play .ic-pause, .wa-play .wa-spin { display: none; }
.wa-audio.is-playing .ic-play { display: none; }
.wa-audio.is-playing .ic-pause { display: block; }
.wa-audio.is-loading .ic-play, .wa-audio.is-loading .ic-pause { display: none; }
.wa-audio.is-loading .wa-spin { display: block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: sendSpin .7s linear infinite; }
.wa-body { flex: 1; min-width: 0; }
.wa-wave { display: flex; align-items: center; gap: 2px; height: 30px; cursor: pointer; }
.wa-wave i { flex: 1; min-width: 2px; border-radius: 2px; background: currentColor; opacity: .38; transition: opacity .15s, transform .15s; }
.wa-wave i.on { opacity: 1; }
.wa-audio.in .wa-wave i.on { color: var(--accent); }
.wa-audio.is-playing .wa-wave i.on { animation: waBar .9s ease-in-out infinite; animation-delay: calc(var(--i) * -55ms); }
@keyframes waBar { 0%,100% { transform: scaleY(1); } 50% { transform: scaleY(.62); } }
.wa-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 3px; font-size: 11.5px; font-weight: 700; opacity: .9; font-variant-numeric: tabular-nums; }
.chat-messages .wa-speed, .wa-speed {
  border: none; border-radius: 10px; padding: 1px 8px; font-size: 11px; font-weight: 800; cursor: pointer;
  background: rgba(255,255,255,.22); color: inherit;
}
.wa-audio.in .wa-speed { background: var(--surface-2); color: var(--text-secondary); }

.ad-badge { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 700; color: var(--accent); background: var(--accent-tint); border-radius: 8px; padding: 2px 8px; margin-top: 6px; }
.badge.ad-badge { margin-top: 0; }

/* ---- Dashboard: filtros, abas e funil visual ---- */
.dash-filters { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-bottom:14px; }
.dash-chip { padding:7px 13px; border-radius:999px; border:1px solid var(--border); background:var(--surface, transparent); color:var(--text-secondary); font-size:13px; cursor:pointer; }
.dash-chip.active { background:var(--accent); border-color:var(--accent); color:#fff; font-weight:600; }
.dash-custom { display:inline-flex; gap:6px; align-items:center; font-size:13px; color:var(--text-secondary); }
.dash-custom input { padding:6px 8px; border-radius:8px; border:1px solid var(--border); }
.dash-tabs { display:flex; gap:4px; border-bottom:1px solid var(--border); margin-bottom:20px; overflow-x:auto; }
.dash-tab { padding:10px 14px; background:none; border:none; border-bottom:2px solid transparent; color:var(--text-secondary); font-size:14px; cursor:pointer; white-space:nowrap; }
.dash-tab.active { color:var(--text); border-bottom-color:var(--accent); font-weight:600; }
.dash-h { font-size:15px; margin:18px 0 10px; }
.dash-line { padding:10px 0; border-bottom:1px solid var(--border); font-size:14px; }
.dash-line small { color:var(--muted); }
.fn-wrap { max-width:760px; margin:0 auto 20px; }
.fn-row { display:flex; align-items:center; gap:16px; margin-bottom:3px; }
.fn-stage { flex:1; display:flex; justify-content:center; min-width:0; }
.fn-seg { height:58px; display:flex; flex-direction:column; align-items:center; justify-content:center; color:#fff; text-shadow:0 1px 2px rgba(0,0,0,.35); transition:width .4s; overflow:hidden; padding:0 12px; box-sizing:border-box; }
.fn-name { font-size:13px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%; }
.fn-val { font-size:17px; font-weight:700; }
.fn-side { width:150px; flex-shrink:0; font-size:13px; }
.fn-side b { display:block; font-size:16px; }
.fn-side small { color:var(--muted); }
.fn-lost { max-width:760px; margin:0 auto 12px; }
.fn-lost h3 { font-size:14px; margin:0 0 8px; color:var(--danger); }
.fn-lost-item { display:flex; align-items:center; gap:10px; padding:9px 12px; border:1px solid var(--border); border-radius:10px; margin-bottom:6px; font-size:14px; }
.fn-lost-item span { width:12px; height:12px; border-radius:3px; }
.fn-lost-item b { margin-left:auto; }
.fn-lost-item small { color:var(--muted); min-width:90px; text-align:right; }
.fn-note { max-width:760px; margin:10px auto 0; font-size:12px; color:var(--muted); }
@media (max-width:600px) { .fn-side { width:96px; } .fn-side small { display:none; } }

/* ---- Configurações: editor de etapas do Kanban ---- */
.stg-row { display:flex; align-items:center; gap:8px; padding:8px 0; border-bottom:1px solid var(--border); flex-wrap:wrap; }
.stg-move { display:flex; flex-direction:column; gap:2px; }
.stg-move .fu-btn { padding:0 8px; line-height:18px; }
.stg-color { width:38px; height:34px; padding:0; border:1px solid var(--border); border-radius:8px; background:none; cursor:pointer; }
.stg-name { flex:1; min-width:160px; padding:8px 10px; border-radius:8px; border:1px solid var(--border); }
.stg-row select { padding:8px; border-radius:8px; border:1px solid var(--border); }
.fu-btn.danger { color:var(--danger); }
.stg-overlay { position:fixed; inset:0; background:rgba(0,0,0,.5); display:flex; align-items:center; justify-content:center; z-index:9999; }
.stg-dialog { background:var(--bg, #fff); color:var(--text); padding:22px; border-radius:14px; max-width:420px; width:calc(100% - 32px); }
.stg-dialog select { width:100%; padding:9px; border-radius:8px; border:1px solid var(--border); }

/* ---- Pop-up de alerta (ações sem volta) ---- */
.danger-overlay { position:fixed; inset:0; background:rgba(15,10,10,.6); backdrop-filter:blur(2px); display:flex; align-items:center; justify-content:center; z-index:10000; animation:dgfade .15s; }
.danger-dialog { width:calc(100% - 32px); max-width:440px; background:var(--bg,#fff); color:var(--text); border-radius:16px; overflow:hidden; box-shadow:0 20px 60px rgba(0,0,0,.45); border:1px solid #dc2626; animation:dgpop .18s; }
.danger-head { display:flex; align-items:center; gap:12px; padding:16px 20px; background:linear-gradient(135deg,#dc2626,#b91c1c); color:#fff; }
.danger-head h3 { margin:0; font-size:17px; }
.danger-body { padding:18px 20px 6px; font-size:14px; line-height:1.5; }
.danger-body p { margin:0 0 12px; }
.danger-warn { background:#fef3c7; color:#78350f; border:1px solid #f59e0b; border-left-width:5px; border-radius:10px; padding:11px 13px; font-size:13px; }
.danger-actions { display:flex; justify-content:flex-end; gap:10px; padding:16px 20px 20px; }
.danger-confirm { background:#dc2626; color:#fff; border:0; border-radius:8px; padding:10px 16px; font-weight:700; cursor:pointer; }
.danger-confirm:hover { background:#b91c1c; }
@keyframes dgfade { from{opacity:0} to{opacity:1} }
@keyframes dgpop { from{transform:scale(.94);opacity:0} to{transform:none;opacity:1} }

/* ---- Clientes ---- */
.cli-search { margin-top:12px; width:100%; box-sizing:border-box; padding:9px 12px; border-radius:8px; border:1px solid var(--border); }
.cli-filters { display:flex; gap:6px; margin-top:8px; }
.cli-filters select { flex:1; min-width:0; padding:7px 6px; border-radius:8px; border:1px solid var(--border); font-size:12.5px; }
.cli-newform { display:flex; flex-direction:column; gap:8px; padding:0 20px 16px; }
.cli-newform input, .cli-editform input, .cli-editform textarea { padding:9px 12px; border-radius:8px; border:1px solid var(--border); font-size:14px; width:100%; box-sizing:border-box; }
.cli-empty { padding:16px; color:var(--muted); font-size:14px; }
.cli-badges { display:flex; flex-wrap:wrap; gap:4px; margin-top:5px; }
.cli-head { display:flex; align-items:center; gap:16px; padding:20px 28px; border-bottom:1px solid var(--border); flex-wrap:wrap; }
.avatar-lg { width:60px; height:60px; font-size:20px; flex-shrink:0; }
.cli-name { font-size:20px; font-weight:700; }
.cli-actions { display:flex; gap:8px; flex-wrap:wrap; }
.cli-body { padding:20px 28px; overflow-y:auto; flex:1; }
.cli-tag { display:inline-flex; align-items:center; gap:5px; margin:0 6px 6px 0; }
.cli-x { cursor:pointer; font-weight:700; }
.cli-data { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:12px; font-size:14px; }
.cli-data span { display:block; font-size:12px; color:var(--muted); }
.cli-conv { display:flex; align-items:center; gap:12px; padding:12px 0; border-bottom:1px solid var(--border); }
.cli-conv-val { font-weight:700; white-space:nowrap; }
.cli-editform { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:20px; padding:16px; background:var(--bg); border-radius:12px; border:1px solid var(--border); }
.cli-editform label { font-size:13px; color:var(--text-secondary); display:flex; flex-direction:column; gap:4px; }
@media (max-width:700px) { .cli-editform { grid-template-columns:1fr; } .cli-head, .cli-body { padding-left:16px; padding-right:16px; } }
#clientes-list-items { overflow-y: auto; flex: 1 1 0; min-height: 0; padding: 6px 12px 18px 12px; }
#view-clientes .conv-list { min-height: 0; }
#cliente-profile { min-height: 0; }
.cli-body { min-height: 0; }
.cli-obs { width:100%; box-sizing:border-box; min-height:120px; padding:12px; border-radius:10px; border:1px solid var(--border); background:var(--card); color:var(--text); font:inherit; font-size:14px; resize:vertical; }
.cli-obs:focus { outline:none; border-color:var(--accent); }
.me-prefix { font-weight:700; color:var(--accent); }

/* ---- Coluna "Aguardando resposta" do Kanban ---- */
.kanban-col-wait { background: color-mix(in srgb, var(--warn) 7%, var(--surface)); }
.wait-actions { display:flex; gap:6px; margin-top:10px; }
.wait-actions .btn-primary { width:auto; flex:1; padding:7px 10px; font-size:12.5px; }
.wait-actions .fu-btn { flex:1; font-size:12px; }


/* ---- Origem obrigatória (piscando) ---- */
@keyframes origemPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(224,161,0,.0); border-color: #E0A100; } 50% { box-shadow: 0 0 0 5px rgba(224,161,0,.35); border-color: #FFC83D; } }
@keyframes origemFade { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
#chat-tag-toggle-btn.origem-blink { animation: origemPulse 1s ease-in-out infinite; border-color: #E0A100 !important; color: #E0A100 !important; }
.origem-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 6px; }
.origem-title.origem-blink-text { color: #E0A100; animation: origemFade 1s ease-in-out infinite; }
.badge.origem-pend { background: rgba(224,161,0,.16); color: #E0A100; border: 1px solid rgba(224,161,0,.5); }

/* ---- Follow-up arrastável ---- */
.fu-card { cursor: grab; }
.fu-card.dragging { opacity: .5; }

/* ---- Logo da empresa ---- */
.logo-placeholder.has-logo { background-size: cover; background-position: center; background-repeat: no-repeat; border: none; }
.logo-cfg { display: flex; gap: 16px; align-items: center; margin-bottom: 22px; }
.logo-cfg-preview { width: 84px; height: 84px; border-radius: 14px; border: 1.5px dashed var(--border-strong); background: var(--surface); display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--muted); font-size: 12px; flex-shrink: 0; }
.logo-cfg-preview img { width: 100%; height: 100%; object-fit: cover; }

/* =====================================================================
   LAYOUT NOVO — vale nos DOIS temas (claro e escuro). Só as cores mudam.
   ===================================================================== */
:root { --font-display: 'Poppins', 'Plus Jakarta Sans', sans-serif; }

/* títulos: Poppins, firme e sem exagero */
h1, .kanban-modal h2 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.025em; }
.view-header { background: transparent; border-bottom-color: transparent; }
.view-header h1 { font-size: 26px; }

/* menu lateral com ícone + nome */
.nav-label { display: inline; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar { width: 224px; align-items: stretch; padding: 22px 14px 18px; }
.logo-placeholder { margin: 0 0 26px 8px; width: 40px; height: 40px; }
.sidebar nav { gap: 2px; }
.nav-btn { width: 100%; height: 42px; justify-content: flex-start; gap: 12px; padding: 0 12px; border-radius: 10px; font-size: 14px; font-weight: 500; text-align: left; }
.nav-btn svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav-btn.active { font-weight: 600; box-shadow: none; }
.nav-btn:active { transform: none; }
.nav-push { margin-top: auto; }
.nav-badge { top: 50%; right: 10px; transform: translateY(-50%); }
.nav-dot { top: 50%; right: 14px; transform: translateY(-50%); box-shadow: none; }

/* aviso de WhatsApp: fica no rodapé do menu (não cobre o cabeçalho das telas) */
@media (min-width: 1101px) {
  #wa-alert { top: auto; bottom: 122px; left: 12px; transform: none; width: 200px; max-width: 200px; box-shadow: none; background: rgba(229, 72, 77, 0.16); border-color: transparent; color: #F4C7C9; border-radius: 10px; padding: 0 2px 0 12px; gap: 7px; height: 38px; font-size: 12.5px; font-weight: 500; cursor: pointer; overflow: hidden; }
  #wa-alert .wa-alert-go { display: none; } /* a linha inteira já leva para a tela do WhatsApp */
  #wa-alert .wa-alert-x { display: none; }  /* discreto; some sozinho ao reconectar */
}
@media (max-width: 1100px) { /* tela pequena: menu volta a ser só ícones */
  .sidebar { width: 76px; align-items: center; padding: 22px 0; }
  .logo-placeholder { margin: 0 0 26px 0; }
  .nav-btn { width: 48px; justify-content: center; padding: 0; }
  .nav-label { display: none; }
  .nav-badge { top: 2px; right: 2px; transform: none; }
  .nav-dot { top: 6px; right: 6px; transform: none; }
}

/* listas (Conversas / Clientes) */
.conv-item { padding: 12px; border-radius: 12px; }
.conv-item:hover { background: var(--surface-2); }
.conv-item.selected { background: var(--accent-tint); box-shadow: none; }
.conv-name { font-weight: 600; }
.badge { font-weight: 600; }

/* avatares redondos com cor fixa por contato (as cores ficam em cada tema, abaixo) */
.avatar, .avatar-lg { border-radius: 50%; font-weight: 600; font-size: 13px; }
.avatar-lg { font-size: 19px; }

/* campos e botões mais leves */
.chat-input input { background: var(--input-bg); border-radius: 999px; padding: 12px 18px; }
.cli-search { border-radius: 999px; padding: 9px 14px; }
.login-box button, .chat-input button { box-shadow: none; }

/* funil */
.kanban-col { border-color: transparent; border-top: 3px solid var(--stage, var(--accent)); box-shadow: none; }
.kanban-card:hover { transform: none; }
.dash-card, .stat-box { box-shadow: none; }

/* =====================================================================
   CORES DO TEMA CLARO — cinza-azulado (nada de branco puro) + menu azul-marinho
   ===================================================================== */
[data-theme="light"] {
  --accent: #2F6FE0;
  --accent-dark: #2459BF;
  --accent-tint: #DCE6F7;
  --bg: #E6EAF0;
  --card: #F3F5F8;
  --surface: #F3F5F8;
  --surface-2: #E1E6ED;
  --border: #D6DCE5;
  --border-strong: #C8D0DC;
  --text: #1A2233;
  --text-secondary: #4E5A6D;
  --muted: #828DA0;
  --input-bg: #EDF0F4;
  --grid-dot: #DCE1E9;
  --login-glow: #D5DFF0;
  --sidebar-bg: linear-gradient(180deg, #10192E 0%, #1B2850 100%);
  --sidebar-border: transparent;
  --nav-fg: #9AA4BF;
  --nav-fg-hover: #E3E8F4;
  --nav-hover-bg: rgba(255, 255, 255, 0.07);
  --nav-active-bg: rgba(47, 125, 255, 0.22);
  --nav-active-fg: #FFFFFF;
  --nav-active-ring: transparent;
  --shadow-sm: 0 1px 2px rgba(17, 19, 24, 0.04);
  --shadow-md: 0 4px 14px rgba(17, 19, 24, 0.06);
  --shadow-lg: 0 14px 36px rgba(17, 19, 24, 0.10);
}
[data-theme="light"] .avatar, [data-theme="light"] .avatar-lg { background: #E3E7EE; color: #3F4553; }
[data-theme="light"] .av-0 { background: #FDEEDC; color: #9A5B13; }
[data-theme="light"] .av-1 { background: #FCE7EF; color: #A23A62; }
[data-theme="light"] .av-2 { background: #E7F0FE; color: #2F5DA8; }
[data-theme="light"] .av-3 { background: #E5F5EC; color: #2E7A4E; }
[data-theme="light"] .av-4 { background: #F0EAFD; color: #6A47B0; }
[data-theme="light"] .av-5 { background: #FFF5D6; color: #8A6A0A; }
[data-theme="light"] .kanban-col { background: #DDE2EA; }
[data-theme="light"] .kanban-card { box-shadow: var(--shadow-sm); }

/* =====================================================================
   CORES DO TEMA ESCURO — mesmo layout, avatares em tons suaves sobre o escuro
   ===================================================================== */
[data-theme="dark"] .avatar, [data-theme="dark"] .avatar-lg { background: #222C33; color: #C9D3D9; }
[data-theme="dark"] .av-0 { background: rgba(242, 153, 74, 0.18); color: #F4B37A; }
[data-theme="dark"] .av-1 { background: rgba(236, 104, 150, 0.18); color: #F19BBA; }
[data-theme="dark"] .av-2 { background: rgba(76, 143, 255, 0.20); color: #8DB6FF; }
[data-theme="dark"] .av-3 { background: rgba(53, 208, 127, 0.16); color: #7FDCAA; }
[data-theme="dark"] .av-4 { background: rgba(180, 140, 255, 0.18); color: #C7AEFF; }
[data-theme="dark"] .av-5 { background: rgba(242, 201, 76, 0.16); color: #EBCB6E; }
