/* =====================================================================
   Telas: Leads, Ficha do lead, Importar planilha
   (e peças reaproveitadas: chips, banner, stepper, timeline)
   ===================================================================== */

/* ---------- Peças gerais ---------- */
.breadcrumb { margin-bottom: 14px; }
.breadcrumb a {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-muted); font-size: var(--fs-small); font-weight: 600;
  padding: 4px 6px 4px 0; border-radius: var(--r-xs);
}
.breadcrumb a:hover { color: var(--text); text-decoration: none; }

.inline-icon { display: inline-block; vertical-align: -2px; }
.num { text-align: right; }
th.num .th-sort { margin-left: auto; }

.menu--right { top: calc(100% + 6px); right: 0; }
.menu a.menu__item:hover { text-decoration: none; }

.form-alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--r-md);
  background: var(--danger-bg); color: var(--danger);
  font-size: var(--fs-small);
}
.form-alert .icon { margin-top: 1px; }

.banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 16px;
  border-radius: var(--r-lg);
  background: var(--surface-subtle); color: var(--text-2);
}
.banner--danger { background: var(--danger-bg); color: var(--danger); }

.link-btn--wa { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px; color: var(--text-2); font-weight: 600; }
.link-btn--wa .icon { color: var(--success); }

.select--sm, .input--sm { height: var(--h-sm); font-size: 13px; border-radius: var(--r-sm); }
.select--sm { padding-right: 34px; background-position: right 10px center; }
.input-prefix { position: relative; }
.input-prefix > span {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 13px; pointer-events: none;
}
.input-prefix > .input { padding-left: 36px; }

/* Escolha em pílulas (radio) */
.chips { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.chips legend { padding: 0; margin-bottom: 8px; }
.chips__list, .slots { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; cursor: pointer; }
.chip__body {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface-subtle); color: var(--text-2);
  font-size: 13px; font-weight: 600;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.chip:hover .chip__body { color: var(--text); border-color: #3A3A40; }
.chip input:checked + .chip__body { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.chip input:checked + .chip__body .icon { color: var(--accent); }
.chip input:focus-visible + .chip__body { box-shadow: var(--focus-ring); border-color: var(--accent); }
.chip--slot .chip__body { min-width: 72px; justify-content: center; height: 38px; }

.card-toolbar { padding: 14px 16px; border-bottom: 1px solid var(--divider); }
.step-actions { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* ---------- Leads ---------- */
.leads-views { margin-bottom: 16px; }
.leads-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.leads-toolbar .input-group { min-width: 220px; }
.leads-filters { margin-bottom: 12px; padding: 18px; }
.leads-filters__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }

.leads-table-card { position: relative; }
.leads-table td { padding-top: 10px; padding-bottom: 10px; }
.leads-table tbody tr[data-row] { cursor: pointer; }
.leads-table tbody tr.is-selected { background: var(--accent-soft); }
.leads-table tbody tr.is-selected:hover { background: #432414; }
.col-check { width: 44px; padding-right: 0 !important; }
.col-name { min-width: 220px; }
.lead-link { color: var(--text); font-weight: 700; }
.lead-link:hover { color: var(--accent); text-decoration: none; }
[aria-busy='true'] .table { opacity: 0.55; transition: opacity var(--dur) var(--ease); }

.th-sort {
  display: inline-flex; align-items: center; gap: 4px;
  border: 0; background: none; padding: 4px 0; color: inherit;
  font: inherit; text-transform: inherit; letter-spacing: inherit;
}
.th-sort:hover { color: var(--text); }
.th-sort .icon { opacity: 0.6; }
th[aria-sort='ascending'] .th-sort, th[aria-sort='descending'] .th-sort { color: var(--accent); }
th[aria-sort='ascending'] .th-sort .icon, th[aria-sort='descending'] .th-sort .icon { opacity: 1; }

.select-banner {
  display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--surface-subtle); border-bottom: 1px solid var(--divider);
  font-size: var(--fs-small); color: var(--text-2);
}

.owner-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 140px; font-size: 13px; color: var(--text-2); }
.next-action { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; }
.next-action .icon { color: var(--text-muted); }
.next-action.is-late, .next-action.is-late .icon { color: var(--danger); }

.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 14px; padding-bottom: 80px; /* espaço para a barra de ações */
}

.bulk-bar {
  position: fixed; z-index: 50;
  left: calc(var(--sidebar-w) + 24px); right: 24px; bottom: 20px;
  max-width: calc(var(--content-max) - 56px); margin: 0 auto;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 10px 10px 18px;
  background: var(--surface-subtle);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
}
.bulk-bar__count { white-space: nowrap; font-size: 14px; color: var(--text-2); }
.bulk-bar__count strong { color: var(--text); }
.bulk-bar__actions { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; justify-content: flex-end; }

/* Colunas que somem em telas menores */
@media (max-width: 1180px) { .hide-lg { display: none; } }
@media (max-width: 900px) { .hide-md { display: none; } }
@media (max-width: 640px) { .hide-sm { display: none; } }

@media (max-width: 960px) {
  .bulk-bar { left: 12px; right: 12px; bottom: 12px; flex-wrap: wrap; padding: 10px 12px; }
  .bulk-bar__actions { justify-content: flex-start; order: 3; flex-basis: 100%; }
}

/* ---------- Ficha do lead ---------- */
.lead { display: flex; flex-direction: column; gap: 16px; }
.lead-head { display: flex; flex-direction: column; gap: 18px; }
.lead-head__top { display: flex; gap: 16px 20px; align-items: flex-start; flex-wrap: wrap; }
.lead-head__name { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.lead-head__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.lead-meta {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px;
  padding-top: 16px; border-top: 1px solid var(--divider);
}
.lead-meta__item { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.lead-meta__label { font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); }

.lead-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.lead-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card--side { padding: 18px; }
.card--side .card__header { margin-bottom: 12px; align-items: center; }
.card--side .card__title { font-size: 15px; }

.drawer .lead-body { grid-template-columns: minmax(0, 1fr) 300px; }
.drawer .lead-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (max-width: 1100px) {
  .lead-body, .drawer .lead-body { grid-template-columns: minmax(0, 1fr); }
  .lead-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .lead-meta, .drawer .lead-meta { grid-template-columns: minmax(0, 1fr); }
  .lead-head__actions { width: 100%; }
  .lead-head__actions > .btn:first-child { flex: 1 1 100%; }
}

.composer { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.composer .textarea { min-height: 64px; }

.timeline { display: flex; flex-direction: column; }
.timeline__item { position: relative; display: flex; gap: 12px; padding-bottom: 18px; }
.timeline__item:not(:last-child)::before {
  content: ''; position: absolute; left: 15px; top: 34px; bottom: 4px;
  width: 1px; background: var(--divider);
}
.timeline__icon {
  display: grid; place-items: center; flex: none;
  width: 32px; height: 32px; border-radius: var(--r-sm);
  background: var(--track); color: var(--text-2);
}
.timeline__icon--accent { background: var(--accent-soft); color: var(--accent); }
.timeline__icon--success { background: var(--success-bg); color: var(--success); }
.timeline__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding-top: 5px; }
.timeline__note {
  white-space: pre-wrap; overflow-wrap: anywhere;
  color: var(--text-2); font-size: 14px;
  background: var(--surface-subtle); border-radius: var(--r-md); padding: 10px 12px;
}

.task-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--divider); }
.task-row { display: flex; gap: 10px; align-items: flex-start; }
.task-row .checkbox { margin-top: 2px; }

.contact { display: flex; gap: 10px; align-items: flex-start; }
.contact__links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 4px; }

.dl { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.dl__row { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; font-size: 13px; }
.dl dt { color: var(--text-muted); }
.dl dd { margin: 0; color: var(--text-2); overflow-wrap: anywhere; }

.deal-row { display: flex; gap: 10px; align-items: flex-start; }
.deal-row > .icon { margin-top: 2px; }

/* ---------- Importar ---------- */
.stepper { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.stepper__item {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px 0 6px;
  border-radius: var(--r-full); background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted); font-size: 13px; font-weight: 600;
}
.stepper__num {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--track); color: var(--text-2); font-size: 12px; font-weight: 700;
}
.stepper__item.is-current { color: var(--text); border-color: var(--accent); }
.stepper__item.is-current .stepper__num { background: var(--primary); color: var(--on-primary); }
.stepper__item.is-done .stepper__num { background: var(--success-bg); color: var(--success); }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  min-height: 200px; padding: 28px;
  border: 1.5px dashed #3A3A40; border-radius: var(--r-xl);
  background: var(--bg); cursor: pointer;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--surface-subtle); }
#import-file:focus-visible + .dropzone { border-color: var(--accent); box-shadow: var(--focus-ring); }
.dropzone__icon {
  display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 4px;
  border-radius: var(--r-lg); background: var(--accent-soft); color: var(--accent);
}
.tips { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; font-size: 13px; color: var(--text-2); }
.tips li { display: flex; gap: 8px; align-items: flex-start; }
.tips .icon { margin-top: 1px; }

.map-table td { vertical-align: middle; }
.map-table td:last-child { width: 240px; min-width: 200px; }
