/* Sequência e Atraso — tabela de 6 métricas por número, classes tm-* geradas pelo JS compartilhado */

.tm-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  background: var(--bg-light);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 18px;
}
.tm-control-group { display: flex; flex-direction: column; gap: 5px; }
.tm-control-group label {
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tm-input, .tm-select {
  padding: 9px 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-size: 14px;
  background: #ffffff;
  outline: none;
}
.tm-select { cursor: pointer; }
.tm-input:focus, .tm-select:focus { border-color: var(--accent); }
.tm-btn {
  padding: 9px 22px;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  align-self: flex-end;
  transition: background 0.2s ease, transform 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
.tm-btn:hover { background: var(--accent-dark); border: none; transform: translateY(-1px); }
.tm-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tm-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.tm-chip {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 99px;
  padding: 6px 16px;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}
.tm-chip strong { color: var(--accent-dark); }

.tm-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.tm-card-title { font-size: 16px; font-weight: 700; color: var(--text-main); margin: 0; }
.tm-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }
.tm-legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }

.tm-table-scroll { overflow-x: auto; border-radius: 16px; border: 1px solid var(--border-light); }
.tm-table-scroll table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tm-table-scroll thead th {
  padding: 12px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #ffffff;
  background: var(--accent-dark);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
  -webkit-tap-highlight-color: transparent;
}
.tm-table-scroll thead th:hover { background: var(--accent); }
.tm-table-scroll thead th .sort-arrow { margin-left: 4px; opacity: 0.75; font-size: 9px; }
.tm-table-scroll thead th.sort-asc .sort-arrow::after { content: '▲'; }
.tm-table-scroll thead th.sort-desc .sort-arrow::after { content: '▼'; }
.tm-table-scroll thead th:not(.sort-asc):not(.sort-desc) .sort-arrow::after { content: '↕'; }

.tm-table-scroll tbody tr { transition: background 0.1s ease; }
.tm-table-scroll tbody tr:nth-child(even) { background: #fafafa; }
.tm-table-scroll tbody tr:hover { background: #f3f4f6; }
.tm-table-scroll tbody td { padding: 9px 14px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.tm-table-scroll tbody tr:last-child td { border-bottom: none; }

.tm-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 13px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}
.tm-val { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.tm-bar-wrap { display: flex; align-items: center; gap: 8px; }
.tm-bar-bg { width: 64px; height: 6px; background: #eee; border-radius: 4px; overflow: hidden; flex-shrink: 0; }
.tm-bar-fill { height: 100%; border-radius: 4px; transition: width 0.3s ease; }

tr.highlight-atraso-alto td:nth-child(3) .tm-val { color: #c0392b; }
tr.highlight-atraso-alto td:nth-child(3) { background: rgba(231, 76, 60, 0.08); }
tr.highlight-seq-alta td:nth-child(5) .tm-val { color: #1e7e34; }
tr.highlight-seq-alta td:nth-child(5) { background: rgba(40, 167, 69, 0.08); }

.tm-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 60px 0; color: var(--text-muted); font-size: 14px; }
.tm-spinner { width: 22px; height: 22px; border: 3px solid #ddd; border-top-color: var(--accent); border-radius: 50%; animation: tm-spin 0.7s linear infinite; }
@keyframes tm-spin { to { transform: rotate(360deg); } }
.tm-empty { text-align: center; padding: 40px; color: #999; font-size: 14px; }

.tm-desc-table { font-size: 13px; border-collapse: collapse; width: 100%; margin-top: 8px; }
.tm-desc-table th { text-align: left; padding: 8px 12px; background: #f9fafb; font-weight: 700; color: var(--text-main); border-bottom: 1px solid var(--border-light); }
.tm-desc-table td { padding: 8px 12px; border-top: 1px solid #f0f0f0; color: var(--text-muted); }

@media (max-width: 600px) {
  .tm-input, .tm-select { width: 130px; }
}
