/* Visão Tática — dashboard operacional (BAU) de migração por loja.
   Vocabulário de componentes próprio (prefixo vt-), nos moldes de
   gantt.css/kanban.css: cada página do site define seus próprios
   componentes sobre os tokens de site.css. */

body.vt-page {
  background: var(--grey-100);
}

/* ---------- Toolbar ---------- */

.vt-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: var(--space-3) var(--space-4);
  background: var(--peers-white);
  border-bottom: 1px solid var(--grey-300);
}

.vt-toolbar__title {
  font-family: var(--font-secondary);
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--peers-blue);
  margin: 0 0 2px;
}

.vt-toolbar__sub {
  font-size: 0.82rem;
  color: var(--grey-600);
  margin: 0;
}

.vt-toolbar__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.vt-btn {
  font-family: var(--font-secondary);
  font-weight: 700;
  font-size: 0.82rem;
  border-radius: var(--radius-full);
  padding: 9px 18px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.vt-btn--primary {
  background: var(--peers-blue);
  color: var(--peers-lime);
}

.vt-btn--primary:hover {
  background: #133061;
}

.vt-btn--ghost {
  background: var(--peers-white);
  border-color: var(--grey-300);
  color: var(--grey-700);
}

.vt-btn--ghost:hover {
  background: var(--grey-100);
}

.vt-btn--danger {
  background: var(--peers-white);
  border-color: var(--error-main);
  color: var(--error-main);
}

.vt-btn--danger:hover {
  background: #ffe9d5;
}

.vt-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ---------- Filtros ---------- */

.vt-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--peers-white);
  border-bottom: 1px solid var(--grey-300);
}

.vt-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 150px;
}

.vt-field--search {
  flex: 1;
  min-width: 200px;
}

.vt-field label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--grey-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.vt-field input,
.vt-field select,
.vt-field textarea {
  font-family: var(--font-primary);
  font-size: 0.85rem;
  padding: 8px 10px;
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-md);
  box-sizing: border-box;
  color: var(--grey-800);
  width: 100%;
  background: var(--peers-white);
}

.vt-field textarea {
  min-height: 64px;
  resize: vertical;
}

.vt-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.vt-field-row--3 {
  grid-template-columns: 1fr 1fr 1fr;
}

/* ---------- Split: mapa (esquerda) + controles (direita) ---------- */

.vt-split {
  display: flex;
  align-items: stretch;
  gap: var(--space-3);
  margin: 0 var(--space-4) var(--space-3);
}

.vt-split__map {
  flex: 1.6;
  min-width: 0;
  background: var(--peers-white);
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-2);
}

.vt-split__side {
  flex: 1;
  min-width: 260px;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

@media (max-width: 900px) {
  .vt-split {
    flex-direction: column;
  }

  .vt-split__side {
    max-width: none;
  }
}

/* ---------- KPIs (coluna lateral direita) ---------- */

.vt-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.vt-kpi {
  background: var(--peers-white);
  border: 1.5px solid var(--grey-300);
  border-left: 5px solid var(--grey-400);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-md);
}

.vt-kpi--accent { border-left-color: var(--peers-lime); }
.vt-kpi--success { border-left-color: var(--success-main); }
.vt-kpi--info { border-left-color: var(--info-main); }
.vt-kpi--error { border-left-color: var(--error-main); }

.vt-kpi__value {
  display: block;
  font-family: var(--font-secondary);
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--peers-blue);
  line-height: 1.1;
}

.vt-kpi__label {
  font-size: 0.74rem;
  color: var(--grey-600);
}

/* ---------- Mapa conceitual (SVG próprio, sem tiles externos) ---------- */

.vt-map-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 4px 8px;
  min-height: 30px;
}

.vt-map-toolbar__label {
  font-family: var(--font-secondary);
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--peers-blue);
}

.vt-map {
  position: relative;
  height: min(66vh, 640px);
  width: 100%;
  background: var(--grey-100);
  border-radius: var(--radius-md);
  overflow: hidden;
}

@media (max-width: 900px) {
  .vt-map {
    height: 420px;
  }
}

.vt-map-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.vt-state {
  fill: var(--peers-serene-02);
  stroke: var(--peers-blue-04);
  stroke-width: 1;
  stroke-linejoin: round;
  cursor: pointer;
  transition: fill 0.15s ease, stroke-width 0.15s ease;
  /* Igual ao .vt-map-dot: sem isso, a borda fica grossa (quase preta) ao
     dar zoom, porque o viewBox menor amplia a espessura junto com o resto. */
  vector-effect: non-scaling-stroke;
}

.vt-state:hover {
  fill: var(--peers-serene);
}

.vt-state.is-zoomed {
  fill: var(--peers-lime-02);
  stroke: var(--peers-blue);
  stroke-width: 2;
}

.vt-state-label {
  font-family: var(--font-secondary);
  font-weight: 700;
  font-size: 9px;
  fill: var(--peers-blue-02);
  text-anchor: middle;
  pointer-events: none;
  user-select: none;
}

.vt-map-dot {
  cursor: pointer;
  stroke-width: 1.5px;
  /* Mantém a espessura da borda constante em pixels de tela, independente
     do viewBox (zoom) do SVG -- só o raio (calculado em JS) muda com o zoom. */
  vector-effect: non-scaling-stroke;
  transition: stroke-width 0.15s ease;
}

.vt-map-dot:hover,
.vt-map-dot.is-focused {
  stroke-width: 2.5px;
}

.vt-map-dot--empresa-bel { stroke: var(--error-main); }
.vt-map-dot--empresa-mundo { stroke: var(--peers-blue); }

.vt-map-dot--status-nao-iniciada { fill: var(--grey-400); }
.vt-map-dot--status-andamento { fill: var(--info-main); }
.vt-map-dot--status-bloqueada { fill: var(--error-main); }
.vt-map-dot--status-concluida { fill: var(--success-main); }

.vt-map-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--grey-500);
  font-size: 0.85rem;
  text-align: center;
  padding: var(--space-3);
}

.vt-map-tooltip {
  position: absolute;
  transform: translate(-50%, -110%);
  background: var(--peers-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 12px 14px;
  min-width: 200px;
  max-width: 240px;
  z-index: 10;
}

.vt-map-tooltip[hidden] {
  display: none;
}

.vt-map-tooltip::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  border-width: 6px 6px 0;
  border-style: solid;
  border-color: var(--peers-white) transparent transparent;
}

/* ---------- Legenda do mapa (card na coluna lateral) ---------- */

.vt-map-legend-card {
  background: var(--peers-white);
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vt-map-legend-card__title {
  font-family: var(--font-secondary);
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--grey-500);
  margin: 0;
}

.vt-map-legend__group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
}

.vt-map-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  color: var(--grey-700);
}

.vt-map-legend__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.vt-map-legend__ring {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2.5px solid;
  flex-shrink: 0;
  background: transparent;
}

.vt-popup h3 {
  font-family: var(--font-secondary);
  font-size: 0.95rem;
  color: var(--peers-blue);
  margin: 0 0 4px;
}

.vt-popup p {
  font-size: 0.8rem;
  color: var(--grey-700);
  margin: 2px 0;
  line-height: 1.4;
}

.vt-popup .vt-status-badge {
  margin: 6px 0;
}

.vt-popup button {
  margin-top: 8px;
  width: 100%;
}

/* ---------- Status badges (reaproveitado em popup, tabela e matriz) ---------- */

.vt-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-secondary);
  font-weight: 700;
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.vt-status-badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.vt-status-badge--nao-iniciada { background: var(--grey-200); color: var(--grey-600); }
.vt-status-badge--andamento { background: #cafdf5; color: #003768; }
.vt-status-badge--bloqueada { background: #ffe9d5; color: #7a0916; }
.vt-status-badge--concluida { background: #d3fcd2; color: #118d57; }

/* ---------- Matriz de tarefas ---------- */

.vt-matrix-wrap {
  margin: 0 var(--space-4) var(--space-6);
  background: var(--peers-white);
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-3);
}

.vt-matrix-head {
  margin-bottom: var(--space-2);
}

.vt-matrix-head h2 {
  font-family: var(--font-secondary);
  font-size: 1.05rem;
  color: var(--peers-blue);
  margin: 0 0 2px;
}

.vt-matrix-head p {
  font-size: 0.78rem;
  color: var(--grey-600);
  margin: 0;
}

.vt-matrix-scroll {
  overflow: auto;
  max-height: 62vh;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-md);
}

.vt-matrix {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.8rem;
  min-width: 100%;
}

.vt-matrix th,
.vt-matrix td {
  border-bottom: 1px solid var(--grey-200);
  border-right: 1px solid var(--grey-100);
  padding: 6px 8px;
  text-align: left;
  white-space: nowrap;
}

.vt-matrix thead th {
  position: sticky;
  top: 0;
  background: var(--grey-100);
  color: var(--peers-blue);
  font-family: var(--font-secondary);
  font-weight: 700;
  font-size: 0.72rem;
  z-index: 2;
  vertical-align: bottom;
  max-width: 130px;
  white-space: normal;
  line-height: 1.25;
}

.vt-matrix__store-col {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--grey-100);
  min-width: 220px;
}

.vt-matrix tbody td.vt-matrix__store-col {
  background: var(--peers-white);
  z-index: 1;
  white-space: normal;
}

.vt-matrix tbody tr:hover td.vt-matrix__store-col,
.vt-matrix tbody tr.is-focused td.vt-matrix__store-col {
  background: var(--peers-serene-02);
}

.vt-matrix tbody tr.is-focused td {
  background: #f5ffcc;
}

.vt-store-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vt-store-cell__tag {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.vt-store-cell__tag--bel { background: var(--error-main); }
.vt-store-cell__tag--mundo { background: var(--peers-blue); }

.vt-store-cell__name {
  font-weight: 700;
  color: var(--peers-blue);
}

.vt-store-cell__meta {
  font-size: 0.7rem;
  color: var(--grey-500);
}

.vt-store-cell__edit {
  margin-left: auto;
  border: none;
  background: transparent;
  color: var(--grey-400);
  cursor: pointer;
  flex-shrink: 0;
}

.vt-store-cell__edit:hover {
  color: var(--peers-blue);
}

.vt-cell-select {
  font-family: var(--font-secondary);
  font-weight: 700;
  font-size: 0.7rem;
  padding: 4px 6px;
  border-radius: var(--radius-sm, 4px);
  border: 1.5px solid transparent;
  cursor: pointer;
  width: 92px;
}

.vt-cell-select--todo { background: var(--grey-200); color: var(--grey-700); }
.vt-cell-select--doing { background: #cafdf5; color: #003768; }
.vt-cell-select--blocked { background: #ffe9d5; color: #7a0916; }
.vt-cell-select--done { background: #d3fcd2; color: #118d57; }

.vt-cell-select--locked {
  border-color: var(--error-main);
  border-style: dashed;
}

.vt-matrix-empty {
  padding: var(--space-4);
  text-align: center;
  color: var(--grey-500);
  font-size: 0.85rem;
}

/* ---------- Drawer de loja ---------- */

.vt-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(1, 19, 52, 0.5);
  display: none;
  align-items: stretch;
  justify-content: flex-end;
  z-index: 1000;
}

.vt-drawer-backdrop.is-open {
  display: flex;
}

.vt-drawer {
  background: var(--peers-white);
  width: min(420px, 92vw);
  height: 100%;
  overflow-y: auto;
  padding: var(--space-4);
  box-shadow: var(--shadow-xl);
}

.vt-drawer__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.vt-drawer__head h2 {
  font-family: var(--font-secondary);
  font-size: 1.1rem;
  color: var(--peers-blue);
  margin: 0;
}

.vt-drawer__close {
  border: none;
  background: var(--grey-100);
  color: var(--grey-600);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
}

.vt-drawer__close:hover {
  background: var(--peers-lime);
  color: var(--peers-blue);
}

.vt-drawer__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: var(--space-3);
}

.vt-drawer__hint {
  font-size: 0.72rem;
  color: var(--grey-500);
  margin-top: 4px;
}

/* ---------- Modal de tarefas ---------- */

.vt-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(1, 19, 52, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-3);
}

.vt-modal-backdrop.is-open {
  display: flex;
}

.vt-modal {
  background: var(--peers-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--space-4);
}

.vt-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.vt-modal__head h2 {
  font-family: var(--font-secondary);
  font-size: 1.1rem;
  color: var(--peers-blue);
  margin: 0;
}

.vt-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: var(--space-2) 0 var(--space-3);
}

.vt-task-list {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.vt-task-list th,
.vt-task-list td {
  border-bottom: 1px solid var(--grey-200);
  padding: 8px 6px;
  text-align: left;
  vertical-align: top;
}

.vt-task-list th {
  color: var(--grey-500);
  font-family: var(--font-secondary);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.vt-task-list td.vt-task-id {
  font-family: var(--font-secondary);
  font-weight: 700;
  color: var(--peers-blue);
  white-space: nowrap;
}

.vt-task-list__actions {
  display: flex;
  gap: 6px;
}

.vt-task-list__actions button {
  border: none;
  background: var(--grey-100);
  border-radius: var(--radius-sm, 4px);
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.72rem;
  color: var(--grey-700);
}

.vt-task-list__actions button:hover {
  background: var(--peers-lime);
  color: var(--peers-blue);
}

.vt-task-empty {
  padding: var(--space-3);
  text-align: center;
  color: var(--grey-500);
  font-size: 0.85rem;
}

@media (max-width: 720px) {
  .vt-field-row,
  .vt-field-row--3 {
    grid-template-columns: 1fr;
  }
}
