/* ==========================================================================
   Rastreio de Entrega — aba "Fabricante × Semana"  (prefixo rts-)
   Matriz: linha = fabricante, coluna = semana (segunda a domingo).
   Colunas Fabricante e Entregue ficam presas à esquerda; as semanas rolam.
   ========================================================================== */

/* ── Cabeçalho da aba: título, descrição, seletor de métrica ── */
.rts-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin: .1rem 0 .7rem;
}
.rts-title { font-size: 1rem; font-weight: 700; color: #212529; margin: 0; }
.rts-desc  { font-size: .78rem; color: #6c757d; margin: .2rem 0 0; max-width: 62ch; }
.rts-count { font-size: .78rem; color: #495057; font-weight: 600; margin: .25rem 0 0; }

.rts-metric { display: inline-flex; border: 1px solid #DEE2E6; border-radius: 7px; overflow: hidden; background: #fff; }
.rts-metric button {
  border: 0; background: #fff; padding: .34rem .75rem;
  font-size: .78rem; font-weight: 600; color: #495057; cursor: pointer;
}
.rts-metric button + button { border-left: 1px solid #DEE2E6; }
.rts-metric button:hover { background: #F1F3F5; }
.rts-metric button.active { background: var(--brand); color: #fff; }

/* ── Matriz ── */
.rts-matrix {
  background: #fff; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.07);
  overflow-x: auto; overflow-y: visible;
}
.rts-matrix table {
  border-collapse: separate; border-spacing: 0;
  width: 100%; min-width: max-content; font-size: .82rem;
}
.rts-matrix th, .rts-matrix td { padding: .4rem .55rem; white-space: nowrap; }

.rts-matrix thead th {
  background: #F8F9FA; color: #6c757d;
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  text-align: right; border-bottom: 2px solid #E9ECEF; vertical-align: bottom;
}
.rts-matrix thead tr.rts-months th {
  text-align: center; border-bottom: 1px solid #E9ECEF;
  font-size: .66rem; color: #868E96; padding: .3rem .55rem;
}
.rts-matrix thead tr.rts-months th.rts-mo { border-left: 1px solid #E9ECEF; }

.rts-wk { line-height: 1.15; }
.rts-wk b { display: block; font-size: .72rem; color: #495057; font-weight: 700; }
.rts-wk span { display: block; font-size: .62rem; color: #ADB5BD; font-weight: 600; text-transform: none; }
.rts-wk-now b { color: var(--brand); }

/* Colunas presas à esquerda */
.rts-c-fab, .rts-c-tot { position: sticky; z-index: 2; background: #fff; }
.rts-c-fab { left: 0;      width: 210px; min-width: 210px; max-width: 210px; text-align: left; }
.rts-c-tot { left: 210px;  width: 152px; min-width: 152px; max-width: 152px; text-align: right;
             box-shadow: 6px 0 6px -6px rgba(0,0,0,.18); overflow: hidden; }
.rts-matrix thead .rts-c-fab, .rts-matrix thead .rts-c-tot { background: #F8F9FA; z-index: 4; }
.rts-matrix tfoot .rts-c-fab, .rts-matrix tfoot .rts-c-tot { background: #F8F9FA; }
.rts-matrix tbody tr:hover .rts-c-fab,
.rts-matrix tbody tr:hover .rts-c-tot { background: #FAFAFA; }

.rts-fab-nome {
  display: block; overflow: hidden; text-overflow: ellipsis;
  font-weight: 600; color: #212529;
}
.rts-fab-semid { color: #868E96; font-style: italic; font-weight: 600; }
.rts-tot-val  { font-weight: 700; color: #212529; font-variant-numeric: tabular-nums; line-height: 1.25; }
.rts-tot-sub  { display: block; font-size: .64rem; color: #868E96; font-weight: 600; line-height: 1.25;
                overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Células de valor ── */
.rts-matrix tbody td.rts-cell {
  text-align: right; font-variant-numeric: tabular-nums;
  border-left: 1px solid #F1F3F5; cursor: pointer;
}
.rts-matrix tbody td.rts-cell:hover { outline: 2px solid var(--brand); outline-offset: -2px; }
.rts-matrix tbody tr { border-bottom: 1px solid #F1F3F5; }
.rts-matrix tbody td { border-bottom: 1px solid #F1F3F5; }

.rts-v0 { background: #FCFCFD; color: #ADB5BD; cursor: default !important; }
.rts-v0:hover { outline: none !important; }
.rts-v1 { background: #E4F4E9; color: #2B5F3C; }
.rts-v2 { background: #CFEBD8; color: #23543A; }
.rts-v3 { background: #A3DCB8; color: #1B4630; }
.rts-v4 { background: #6FC68C; color: #10331F; font-weight: 700; }

/* Semana ainda em curso — número parcial, não compara com as fechadas */
.rts-parcial { background-image: repeating-linear-gradient(135deg, rgba(0,0,0,.045) 0 4px, transparent 4px 8px); }
.rts-badge-parcial {
  display: inline-block; margin-top: 2px; padding: 0 .28rem;
  border: 1px solid #FFD8A8; background: #FFF4E6; color: #E67700;
  border-radius: 4px; font-size: .58rem; font-weight: 700; text-transform: none;
}

/* ── Rodapé da matriz ── */
.rts-matrix tfoot td, .rts-matrix tfoot th {
  background: #F8F9FA; border-top: 2px solid #E9ECEF;
  font-size: .76rem; text-align: right; font-variant-numeric: tabular-nums;
}
.rts-matrix tfoot .rts-c-fab { text-align: left; font-weight: 700; color: #495057; }
.rts-foot-lbl { font-weight: 600; color: #6c757d; }

/* ── Legenda / procedência ── */
.rts-legend {
  display: flex; align-items: center; gap: .45rem; flex-wrap: wrap;
  margin: .55rem 0 0; font-size: .72rem; color: #6c757d;
}
.rts-legend i.rts-sw { width: 16px; height: 12px; border-radius: 2px; display: inline-block; }
.rts-method {
  margin: .45rem 0 0; font-size: .72rem; color: #868E96; line-height: 1.5; max-width: 96ch;
}

/* ── Vazio ── */
.rts-empty {
  background: #fff; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.07);
  padding: 1.6rem; text-align: center;
}
.rts-empty b { display: block; font-size: .92rem; color: #212529; margin-bottom: .25rem; }
.rts-empty span { font-size: .8rem; color: #6c757d; }

/* ── Recorte vindo do clique na matriz (mãe → filha) ── */
.rts-chipbar {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  background: #FFF5F5; border: 1px solid #FFC9C9; border-radius: 8px;
  padding: .45rem .7rem; margin-bottom: .6rem; font-size: .78rem; color: #495057;
}
.rts-chipbar b { color: #212529; }
.rts-chipbar button {
  margin-left: auto; border: 1px solid #FFA8A8; background: #fff; color: var(--brand);
  border-radius: 6px; padding: .18rem .55rem; font-size: .74rem; font-weight: 600; cursor: pointer;
}
.rts-chipbar button:hover { background: var(--brand); color: #fff; border-color: var(--brand); }

.rts-th-curto { display: none; }

/* ── Telas menores: só o nome do fabricante fica preso, o resto rola ── */
@media (max-width: 820px) {
  .rts-c-fab { width: 124px; min-width: 124px; max-width: 124px;
               box-shadow: 6px 0 6px -6px rgba(0,0,0,.18); }
  .rts-c-tot { position: static; width: 104px; min-width: 104px; max-width: 104px; box-shadow: none; }
  .rts-matrix table { font-size: .76rem; }
  .rts-matrix th, .rts-matrix td { padding: .34rem .4rem; }
  .rts-head { align-items: flex-start; }
  .rts-th-full  { display: none; }
  .rts-th-curto { display: inline; }
}
