/* ═══════════════════════════════════════════════════════
   MÓDULO LINHA DE PRODUÇÃO
   Tema deepOrange (Material) + Hub de módulos + Tela tablet
   ═══════════════════════════════════════════════════════ */

/* ─── Tema deepOrange (sobrepõe os tokens quando o módulo é a Linha) ─── */
body[data-modulo="linha"] {
  --bg-900: #bf360c;
  --bg-800: #d84315;
  --bg-700: #e64a19;
  --bg-600: #f4511e;
  --bg-500: #ff5722;
  --bg-400: #ff7043;
  --bg-300: #ff8a65;
  --bg-200: #ffab91;
  --bg-100: #ffccbc;
  --bg-50:  #fbe9e7;

  --accent-blue:  #d84315;   /* links/realces ficam no tom da linha */
  --accent-orange:#ff3d00;

  /* gráficos */
  --prod-interna: #e64a19;
  --prod-externa: #ffab91;

  --body-bg:      #fff5f1;
  --text-primary: #4e1c0b;
  --text-muted:   #a1573f;
  --border:       #ffccbc;
}

/* ═══════════════ HUB DE MÓDULOS (seleção do admin) ═══════════════ */
.hub-screen {
  min-height: 100vh;
  background: linear-gradient(135deg, #1c262b 0%, #37474F 50%, #455A64 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; gap: 30px;
}
.hub-head { text-align: center; color: #fff; }
.hub-head img { height: 64px; margin: 0 auto 14px; filter: brightness(0) invert(1); }
.hub-head h1 { font-size: 24px; font-weight: bold; letter-spacing: .5px; }
.hub-head p { font-size: 14px; opacity: .8; margin-top: 6px; }

.hub-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 280px));
  gap: 24px; width: 100%; max-width: 920px; justify-content: center;
}
.hub-card {
  border: none; border-radius: 18px; cursor: pointer; color: #fff;
  padding: 32px 26px; text-align: left; min-height: 200px;
  display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: 0 8px 30px rgba(0,0,0,.35);
  transition: transform .16s ease, box-shadow .16s ease; font-family: var(--font);
}
.hub-card:hover { transform: translateY(-6px); box-shadow: 0 16px 44px rgba(0,0,0,.45); }
.hub-card .hub-emoji { font-size: 46px; line-height: 1; }
.hub-card h2 { font-size: 22px; font-weight: bold; margin-top: 14px; }
.hub-card p  { font-size: 13.5px; opacity: .92; margin-top: 6px; line-height: 1.45; }
.hub-card .hub-go { margin-top: 16px; font-size: 13px; font-weight: bold; opacity: .95; }
.hub-card.mod-malharia { background: linear-gradient(140deg, #263238 0%, #546E7A 100%); }
.hub-card.mod-linha    { background: linear-gradient(140deg, #bf360c 0%, #ff7043 100%); }

.hub-logout {
  background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.3);
  padding: 9px 22px; border-radius: 999px; font-size: 13px; cursor: pointer;
  transition: background var(--transition);
}
.hub-logout:hover { background: rgba(255,255,255,.25); }

/* Botão "Trocar módulo" na topbar */
.btn-switch-mod {
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28);
  color: #fff; padding: 5px 12px; border-radius: 999px; font-size: 12px;
  cursor: pointer; transition: background var(--transition); margin-right: 10px;
}
.btn-switch-mod:hover { background: rgba(255,255,255,.28); }

/* ═══════════════ TELA DO COLABORADOR (tablet/celular) ═══════════════ */
.colab-screen {
  min-height: 100vh; background: var(--body-bg);
  display: flex; flex-direction: column;
}
.colab-top {
  background: linear-gradient(120deg, var(--bg-900) 0%, var(--bg-600) 100%);
  color: #fff; padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  position: sticky; top: 0; z-index: 20;
}
.colab-top .colab-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.colab-top .colab-id img { height: 34px; filter: brightness(0) invert(1); }
.colab-top .colab-who { line-height: 1.2; min-width: 0; }
.colab-top .colab-who strong { font-size: 16px; display: block;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
.colab-top .colab-who span { font-size: 12px; opacity: .85; }
.colab-logout {
  background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.35);
  padding: 9px 16px; border-radius: 999px; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.colab-logout:active { background: rgba(255,255,255,.3); }

.colab-body { flex: 1; padding: 16px; max-width: 720px; width: 100%; margin: 0 auto; }
.colab-card {
  background: #fff; border-radius: 16px; box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 16px; border: 1px solid var(--border);
}
.colab-card h3 {
  font-size: 13px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--bg-700); margin-bottom: 12px; font-weight: bold;
}
.colab-field { margin-bottom: 14px; }
.colab-field > label {
  display: block; font-size: 13px; font-weight: bold; color: var(--bg-800);
  margin-bottom: 6px;
}
.colab-field select, .colab-field input {
  width: 100%; padding: 14px 12px; font-size: 16px; border-radius: 12px;
  border: 2px solid var(--bg-200); background: #fff; color: var(--text-primary);
}
.colab-field select:focus, .colab-field input:focus {
  outline: none; border-color: var(--bg-500); box-shadow: 0 0 0 3px rgba(255,87,34,.18);
}

/* Cronômetro grande */
.colab-timer {
  text-align: center; margin: 8px 0 18px;
}
.colab-timer-display {
  font-size: 64px; font-weight: bold; letter-spacing: 2px; color: var(--bg-900);
  font-variant-numeric: tabular-nums; line-height: 1; margin-bottom: 4px;
}
.colab-timer-state { font-size: 13px; color: var(--text-muted); min-height: 18px; }
.colab-timer.running .colab-timer-display { color: var(--accent-green); }

.colab-btn {
  width: 100%; padding: 18px; font-size: 19px; font-weight: bold;
  border: none; border-radius: 14px; cursor: pointer; color: #fff;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform .1s ease, filter .15s ease; font-family: var(--font);
}
.colab-btn:active { transform: scale(.98); }
.colab-btn.start  { background: var(--accent-green); }
.colab-btn.stop   { background: var(--accent-red); }
.colab-btn.save   { background: var(--bg-700); }
.colab-btn:disabled { opacity: .45; cursor: not-allowed; }
.colab-btn-row { display: flex; gap: 12px; }
.colab-btn-row .colab-btn { flex: 1; }

/* Rótulo "Finalizando ..." no card de quantidade */
.colab-finaliz {
  background: var(--bg-50); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px; font-size: 13px; color: var(--bg-800); margin-bottom: 12px;
}
.colab-finaliz:empty { display: none; }

/* Stepper de quantidade */
.colab-qty { display: flex; align-items: stretch; gap: 10px; }
.colab-qty button {
  width: 64px; font-size: 30px; font-weight: bold; border: 2px solid var(--bg-300);
  background: var(--bg-50); color: var(--bg-900); border-radius: 12px; cursor: pointer;
}
.colab-qty button:active { background: var(--bg-100); }
.colab-qty input {
  flex: 1; text-align: center; font-size: 30px; font-weight: bold;
  border: 2px solid var(--bg-200); border-radius: 12px; color: var(--bg-900);
}

/* Chips de tamanho */
.colab-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.colab-chip {
  flex: 1 1 60px; min-width: 56px; padding: 12px 6px; text-align: center;
  font-size: 16px; font-weight: bold; border: 2px solid var(--bg-200);
  background: #fff; color: var(--bg-800); border-radius: 12px; cursor: pointer;
}
.colab-chip.active { background: var(--bg-600); color: #fff; border-color: var(--bg-600); }
.colab-chip small { display: block; font-size: 10px; font-weight: normal; opacity: .8; }

/* Chips de MOTIVO da parada: textos longos (Almoço/Lanche, Problema na máquina…)
   → largura conforme o texto e quebra de linha, pra não vazar do quadradinho */
#cl-motivos { gap: 8px; }
#cl-motivos .colab-chip {
  flex: 0 1 auto;          /* não estica igual aos chips de tamanho */
  min-width: 0;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.15;
  white-space: normal;
  word-break: break-word;
}

/* ─────────── Tempo Padrão / Peça Piloto ─────────── */
.tp-wrap { max-width: 900px; }
.tp-lista { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow: auto; }
.tp-pick { text-align: left; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; cursor: pointer; font-size: 14px; }
.tp-pick:hover { background: var(--bg-50); border-color: var(--bg-400); }

/* Autocomplete/sugestão de Ref (consulta Tempo Padrão) */
.tp-sug { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; background: #fff;
  border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); margin-top: 2px;
  max-height: 300px; overflow: auto; display: none; }
.tp-sug-item { display: block; width: 100%; text-align: left; padding: 10px 12px; border: none;
  background: none; cursor: pointer; font-size: 14px; border-bottom: 1px solid var(--bg-50); }
.tp-sug-item:hover { background: var(--bg-50); }
.tp-sug-empty { padding: 10px 12px; color: var(--text-muted); font-size: 13px; }

.tp-total { font-size: 15px; }
.tp-total b { color: var(--bg-800); font-size: 18px; }

.tp-capturar { background: var(--bg-50); border: 1px dashed var(--bg-300); border-radius: 10px; padding: 12px 14px; }

.tp-table { width: 100%; border-collapse: collapse; }
.tp-table th, .tp-table td { padding: 9px 10px; text-align: center; border-bottom: 1px solid var(--bg-100); font-size: 14px; }
.tp-table th { background: var(--bg-700); color: #fff; font-weight: 600; }
.tp-table tbody tr:last-child td { border-bottom: none; }

.tp-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-weight: 700; font-size: 12px; color: #fff; }
.tp-badge.piloto { background: #8e6f00; }
.tp-badge.manual { background: var(--bg-500); }
.tp-badge.good { background: var(--accent-green); }
.tp-badge.warn { background: var(--accent-orange); }
.tp-badge.bad  { background: var(--accent-red); }

.tp-cmp-setor { margin-bottom: 16px; }
.tp-cmp-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px;
  padding: 8px 10px; background: var(--bg-50); border-radius: 8px 8px 0 0; }

/* Faixa "Peça Piloto" no app do colaborador */
.colab-piloto-banner {
  background: linear-gradient(135deg, #8e6f00, #c9a227); color: #fff; text-align: center;
  padding: 12px; border-radius: 12px; font-weight: 800; font-size: 14px; letter-spacing: .5px; line-height: 1.5;
}
.colab-piloto-banner b { font-size: 20px; }

/* Produção do dia */
.colab-hoje-tot {
  display: flex; gap: 12px; margin-bottom: 12px;
}
.colab-hoje-tot .kpi {
  flex: 1; background: #fff; border-radius: 12px; padding: 12px; text-align: center;
  border: 1px solid var(--border);
}
.colab-hoje-tot .kpi b { display: block; font-size: 26px; color: var(--bg-900); }
.colab-hoje-tot .kpi span { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.colab-hoje-list { list-style: none; }
.colab-hoje-list li {
  display: flex; justify-content: space-between; gap: 8px; padding: 10px 4px;
  border-bottom: 1px solid var(--bg-100); font-size: 14px;
}
.colab-hoje-list li:last-child { border-bottom: none; }
.colab-hoje-list .ci-meta { color: var(--text-muted); font-size: 12px; }
.colab-empty { text-align: center; color: var(--text-muted); padding: 16px; font-size: 14px; }

/* ═══════════════ KPIs / painel da linha (líder) ═══════════════ */
.linha-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 14px; margin-bottom: 18px; }
.linha-kpi { background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 16px; border-left: 5px solid var(--bg-600); }
.linha-kpi b { display: block; font-size: 28px; color: var(--bg-900); }
.linha-kpi span { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }

/* Barra de progresso por setor */
.setor-bar { background: var(--bg-100); border-radius: 999px; height: 14px; overflow: hidden; }
.setor-bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--bg-700), var(--bg-500)); }

/* ─── Relatório da Linha (visual limpo) ─── */
.rl-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 900px) { .rl-grid2 { grid-template-columns: 1fr; } }
.rl-list { display: flex; flex-direction: column; gap: 11px; }
.rl-row { display: grid; grid-template-columns: 132px 1fr auto; align-items: center; gap: 12px; }
.rl-row .rl-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: 13px; }
.rl-row .rl-track { background: var(--bg-100); border-radius: 999px; height: 16px; overflow: hidden; }
.rl-row .rl-track > i { display: block; height: 100%; background: linear-gradient(90deg, var(--bg-700), var(--bg-500)); border-radius: 999px; }
.rl-row .rl-val { white-space: nowrap; text-align: right; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.rl-row .rl-val b { color: var(--bg-900); font-size: 15px; }
.rl-toolbar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.rl-toolbar .form-group { margin-bottom: 0; }

/* ─── Crachás (QR) ─── */
.cr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.cr-card {
  background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
  padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
}
.cr-card .cr-qr { width: 150px; height: 150px; }
.cr-card .cr-qr img, .cr-card .cr-qr canvas { width: 150px !important; height: 150px !important; }
.cr-card .cr-nome { font-weight: bold; font-size: 14px; margin-top: 4px; }
.cr-card .cr-sub { font-size: 11px; color: var(--text-muted); }
.cr-card .cr-login { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }

/* ─── Leitor de QR (câmera) ─── */
.qr-scan-overlay {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(0,0,0,.92);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 20px;
}
.qr-scan-overlay .qr-hint { color: #fff; font-size: 16px; text-align: center; }
.qr-scan-overlay video {
  width: 100%; max-width: 420px; aspect-ratio: 1/1; object-fit: cover;
  border-radius: 16px; background: #000; box-shadow: 0 0 0 3px var(--bg-500);
}

/* ─── Responsivo ─── */
@media (max-width: 520px) {
  .colab-timer-display { font-size: 52px; }
  .hub-card { min-height: 170px; padding: 24px 20px; }
}
