/* ═══════════════════════════════════════════════════════
   MÓDULO 3 — TERCEIRIZADOS
   Tema Brown (Material) — sobrepõe os tokens quando o módulo é Terceirizados
   ═══════════════════════════════════════════════════════ */
body[data-modulo="terceirizados"] {
  --bg-900: #3e2723;
  --bg-800: #4e342e;
  --bg-700: #5d4037;
  --bg-600: #6d4c41;
  --bg-500: #795548;
  --bg-400: #8d6e63;
  --bg-300: #a1887f;
  --bg-200: #bcaaa4;
  --bg-100: #d7ccc8;
  --bg-50:  #efebe9;

  --accent-blue:  #6d4c41;     /* links/realces no tom do módulo */

  --prod-interna: #6d4c41;
  --prod-externa: #bcaaa4;

  --body-bg:      #c9b8aa;   /* fundo das telas: tom médio do tema (abaixo do menu) */
  --text-primary: #3e2723;
  --text-muted:   #6d4c41;
  --border:       #d7ccc8;
}

/* Card do hub (marrom) */
.hub-card.mod-terceirizados { background: linear-gradient(140deg, #3e2723 0%, #8d6e63 100%); }

/* Logo grande da tela inicial nas cores do tema (marrom) */
body[data-modulo="terceirizados"] .inicio-logo {
  filter: sepia(1) saturate(2.2) hue-rotate(-18deg) brightness(.7);
}

/* ─── LANÇAR / excesso (tema brown) ─── */
.terc-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px,1fr)); gap: 12px; margin-bottom: 16px; }
.terc-kpi { background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 14px; text-align: center; border-top: 4px solid var(--bg-600); }
.terc-kpi b { display: block; font-size: 26px; color: var(--bg-900); }
.terc-kpi span { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }

/* Inputs de quantidade por tamanho + destaque de excesso */
.terc-tam-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.terc-tam { text-align: center; }
.terc-tam label { display: block; font-weight: bold; font-size: 16px; color: var(--bg-800); margin-bottom: 4px; }
.terc-tam input { width: 100%; text-align: center; font-size: 18px; font-weight: bold; padding: 10px 4px;
  border: 2px solid var(--bg-200); border-radius: 10px; }
.terc-tam .terc-prod { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.terc-tam.excede input { border-color: var(--accent-red); background: #ffe9e6; color: var(--accent-red); }
.terc-tam.excede .terc-prod { color: var(--accent-red); font-weight: bold; }

/* LANÇAR — layout em 2 colunas (form + painel de informações) */
.terc-lancar-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 12px; align-items: start; }
@media (max-width: 1100px) { .terc-lancar-grid { grid-template-columns: 1fr; } }
.terc-painel .card { margin-bottom: 9px; }
.terc-painel .card-header { font-size: 13px; }
.terc-prodmini { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; text-align: center; }
.terc-prodmini .pm { background: var(--bg-50); border: 1px solid var(--border); border-radius: 8px; padding: 7px 2px; }
.terc-prodmini .pm b { display: block; font-size: 18px; color: var(--bg-900); line-height: 1.1; }
.terc-prodmini .pm span { font-size: 10px; color: var(--text-muted); text-transform: uppercase; }
.terc-kv { list-style: none; font-size: 13px; }
.terc-kv li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--bg-100); }
.terc-kv li:last-child { border-bottom: none; }
.terc-kv li b { color: var(--bg-900); }
.terc-painel-empty { text-align: center; color: var(--text-muted); padding: 30px 16px; font-size: 14px; }
/* Relatório 3 Meses — badges de situação */
.rl-badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: bold; white-space: nowrap; }
.rl-badge.exc { background: #ffebee; color: #c62828; }
.rl-badge.parc { background: #fff3e0; color: #e65100; }
.rl-badge.semos { background: #eceff1; color: #546e7a; }
.rl-badge.ok { background: #e8f5e9; color: #2e7d32; }

/* Busca de modelos (passo 1) */
.terc-modelos { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; max-height: 250px; overflow: auto; }
.terc-modelo-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; background: #fff; }
.terc-modelo-item:hover { background: var(--bg-50); }
.terc-modelo-item.sel { border-color: var(--bg-600); box-shadow: 0 0 0 2px rgba(109,76,65,.25); }
.terc-modelo-item img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; background: var(--bg-100); }
.terc-modelo-item .mi-cod { font-weight: bold; }
.terc-modelo-item .mi-nome { color: var(--text-muted); font-size: 12px; }

/* O.S do modelo (passo 2) */
.terc-os-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.terc-os-chip { padding: 7px 12px; border: 1.5px solid var(--bg-300); border-radius: 10px; background: #fff; cursor: pointer; text-align: center; }
.terc-os-chip:hover { background: var(--bg-50); }
.terc-os-chip.sel { background: var(--bg-600); color: #fff; border-color: var(--bg-600); }
.terc-os-chip b { display: block; font-size: 15px; }
.terc-os-chip small { font-size: 11px; opacity: .85; }
.terc-os-grade { display: block; margin-top: 3px; font-size: 10.5px; font-weight: 600; opacity: .9; letter-spacing: .2px; }

/* Imagem do modelo no painel */
.terc-foto { width: 100%; max-height: 230px; object-fit: contain; background: var(--bg-100); border-radius: 10px; margin-bottom: 12px; }

/* Checklist de partes/medidas (flag enviada ou não) */
.terc-check { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.terc-check label { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: normal; padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; background: #fff; }
.terc-check label.off { opacity: .45; text-decoration: line-through; }
.terc-check label .q { margin-left: auto; color: var(--text-muted); font-size: 11px; }

/* ─── RETORNOS — lista de remessas clicáveis (escolher a remessa que voltou) ─── */
.terc-remessas { display: flex; flex-direction: column; gap: 8px; max-height: 380px; overflow: auto; }
.terc-remessa { text-align: left; width: 100%; background: #fff; border: 1px solid var(--border);
  border-left: 4px solid var(--bg-400); border-radius: 10px; padding: 9px 12px; cursor: pointer;
  transition: background .12s, box-shadow .12s; }
.terc-remessa:hover { background: var(--bg-50); }
.terc-remessa.sel { border-color: var(--bg-600); border-left-color: var(--bg-700); box-shadow: 0 0 0 2px rgba(109,76,65,.28); }
.terc-remessa.done { border-left-color: #2e7d32; }
.terc-remessa-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.terc-remessa-top b { color: var(--bg-900); font-size: 14px; }
.terc-remessa-id { display: inline-block; background: var(--bg-700); color: #fff; font-size: 11px; font-weight: bold; padding: 1px 7px; border-radius: 6px; }
.terc-remessa-saldo { font-size: 11px; font-weight: bold; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.terc-remessa-saldo.pend { background: #fff3e0; color: #e65100; }
.terc-remessa-saldo.ok { background: #e8f5e9; color: #2e7d32; }
.terc-remessa-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.terc-remessa-nums { font-size: 12px; color: var(--bg-700); margin-top: 3px; }

/* ─── PREÇOS — chips de itens (partes/serviços) ─── */
.terc-precos-itens { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.terc-preco-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; padding: 4px 10px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--bg-50); }
.terc-preco-chip b { color: var(--bg-900); }
.terc-preco-chip.zero { opacity: .5; }

/* ─── Lançar Envio — novo layout ─── */
.tl-painel-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 9px; }
.tl-painel-2col .card { margin: 0; }
@media (max-width: 760px) { .tl-painel-2col { grid-template-columns: 1fr; } }

/* Serviços (do cadastro) — nome + preço editável + remover */
.tl-serv-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.tl-serv-row .tl-serv-nome { flex: 2; min-width: 0; }
.tl-serv-row .tl-serv-preco { flex: 1; max-width: 120px; }

/* Partes | Medidas — 2 blocos separados, flags à esquerda, texto colado (com quebra) */
.tl-pm-2cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tl-pm-2cards .card { margin: 0; }
@media (max-width: 620px) { .tl-pm-2cards { grid-template-columns: 1fr; } }
.tl-pm-hint { font-size: 11.5px; color: var(--text-muted); margin: 0 0 8px; }
.tl-flags { display: flex; flex-direction: column; gap: 1px; }
.terc-flag { display: grid; grid-template-columns: auto 1fr; column-gap: 7px; align-items: start; padding: 3px 2px; font-size: 12.5px; font-weight: normal; cursor: pointer; line-height: 1.35; }
.terc-flag > input { margin: 2px 0 0; }
.terc-flag-body { min-width: 0; overflow-wrap: break-word; }
.terc-flag .q { color: var(--text-muted); font-size: 11px; margin-left: 5px; white-space: nowrap; }
.terc-flag.off { opacity: .45; text-decoration: line-through; }

/* Bloco Partes/Medidas no formato planilha (Excel) */
.tl-rota-chk { display: block; margin-top: 12px; font-size: 13px; cursor: pointer; line-height: 1.4; }
.tl-rota-chk input { width: auto; margin: 0 6px 0 0; vertical-align: middle; }
.tl-mark-lbl { margin-left: auto; font-size: 11px; font-weight: 400; display: inline-flex; align-items: center; gap: 5px; cursor: pointer; white-space: nowrap; color: #fff; }
.tl-mark-lbl input { width: auto; margin: 0; padding: 0; }
.tl-pm { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tl-pm th, .tl-pm td { padding: 5px 9px; border-bottom: 1px solid var(--bg-100); }
.tl-pm thead th { background: var(--bg-50); color: var(--bg-700); font-size: 11px; text-transform: uppercase; letter-spacing: .3px; text-align: left; border-bottom: 1.5px solid var(--bg-200); }
.tl-pm td.c, .tl-pm th.c { width: 30px; text-align: center; padding: 5px; }
.tl-pm td.n, .tl-pm th.n { text-align: right; white-space: nowrap; }
.tl-pm td.nm { color: var(--bg-800); }
.tl-pm tbody tr:hover { background: var(--bg-50); }
.tl-pm tr.off td { opacity: .45; text-decoration: line-through; }
.tl-pm tr.off td.c { opacity: 1; text-decoration: none; }
.tl-pm .q { color: var(--text-muted); font-size: 11px; }
.tl-pm input { width: auto; margin: 0; cursor: pointer; }
.tl-pm tfoot td { background: var(--bg-50); font-weight: 700; border-top: 2px solid var(--bg-200); border-bottom: none; }
.tl-pm tfoot .lbl { color: var(--bg-700); font-weight: 600; }

/* Forros na composição */
.tl-forro { margin-top: 8px; border-top: 1px dashed var(--bg-300); padding-top: 6px; }
.tl-forro-nome { font-size: 12px; font-weight: 700; color: var(--bg-800); margin-bottom: 2px; }

/* Sugestões de retirada (mês) — O.S por terceiro */
.tl-ret-terc { padding: 7px 0; border-bottom: 1px solid var(--bg-100); }
.tl-ret-terc:last-child { border-bottom: none; }
.tl-ret-terc-nome { font-size: 13px; margin-bottom: 5px; }
.tl-ret-os.sel { background: #2e7d32; border-color: #2e7d32; color: #fff; }

/* Fundo das telas em degradê (tons do tema) */
body[data-modulo="terceirizados"] {
  background: linear-gradient(160deg, #ded3cd 0%, #c2b0a3 52%, #9c8475 100%) fixed;
}
