/* ═══════════════════════════════════════════════════════════════════
   BASE DE CONTATOS · RR ENGENHARIA
   Identidade unificada com home/crm/relatorios: preto + dourado
   (#c9a24f), Inter, dark minimalista. Mobile-first.
   ═══════════════════════════════════════════════════════════════════ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  color-scheme: dark;
  --bg-page:    #050507;
  --bg:         #0a0a0b;
  --bg-2:       #121214;
  --bg-3:       #1a1a1d;
  --panel-bg:   #0d0d0f;
  --border:     rgba(255, 255, 255, 0.07);
  --border-soft:rgba(255, 255, 255, 0.05);
  --border-strong: rgba(255, 255, 255, 0.14);

  --text:       #ededeb;
  --text-2:     rgba(237, 237, 235, 0.72);
  --text-3:     rgba(237, 237, 235, 0.48);
  --text-4:     rgba(237, 237, 235, 0.28);

  --gold:       #c9a24f;
  --gold-hover: #dfb66a;
  --gold-soft:  rgba(201, 162, 79, 0.15);
  --gold-line:  rgba(201, 162, 79, 0.35);

  --green:      #6fc784;
  --amber:      #f5b450;
  --red:        #d97c7c;
  --blue:       #5b8af5;

  --font:       'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease:       cubic-bezier(0.16, 1, 0.3, 1);
  --radius:     12px;
  --radius-sm:  8px;
}

html, body {
  width: 100%;
  min-height: 100vh;
  background: var(--bg-page);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 600px at 50% -10%, rgba(201, 162, 79, 0.05), transparent 60%),
    radial-gradient(700px 500px at 85% 110%, rgba(201, 162, 79, 0.03), transparent 60%),
    var(--bg-page);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

/* ═══════════════════════════════════════════════════════════════════
   SHELL
   ═══════════════════════════════════════════════════════════════════ */
.bc-shell {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 42px clamp(24px, 4.5vw, 64px) 56px;
  flex: 1;
}

/* ─── Cabecalho do app ─────────────────────────── */
.bc-head {
  margin-bottom: 26px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-soft);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}

h1 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.025em;
}

.bc-head p {
  max-width: 640px;
  margin-top: 12px;
  color: var(--text-2);
  font-size: 0.95rem;
  line-height: 1.55;
}

/* ═══════════════════════════════════════════════════════════════════
   ABAS
   ═══════════════════════════════════════════════════════════════════ */
.bc-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border-soft);
  overflow-x: auto;
  scrollbar-width: none;
}
.bc-tabs::-webkit-scrollbar { display: none; }

.bc-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-3);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.bc-tab:hover { color: var(--text-2); }
.bc-tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* ═══════════════════════════════════════════════════════════════════
   VIEWS
   ═══════════════════════════════════════════════════════════════════ */
.bc-view[hidden] { display: none; }

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.view-head .eyebrow { margin-bottom: 4px; }
.view-head h2 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ═══════════════════════════════════════════════════════════════════
   BOTOES
   ═══════════════════════════════════════════════════════════════════ */
.primary-btn,
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: transform 0.15s var(--ease), border-color 0.15s var(--ease),
              background 0.15s var(--ease), color 0.15s var(--ease);
}

.primary-btn {
  background: linear-gradient(135deg, var(--gold-hover) 0%, var(--gold) 50%, #a37d33 100%);
  color: #0a0a0b;
  border: 1px solid transparent;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.10) inset,
              0 8px 24px -8px rgba(201, 162, 79, 0.45);
}
.primary-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.16) inset,
              0 12px 32px -8px rgba(201, 162, 79, 0.6);
}
.primary-btn:active { transform: translateY(0); }
.primary-btn:disabled { opacity: 0.55; cursor: wait; transform: none; }

.secondary-btn {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.secondary-btn:hover:not(:disabled) {
  color: var(--gold);
  border-color: var(--gold-line);
  background: var(--gold-soft);
}

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.text-btn:hover { color: var(--gold); border-color: var(--gold-line); background: var(--gold-soft); }

.danger-btn {
  background: transparent;
  border: 1px solid rgba(217, 124, 124, 0.3);
  color: var(--red);
  border-radius: 8px;
  min-height: 40px;
  padding: 0 18px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: background 0.15s, border-color 0.15s;
}
.danger-btn:hover { background: rgba(217, 124, 124, 0.12); border-color: var(--red); }

/* ═══════════════════════════════════════════════════════════════════
   KPI CARDS (dashboard)
   ═══════════════════════════════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-card {
  padding: 18px 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.005)), var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.kpi-card:hover { border-color: var(--gold-line); transform: translateY(-1px); }
.kpi-card.kpi-strong { border-color: var(--gold-line); background: linear-gradient(180deg, var(--gold-soft), rgba(255,255,255,0.005)), var(--panel-bg); }

.kpi-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
}
.kpi-value {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.kpi-value.tone-green { color: var(--green); }
.kpi-value.tone-amber { color: var(--amber); }
.kpi-value.tone-red   { color: var(--red); }
.kpi-foot { font-size: 11.5px; color: var(--text-4); }

/* ═══════════════════════════════════════════════════════════════════
   PANEL CARDS
   ═══════════════════════════════════════════════════════════════════ */
.panel-card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 16px;
}

.panel-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.panel-card-head h3 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.panel-card-head h4 { font-size: 0.9rem; font-weight: 700; }
.panel-card-meta { font-size: 11.5px; color: var(--text-3); }

.chart-area { width: 100%; height: 260px; }

.dash-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.dash-two-col .panel-card { margin-bottom: 0; }

/* ─── Listas do dashboard (segmentos / importacoes) ─── */
.dash-list { display: flex; flex-direction: column; gap: 8px; }

.dash-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}
.dash-row-main { min-width: 0; }
.dash-row-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-row-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.dash-row-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   SEGMENTOS (cards)
   ═══════════════════════════════════════════════════════════════════ */
.segments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.segment-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.005)), var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease);
}
.segment-card:hover { border-color: var(--gold-line); transform: translateY(-1px); }

.segment-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.segment-card-top h3 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.segment-card p {
  font-size: 0.85rem;
  color: var(--text-3);
  line-height: 1.5;
  min-height: 1.5em;
}
.segment-card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}
.segment-count {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.segment-count-label { font-size: 11px; color: var(--text-3); }

/* ─── Segmento virtual fixo "(Todos os contatos)" ─── */
/* O card do segmento automatico ganha a borda dourada de destaque,
   marcando que ele e especial e nao se gerencia na mao. */
.segment-card.is-fixed {
  border-color: var(--gold-line);
  background: linear-gradient(180deg, var(--gold-soft), rgba(255,255,255,0.005)), var(--panel-bg);
}

/* Selo "Automatico": usado tanto no card da aba Segmentos quanto na
   linha do Dashboard. */
.segment-fixed-badge {
  flex-shrink: 0;
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gold);
  background: var(--gold-soft);
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  padding: 3px 8px;
  line-height: 1;
}
/* Na linha do Dashboard o selo fica colado ao titulo, entao recebe
   um respiro a esquerda e alinha pela base do texto. */
.dash-row-title .segment-fixed-badge { margin-left: 6px; vertical-align: middle; }
.dash-row.is-fixed { border-color: var(--gold-line); }

/* ═══════════════════════════════════════════════════════════════════
   FILTROS / CAMPOS
   ═══════════════════════════════════════════════════════════════════ */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 200px;
  padding: 0 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-3);
}
.search-field:focus-within { border-color: var(--gold-line); }
.search-field input {
  flex: 1;
  min-height: 40px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.search-field input::placeholder { color: var(--text-4); }

.select-field {
  min-height: 40px;
  padding: 0 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}
.select-field:focus { border-color: var(--gold-line); }

/* ═══════════════════════════════════════════════════════════════════
   TABELA
   ═══════════════════════════════════════════════════════════════════ */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel-bg);
}

table.bc-table {
  width: 100%;
  border-collapse: collapse;
}
.bc-table thead th {
  text-align: left;
  padding: 12px 14px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  background: rgba(255, 255, 255, 0.015);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.bc-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
  color: var(--text-2);
}
.bc-table tbody tr:last-child td { border-bottom: none; }
.bc-table tbody tr { transition: background 0.12s; }
.bc-table tbody tr:hover { background: rgba(255, 255, 255, 0.018); }
.bc-table .cell-name { color: var(--text); font-weight: 600; }
.bc-table .cell-email { color: var(--text-2); }
.bc-table .cell-created { color: var(--text-3); white-space: nowrap; }
.bc-table .row-actions { text-align: right; white-space: nowrap; }

.mini-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 9px;
  margin-left: 6px;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.mini-btn:hover { color: var(--gold); border-color: var(--gold-line); background: var(--gold-soft); }
.mini-btn.danger:hover { color: var(--red); border-color: rgba(217,124,124,0.4); background: rgba(217,124,124,0.1); }

/* ─── Status pill ─── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.status-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pill.active       { color: var(--green); background: rgba(111, 199, 132, 0.1); }
.status-pill.unsubscribed { color: var(--amber); background: rgba(245, 180, 80, 0.1); }
.status-pill.bounced      { color: var(--red);   background: rgba(217, 124, 124, 0.1); }

/* ─── Paginacao ─── */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}
.pager button {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 14px;
  transition: color 0.12s, border-color 0.12s;
}
.pager button:hover:not(:disabled) { color: var(--gold); border-color: var(--gold-line); }
.pager button:disabled { opacity: 0.35; cursor: not-allowed; }
.pager-info { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ═══════════════════════════════════════════════════════════════════
   IMPORTACAO
   ═══════════════════════════════════════════════════════════════════ */
.import-step[hidden] { display: none; }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 42px 24px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--text-3);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--gold-line);
  background: var(--gold-soft);
  color: var(--gold);
}
.dropzone strong { font-size: 1rem; color: var(--text); }
.dropzone span { font-size: 12.5px; }

.map-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.map-field { display: flex; flex-direction: column; gap: 6px; }
.map-field > span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}
.map-field em { color: var(--text-4); font-style: normal; text-transform: none; letter-spacing: 0; }

.preview-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-2);
  margin: 4px 0 10px;
}
.preview-table { overflow-x: auto; }
.preview-table table { font-size: 12px; }
.preview-table thead th { font-size: 9.5px; }

/* Toggle "Tratar os dados com IA": checkbox estilizado como switch. */
.ai-toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.ai-toggle:hover { border-color: var(--gold-line); }
/* O input real fica oculto: o switch visual e o .ai-toggle-switch. */
.ai-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.ai-toggle-switch {
  flex: 0 0 auto;
  position: relative;
  width: 38px;
  height: 22px;
  margin-top: 1px;
  border-radius: 999px;
  background: var(--bg-3);
  border: 1px solid var(--border-strong);
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease);
}
/* Bolinha do switch. */
.ai-toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-3);
  transition: transform 0.18s var(--ease), background 0.18s var(--ease);
}
.ai-toggle input:checked + .ai-toggle-switch {
  background: var(--gold-soft);
  border-color: var(--gold-line);
}
.ai-toggle input:checked + .ai-toggle-switch::after {
  transform: translateX(16px);
  background: var(--gold);
}
.ai-toggle input:focus-visible + .ai-toggle-switch {
  outline: 2px solid var(--gold-line);
  outline-offset: 2px;
}
.ai-toggle-text { display: flex; flex-direction: column; gap: 3px; }
.ai-toggle-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.ai-toggle input:checked ~ .ai-toggle-text .ai-toggle-title { color: var(--gold); }
.ai-toggle-title svg { color: var(--gold); }
.ai-toggle-hint {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-3);
}

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

.import-result { display: flex; flex-direction: column; gap: 14px; }
.import-result-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.result-card {
  padding: 16px;
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  text-align: center;
}
.result-card strong {
  display: block;
  font-size: 1.8rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.result-card span {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}
.result-card.ok strong { color: var(--green); }
.result-card.upd strong { color: var(--blue); }
.result-card.skip strong { color: var(--amber); }

/* Aviso no resultado quando a IA tratou os dados antes de importar. */
.ai-result-note {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--gold-line);
  border-radius: var(--radius-sm);
  background: var(--gold-soft);
  color: var(--gold);
  font-size: 12.5px;
  font-weight: 600;
}
.ai-result-note svg { flex: 0 0 auto; }

.skipped-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}
.skipped-list div {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-3);
  border-bottom: 1px solid var(--border-soft);
}
.skipped-list div:last-child { border-bottom: none; }

/* ═══════════════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════════════ */
body.modal-open { overflow: hidden; }
.bc-modal[hidden] { display: none; }

.bc-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: 24px;
}
.bc-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(8px);
}
.bc-modal-card {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01)), #0c0c0e;
  box-shadow: 0 28px 90px -36px rgba(0, 0, 0, 0.95);
}
.bc-modal-card.wide { width: min(720px, 100%); }

.bc-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.bc-modal-head h2 {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.bc-modal-body { padding: 20px 24px; }
.bc-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  padding: 0 24px 22px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  color: var(--text-2);
  font-size: 22px;
  line-height: 1;
}
.icon-btn:hover { color: var(--gold); border-color: var(--gold-line); }

/* ─── Formularios no modal ─── */
.form-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-field label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}
.form-field input,
.form-field select,
.form-field textarea {
  min-height: 40px;
  padding: 8px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.form-field textarea { min-height: 70px; resize: vertical; line-height: 1.5; }
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus { border-color: var(--gold-line); }
.field-hint { font-size: 11px; color: var(--text-4); }

/* ─── Lista de membros no modal de segmento ─── */
.member-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.member-toolbar .search-field { min-width: 0; }

.member-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
}
.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}
.member-row-main { min-width: 0; }
.member-row-name { font-size: 13px; font-weight: 600; color: var(--text); }
.member-row-email {
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════════════════════════════
   ESTADOS: vazio / carregando / erro
   ═══════════════════════════════════════════════════════════════════ */
.state-box {
  padding: 38px 20px;
  text-align: center;
  color: var(--text-4);
  font-size: 13px;
}
.state-box.error { color: var(--red); }
.state-box strong { display: block; color: var(--text-2); font-size: 14px; margin-bottom: 4px; }
.state-box.loading { color: var(--text-3); }

.bc-status {
  margin-top: 24px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-4);
}

/* ═══════════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 120;
  padding: 12px 20px;
  background: #1a1a1d;
  border: 1px solid var(--gold-line);
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 18px 48px -20px rgba(0, 0, 0, 0.9);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: rgba(217, 124, 124, 0.5); }

/* ═══════════════════════════════════════════════════════════════════
   MOBILE
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 980px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-two-col { grid-template-columns: 1fr; }
  .import-result-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .bc-shell { padding: 18px 14px 32px; }
  .bc-head { margin-bottom: 18px; padding-bottom: 18px; }
  .bc-tabs { margin-bottom: 20px; }

  .view-head { flex-direction: column; align-items: stretch; gap: 14px; }
  .view-head .primary-btn { width: 100%; }

  /* Inputs 16px previne zoom iOS */
  input, select, textarea { font-size: 16px !important; }

  .kpi-value { font-size: 1.7rem; }
  .map-grid { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; }
  .search-field, .select-field { width: 100%; }

  .import-actions { flex-direction: column-reverse; }
  .import-actions button { width: 100%; }

  /* Tabela: rolagem horizontal em vez de quebrar layout */
  .table-wrap { overflow-x: auto; }
  .bc-table { min-width: 540px; }

  .bc-modal { padding: 14px; }
  .bc-modal-card { max-height: calc(100vh - 28px); }
  .bc-modal-actions { flex-direction: column-reverse; }
  .bc-modal-actions button { width: 100%; }
}

@media (max-width: 420px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .import-result-grid { grid-template-columns: 1fr; }
}

/* ─── Barra de progresso da importacao ─────────────────────────────
   Aparece dentro do passo 2 (mapeamento) quando o usuario clica em
   "Importar contatos": o submit deixa o request acontecendo (sincrono,
   pode levar segundos pra CSVs grandes ou com o tratamento de IA), e
   a barra preenche em ritmo estimado pelas linhas + modo IA. Quando a
   resposta chega, a barra salta para 100% (verde) antes de mostrar o
   resultado no passo 3. */
.import-progress {
  margin-top: 18px;
  padding: 18px;
  background: rgba(201, 162, 79, 0.04);
  border: 1px solid rgba(201, 162, 79, 0.18);
  border-radius: 10px;
}
.import-progress-status {
  font-size: 13px;
  font-weight: 600;
  color: #ededeb;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 9px;
}
/* Bolinha dourada pulsando ao lado do status -- indica vida enquanto
   o servidor processa, mesmo se a barra esta parada num ponto. */
.import-progress-status::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c9a24f;
  box-shadow: 0 0 0 3px rgba(201, 162, 79, 0.2);
  animation: import-progress-pulse 1.2s ease-in-out infinite;
}
@keyframes import-progress-pulse {
  0%, 100% { opacity: 0.45; transform: scale(0.85); }
  50%      { opacity: 1;    transform: scale(1.15); }
}
.import-progress-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}
.import-progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #c9a24f, #d9b66a, #c9a24f);
  background-size: 200% 100%;
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1), background 0.25s linear;
  animation: import-progress-shimmer 2.4s linear infinite;
}
@keyframes import-progress-shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
/* Estado de conclusao: para o shimmer e pinta de verde antes de avancar. */
.import-progress-fill[data-done="true"] {
  background: linear-gradient(90deg, #6fc784, #58b06d);
  animation: none;
}
.import-progress-hint {
  margin-top: 10px;
  font-size: 11px;
  color: rgba(237, 237, 235, 0.5);
  letter-spacing: 0.02em;
}
@media (prefers-reduced-motion: reduce) {
  .import-progress-status::before { animation: none; }
  .import-progress-fill {
    animation: none;
    transition: width 0.2s linear;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   MODAL DE CONTATO - ABAS INTERNAS (Dados | Historico)
   ═══════════════════════════════════════════════════════════════════ */
.bc-modal-tabs {
  display: flex;
  gap: 4px;
  margin: -8px 0 18px;
  border-bottom: 1px solid var(--border-1);
}
.bc-modal-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 14px;
  cursor: pointer;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.bc-modal-tab:hover { color: var(--text-2); }
.bc-modal-tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}
.bc-modal-pane[hidden] { display: none !important; }
.bc-history-loading,
.bc-empty-small {
  color: var(--text-3);
  font-size: 13px;
  padding: 16px 0;
  text-align: center;
}
.bc-history-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.bc-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-1);
  border-radius: 8px;
}
.bc-stat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.bc-stat-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-1);
}
.bc-history-h4 {
  margin: 18px 0 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}
.bc-purchases {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bc-purchase {
  padding: 10px 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-1);
  border-radius: 6px;
}
.bc-purchase-main {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.bc-purchase-product {
  font-weight: 700;
  color: var(--text-1);
}
.bc-purchase-value {
  font-weight: 600;
  color: var(--gold);
  font-size: 13px;
  white-space: nowrap;
}
.bc-purchase-meta {
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}
.bc-purchase-date { color: var(--text-3); font-variant-numeric: tabular-nums; }
.bc-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  padding-left: 18px;
}
.bc-timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: var(--border-1);
}
.bc-timeline-item {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 10px 0;
}
.bc-timeline-dot {
  position: absolute;
  left: -16px;
  top: 14px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--bg-1);
}
.bc-timeline-item[data-source="atendimento-ai"] .bc-timeline-dot { background: #25D366; }
.bc-timeline-item[data-source="import-historico"] .bc-timeline-dot { background: #888; }
.bc-timeline-body { flex: 1; min-width: 0; }
.bc-timeline-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}
.bc-timeline-title {
  font-weight: 600;
  color: var(--text-1);
  font-size: 13px;
}
.bc-timeline-date {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.bc-timeline-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════════════
   IMPORTAR - selecao de tipo (CSV vs Historico Hotmart)
   ═══════════════════════════════════════════════════════════════════ */
.bc-import-kind {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-1);
  border-radius: 8px;
}
.bc-import-kind label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
}
.bc-import-kind input[type="radio"] {
  accent-color: var(--gold);
}
.import-result-card {
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--border-1);
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
}
.import-result-title {
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-1);
}
.import-result-error {
  color: #e07a7a;
  font-size: 13px;
}
.import-result-errors {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-3);
}
.import-result-errors pre {
  white-space: pre-wrap;
  font-size: 11px;
  background: rgba(0,0,0,0.4);
  padding: 8px;
  border-radius: 4px;
  max-height: 200px;
  overflow: auto;
}
