/* Base legada do app (antigo styles.css), parte 19 (#533) · Pipelines do CRM: quadro operacional. Ordem de carga: scripts/helpers/styles-source.js. */

/* CRM pipelines: a compact operational board, not a grid of action panels. */
.crm-pipeline-command-bar {
  display: grid;
  grid-template-columns: auto minmax(190px, 250px) minmax(220px, 1fr) auto auto;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.crm-pipeline-select,
.crm-pipeline-search {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.crm-pipeline-select span,
.crm-pipeline-search span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.crm-pipeline-select select,
.crm-pipeline-search input {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.crm-pipeline-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 0 2px;
  color: var(--muted);
  font-size: 13px;
}

.crm-pipeline-summary strong { color: var(--text); }

.crm-pipeline-create,
.crm-pipeline-popover {
  position: relative;
}

.crm-pipeline-create {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.crm-pipeline-create > summary,
.crm-pipeline-popover > summary {
  cursor: pointer;
  list-style: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.crm-pipeline-create > summary { padding: 11px 14px; }
.crm-pipeline-create > summary::-webkit-details-marker,
.crm-pipeline-popover > summary::-webkit-details-marker { display: none; }
.crm-pipeline-create > form { padding: 0 14px 14px; }

.crm-pipeline-popover > summary {
  min-height: 38px;
  display: grid;
  place-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.crm-pipeline-popover-body {
  position: absolute;
  z-index: 5;
  right: 0;
  top: calc(100% + 8px);
  width: min(360px, 88vw);
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.crm-pipeline-popover-body label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.crm-pipeline-popover-body input,
.crm-pipeline-popover-body select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
}

.crm-kanban-board {
  width: 100%;
  overflow-x: auto;
  padding: 2px 0 12px;
}

.crm-kanban-columns {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: max-content;
  min-width: 100%;
}

.crm-kanban-column {
  width: 292px;
  min-width: 292px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  overflow: hidden;
}

.crm-kanban-column-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  align-items: center;
  padding: 12px;
  border-top: 3px solid var(--crm-stage-color);
  background: var(--surface);
}

.crm-kanban-column-head > div { display: flex; align-items: center; gap: 7px; min-width: 0; }
.crm-kanban-column-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-size: 13px; }
.crm-kanban-column-head > span { color: var(--muted); font-size: 12px; font-weight: 800; }
.crm-kanban-column-head > .crm-kanban-column-count { min-width: 24px; padding: 3px 7px; border-radius: 99px; background: color-mix(in srgb, var(--crm-stage-color) 14%, transparent); color: var(--text); text-align: center; justify-self: end; }
.crm-kanban-column-head small { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }
.crm-kanban-stage-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 99px; background: var(--crm-stage-color); }

.crm-kanban-column-cards { display: grid; gap: 9px; padding: 9px; }

.crm-kanban-column.is-drop-target {
  border-color: var(--crm-stage-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--crm-stage-color) 18%, transparent);
}

.crm-kanban-column.is-drop-target .crm-kanban-column-cards {
  min-height: 170px;
  background: color-mix(in srgb, var(--crm-stage-color) 8%, transparent);
}

.crm-kanban-card {
  display: grid;
  gap: 8px;
  min-height: 146px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
  cursor: pointer;
}

.crm-kanban-card[draggable="true"] { cursor: grab; }
.crm-kanban-card[draggable="true"]:active { cursor: grabbing; }
.crm-kanban-card.is-dragging { opacity: .42; transform: rotate(1deg) scale(.98); }
.crm-kanban-card.is-updating { opacity: .62; pointer-events: none; }

.crm-kanban-card:hover { border-color: var(--crm-stage-color); box-shadow: 0 6px 16px rgba(15, 23, 42, .09); }
.crm-kanban-card header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.crm-kanban-card header time { color: var(--muted); font-size: 10px; white-space: nowrap; }
.crm-kanban-card-type { padding: 3px 7px; border-radius: 99px; font-size: 10px; font-weight: 850; }
.crm-kanban-card-type.lead { color: rgb(var(--mix-fx-ink-blue, 29 78 216)); background: rgb(var(--mix-fx-paper, 219 234 254)); }
.crm-kanban-card-type.deal { color: rgb(var(--mix-fx-ink-purple, 124 58 237)); background: rgb(var(--mix-fx-paper, 237 233 254)); }
.crm-kanban-card > strong { display: -webkit-box; overflow: hidden; color: var(--text); font-size: 14px; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.crm-kanban-card > p { overflow: hidden; margin: 0; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.crm-kanban-card-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11px; }
.crm-kanban-card-meta span:first-child { color: var(--text); font-weight: 800; }
.crm-kanban-card footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.crm-kanban-card-action,
.crm-kanban-card-icon { min-height: 30px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--text); cursor: pointer; font: inherit; font-size: 12px; font-weight: 800; }
.crm-kanban-card-action { padding: 0 10px; }
.crm-kanban-card-icon { width: 30px; }
.crm-kanban-card-action:hover,
.crm-kanban-card-icon:hover { border-color: var(--crm-stage-color); color: var(--crm-stage-color); }
.crm-kanban-card-icon:disabled { opacity: .38; cursor: default; }
.crm-kanban-empty { padding: 20px 12px; color: var(--muted); font-size: 12px; text-align: center; }

html[data-mix-theme="mix-fiscal-default"] .crm-pipeline-command-bar,
html[data-mix-theme="mix-fiscal-default"] .crm-pipeline-create,
html[data-mix-theme="mix-fiscal-default"] .crm-kanban-column,
html[data-mix-theme="mix-fiscal-default"] .crm-kanban-card,
html[data-mix-theme="mix-fiscal-default"] .crm-pipeline-popover-body { border-color: var(--mix-border); background: rgb(var(--mix-fx-paper, 255 255 255)); }
html[data-mix-theme="mix-fiscal-default"] .crm-kanban-column { background: var(--mix-surface-soft); }

@media (max-width: 980px) {
  .crm-pipeline-command-bar { grid-template-columns: 1fr 1fr auto; }
  .crm-pipeline-search { grid-column: span 2; }
}

@media (max-width: 640px) {
  .crm-pipeline-command-bar { grid-template-columns: 1fr auto; }
  .crm-pipeline-select,
  .crm-pipeline-search { grid-column: 1 / -1; }
  .crm-pipeline-segment { overflow-x: auto; }
  .crm-kanban-column { width: 276px; min-width: 276px; }
}

.crm-record-drawer-loading { position: fixed; z-index: 61; right: 28px; bottom: 28px; padding: 12px 16px; border-radius: 9px; background: var(--text); color: var(--surface); font-size: 13px; font-weight: 800; box-shadow: var(--shadow); }

.crm-field-display-rule {
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
}

.crm-field-display-rule summary { color: var(--text); cursor: pointer; font-size: 13px; font-weight: 850; }
.crm-field-display-rule > div { margin-top: 12px; }
.crm-field-display-rule small { display: block; margin-top: 9px; color: var(--muted); font-size: 12px; line-height: 1.45; }
