/* Ajustes finos sobre Tailwind */

/* Garante altura mínima de toque (44x44) em controles pequenos */
.select-classif {
  min-height: 36px;
}

/* Inputs/selects com tamanho legível em mobile (evita zoom do iOS) */
input, select, textarea {
  font-size: 16px;
}
@media (min-width: 640px) {
  input, select, textarea {
    font-size: 14px;
  }
}

/* Drawer slide-in suave */
#filtros {
  transition: transform 0.2s ease-out;
}

/* Toast pop-in */
#toast {
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

/* Tipografia base */
body {
  -webkit-font-smoothing: antialiased;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* Garante que cards de empresa não estourem em telas estreitas */
article {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Pequeno indicador de foco extra para acessibilidade */
button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgb(99 102 241);
  outline-offset: 2px;
}

/* ===== Visualização em tabela ===== */
.tabela-empresas {
  border-collapse: separate;
  border-spacing: 0;
}

/* Wrapper da tabela: SEM overflow para o sticky do thead funcionar
   relativo ao scroll do body. Em mobile, se a tabela exceder a
   largura disponível, o body inteiro recebe scroll horizontal. */
.tabela-scroll {
  overflow: visible;
}

/* Zebra striping */
.tabela-empresas tbody tr:nth-child(even) {
  background-color: rgb(248 250 252 / 0.5);
}

/* Cabeçalho FIXO no topo: 48px em mobile (h-12), 56px em sm+ (h-14). */
.tabela-empresas thead th {
  position: sticky;
  top: 48px;
  z-index: 5;
  background-color: rgb(248 250 252);
  border-bottom: 1px solid rgb(226 232 240);
  box-shadow: 0 1px 0 rgb(226 232 240);
}
@media (min-width: 640px) {
  .tabela-empresas thead th { top: 56px; }
}

/* Primeira coluna sticky horizontalmente */
.tabela-empresas .col-empresa {
  position: sticky;
  left: 0;
  background-color: white;
  min-width: 200px;
  max-width: 260px;
  z-index: 2;
}
.tabela-empresas tbody tr:nth-child(even) .col-empresa {
  background-color: rgb(248 250 252);
}
.tabela-empresas tbody tr:hover .col-empresa {
  background-color: rgb(241 245 249);
}
/* Intersecção thead + primeira coluna fica acima de tudo */
.tabela-empresas thead th.col-empresa {
  z-index: 6;
}

/* Sombra sutil quando a 1ª coluna está sticky (qualquer largura) */
.tabela-empresas .col-empresa::after {
  content: "";
  position: absolute;
  top: 0;
  right: -6px;
  width: 6px;
  height: 100%;
  background: linear-gradient(to right, rgba(15, 23, 42, 0.08), transparent);
  pointer-events: none;
}

/* Selects compactos da tabela mantêm 16px em mobile (anti-zoom iOS) */
.tabela-empresas select.select-classif,
.tabela-empresas input.input-classif {
  font-size: 16px;
}
@media (min-width: 640px) {
  .tabela-empresas select.select-classif,
  .tabela-empresas input.input-classif {
    font-size: 12px;
  }
}

/* Badges de vencimento de plano */
.badge-venc {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid;
}
.badge-venc-ok      { background: rgb(241 245 249); color: rgb(51 65 85);   border-color: rgb(226 232 240); }
.badge-venc-prox    { background: rgb(254 243 199); color: rgb(146 64 14);  border-color: rgb(252 211 77);  }
.badge-venc-venc    { background: rgb(254 226 226); color: rgb(153 27 27);  border-color: rgb(248 113 113); }

/* ===== Kanban ===== */
.kanban-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 16px;
  align-items: flex-start;
}
.kanban-coluna {
  flex: 0 0 320px;
  background: rgb(248 250 252);
  border: 1px solid rgb(226 232 240);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 180px);
}
.kanban-coluna-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgb(226 232 240);
  background: white;
  border-radius: 12px 12px 0 0;
  cursor: grab;
}
.kanban-coluna-header.eh-padrao { cursor: default; }
.kanban-coluna-header:active { cursor: grabbing; }
.kanban-coluna-titulo {
  flex: 1;
  font-weight: 600;
  font-size: 0.875rem;
  color: rgb(30 41 59);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kanban-coluna-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgb(100 116 139);
  background: rgb(241 245 249);
  padding: 1px 8px;
  border-radius: 9999px;
  min-width: 24px;
  text-align: center;
}
.kanban-coluna-menu {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: rgb(100 116 139);
  cursor: pointer;
}
.kanban-coluna-menu:hover { background: rgb(241 245 249); }

.kanban-coluna-body {
  padding: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 60px;
}
.kanban-coluna-body:empty::before {
  content: "Arraste empresas para cá";
  display: block;
  text-align: center;
  font-size: 0.75rem;
  color: rgb(148 163 184);
  padding: 24px 8px;
  border: 1px dashed rgb(203 213 225);
  border-radius: 8px;
}
.kanban-card {
  background: white;
  border: 1px solid rgb(226 232 240);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
  cursor: grab;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: box-shadow 0.15s;
}
.kanban-card:hover {
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}
.kanban-card.sortable-chosen { cursor: grabbing; }
.kanban-card.sortable-ghost {
  opacity: 0.4;
  background: rgb(241 245 249);
}
.kanban-card-nome {
  font-weight: 600;
  font-size: 0.8125rem;
  color: rgb(15 23 42);
  line-height: 1.25;
  margin-bottom: 4px;
}
.kanban-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.kanban-card-meta .badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid;
}

/* Cores do topo das colunas */
.kanban-coluna[data-cor="slate"]   .kanban-coluna-header { border-top: 3px solid rgb(100 116 139); }
.kanban-coluna[data-cor="blue"]    .kanban-coluna-header { border-top: 3px solid rgb(59 130 246); }
.kanban-coluna[data-cor="purple"]  .kanban-coluna-header { border-top: 3px solid rgb(139 92 246); }
.kanban-coluna[data-cor="emerald"] .kanban-coluna-header { border-top: 3px solid rgb(16 185 129); }
.kanban-coluna[data-cor="amber"]   .kanban-coluna-header { border-top: 3px solid rgb(245 158 11); }
.kanban-coluna[data-cor="red"]     .kanban-coluna-header { border-top: 3px solid rgb(239 68 68); }

.cor-amostra {
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.1s;
}
.cor-amostra:hover { transform: scale(1.05); }
.cor-amostra.ativa { border-color: rgb(15 23 42); }
.cor-amostra[data-cor="slate"]   { background: rgb(100 116 139); }
.cor-amostra[data-cor="blue"]    { background: rgb(59 130 246); }
.cor-amostra[data-cor="purple"]  { background: rgb(139 92 246); }
.cor-amostra[data-cor="emerald"] { background: rgb(16 185 129); }
.cor-amostra[data-cor="amber"]   { background: rgb(245 158 11); }
.cor-amostra[data-cor="red"]     { background: rgb(239 68 68); }

/* Item de histórico de observação em modo edição */
.obs-edit-area { width: 100%; resize: vertical; }

/* Sidebar colapsada (apenas desktop) */
@media (min-width: 1024px) {
  body.sidebar-colapsada #filtros { display: none !important; }
  body.sidebar-colapsada #btnExpandirFiltros { display: inline-flex !important; }
}
