:root {
  --blue: #15293a;
  --blue-dark: #0c1a26;
  --green: #0e9f6e;
  --green-dark: #057a55;
  --red: #f05252;
  --red-dark: #c81e1e;
  --orange: #ec6a1c;
  --orange-dark: #c8550f;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  /* Texto secundário do app inteiro (.text-muted, rótulos, legendas). #6b7280 dava 4,39:1
     sobre o fundo cinza da página — abaixo do mínimo de 4,5:1 para texto pequeno. */
  --gray-500: #616a75;
  --gray-700: #374151;
  --gray-900: #111827;
  --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
  --radius: 10px;

  /* Semânticas de AVISO, usadas no CSS e nos style= dos módulos (Expedição, Logística,
     Almoxarifado, PCP). Existem para o mesmo texto se ler nos dois temas: o par claro
     (#b45309 & cia) só funciona sobre carta branca — sobre a carta escura ele some.
     ⚠️ Regra: cor de texto solta = var(--ok/--warn/--danger/--info). Pílula com fundo E texto
     fixos (ex.: fundo #fee2e2 + texto #b91c1c) pode continuar literal: o par se lê nos dois. */
  --ok: #15803d;
  --warn: #b45309;
  --danger: #b91c1c;
  --info: #1341a8;

  /* Variáveis semânticas usadas pelo menu e pelo módulo de logística */
  --bg: var(--gray-100);
  --bg-card: #fff;
  --text: var(--gray-900);
  --text-muted: var(--gray-500);
  --border: var(--gray-200);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gray-100);
  color: var(--gray-900);
  min-height: 100vh;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

/* ── Layout ── */
#app { min-height: 100vh; display: flex; flex-direction: column; }

.page { display: none; flex: 1; flex-direction: column; }
.page.active { display: flex; }

/* ── Header ── */
.header {
  background: var(--blue);
  background-image:
    repeating-linear-gradient(115deg, transparent 0 24px, rgba(255,255,255,0.035) 24px 26px),
    repeating-linear-gradient(64deg, transparent 0 30px, rgba(255,255,255,0.025) 30px 32px);
  border-bottom: 3px solid var(--orange);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: 8px;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header h1 { font-size: 1.1rem; font-weight: 700; }
.header .operator-name { font-size: 0.85rem; opacity: 0.9; }
.header .brand-logo { height: 30px; width: auto; flex-shrink: 0; }
.header.hdr-stacked .brand-logo { height: 34px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none; border-radius: var(--radius);
  font-size: 1rem; font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
  -webkit-user-select: none; user-select: none;
}
.btn:active { transform: scale(0.97); filter: brightness(0.92); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-danger  { background: var(--red);  color: #fff; }
.btn-warning { background: var(--orange); color: #fff; }
.btn-outline { background: transparent; color: var(--blue); border: 2px solid var(--blue); }
.btn-gray    { background: var(--gray-200); color: var(--gray-700); }
.btn-sm      { padding: 8px 14px; font-size: 0.875rem; }
.btn-block   { width: 100%; }
.btn-lg      { padding: 16px 24px; font-size: 1.1rem; }

/* ── Cards ── */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card-title { font-size: 0.8rem; text-transform: uppercase; color: var(--gray-500); margin-bottom: 8px; letter-spacing: 0.05em; }

/* ── Grid ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* ── Operator Select ── */
#page-operator { padding: 16px; gap: 16px; }
.operator-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.operator-card {
  background: #fff; border-radius: var(--radius);
  padding: 20px 12px; text-align: center;
  cursor: pointer; box-shadow: var(--shadow);
  border: 3px solid transparent;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.operator-card:hover, .operator-card:active { border-color: var(--blue); box-shadow: var(--shadow-md); }
.operator-card .avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--blue); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 700; margin: 0 auto 10px;
}
.operator-card.has-open .avatar { background: var(--orange); }
.operator-card .op-name { font-weight: 600; font-size: 0.9rem; word-break: break-word; }
.operator-card .badge-code { font-size: 0.75rem; color: var(--gray-500); margin-top: 4px; }
.operator-card .open-badge {
  background: var(--orange); color: #fff;
  font-size: 0.65rem; font-weight: 700;
  border-radius: 99px; padding: 2px 8px; margin-top: 6px; display: inline-block;
}

/* ── Main page ── */
#page-main { gap: 0; }
.top-bar {
  background: #fff; border-bottom: 1px solid var(--gray-200);
  padding: 12px 16px; display: flex; align-items: center; justify-content: space-between;
}
.top-bar .op-info { font-size: 0.9rem; color: var(--gray-700); }
.top-bar .op-info strong { font-size: 1rem; }
.main-content { padding: 16px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }

.open-entry-banner {
  background: linear-gradient(135deg, var(--orange), #f59e0b);
  color: #fff; border-radius: var(--radius);
  padding: 14px 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
}
.open-entry-banner .timer-display { font-size: 1.4rem; font-weight: 700; font-family: monospace; }

.section-title { font-size: 0.8rem; text-transform: uppercase; color: var(--gray-500); font-weight: 600; letter-spacing: 0.05em; }

/* ── Tile grid (categories & sectors) ── */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}
.tile-card {
  background: #fff; border: 2px solid var(--gray-200);
  border-radius: var(--radius); padding: 20px 12px 16px;
  text-align: center; cursor: pointer; box-shadow: var(--shadow);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  -webkit-user-select: none; user-select: none;
}
.tile-card:hover  { border-color: var(--blue); box-shadow: var(--shadow-md); }
.tile-card:active { transform: scale(0.97); }
.tile-card .tile-icon { font-size: 2.4rem; line-height: 1; }
.tile-card .tile-name {
  font-size: 0.9rem; font-weight: 600;
  word-break: break-word; line-height: 1.3;
}
.tile-card .tile-badge {
  font-size: 0.65rem; background: var(--gray-200); color: var(--gray-500);
  border-radius: 99px; padding: 2px 8px; font-weight: 500;
}

/* keep old names as aliases for compatibility */
.category-list { display: contents; }
.sector-list   { display: contents; }

/* ── Entry page ── */
#page-entry { padding: 16px; gap: 16px; overflow-y: auto; }
.entry-header { display: flex; align-items: center; gap: 12px; }
.entry-info-card { }
.entry-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; font-size: 0.9rem; }
.entry-info-grid dt { color: var(--gray-500); font-size: 0.8rem; }
.entry-info-grid dd { font-weight: 600; }

.op-input-row { display: flex; gap: 8px; }
.op-input-row input { flex: 1; }

.entry-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.entry-summary-subtitle {
  color: var(--gray-500);
  font-size: 0.8rem;
  margin-top: -4px;
}
.entry-summary-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.entry-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 10px 12px;
}
.entry-summary-sector {
  font-weight: 600;
  line-height: 1.25;
}
.entry-summary-main { display: flex; flex-direction: column; gap: 3px; min-width: 130px; }
.entry-summary-own,
.entry-summary-target { color: var(--gray-500); font-size: 0.78rem; }
.entry-summary-progress { flex: 1; min-width: 150px; }
.entry-summary-progress-top {
  display: flex; justify-content: space-between; gap: 8px;
  color: var(--gray-500); font-size: 0.78rem; margin-bottom: 4px;
}
.entry-summary-progress-top strong { color: var(--green); white-space: nowrap; }
.entry-summary-target { margin-top: 3px; text-align: right; }
.entry-summary-empty {
  color: var(--gray-500);
  font-size: 0.9rem;
  text-align: center;
  padding: 12px 4px;
}

.pcp-program-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.45);
}
.pcp-program-box {
  width: min(440px, 94vw);
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}
.pcp-program-title {
  font-weight: 700;
  margin-bottom: 8px;
}
.pcp-program-box textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  line-height: 1.45;
}

.pcp-excel-th { position: relative; min-width: 125px; }
.pcp-excel-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  text-align: left;
}
.pcp-excel-head span { font-size: 0.72rem; opacity: 0.8; }
.pcp-excel-head.active span { color: var(--orange); opacity: 1; }
.pcp-excel-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 50;
  width: 245px;
  padding: 10px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  /* var, não #fff: com o fundo fixo e o texto em var(--gray-900) o menu abria branco-no-branco
     no tema escuro (o --gray-900 vira claro lá). */
  background: var(--bg-card);
  color: var(--text);
  box-shadow: var(--shadow-md);
  text-align: left;
}
.pcp-excel-sort,
.pcp-excel-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.pcp-excel-sort button {
  border: 1px solid var(--gray-300);
  background: var(--gray-50);
  border-radius: 6px;
  padding: 5px 7px;
  font-size: 0.76rem;
  cursor: pointer;
}
.pcp-excel-field {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-bottom: 8px;
}
.pcp-excel-field select,
.pcp-excel-field input {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.8rem;
}
.pcp-excel-values {
  max-height: 150px;
  overflow: auto;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 6px;
  margin-bottom: 8px;
  background: var(--gray-50);
}
.pcp-excel-values label {
  display: block;
  font-weight: 400;
  font-size: 0.78rem;
  padding: 3px 0;
  white-space: nowrap;
}

input[type=text], input[type=number], input[type=password] {
  border: 2px solid var(--gray-200); border-radius: var(--radius);
  padding: 12px 14px; font-size: 1rem; width: 100%; min-width: 0;
  outline: none; transition: border-color 0.2s;
  background: #fff;
}
input:focus { border-color: var(--blue); }

.timer-card {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: #fff; border-radius: var(--radius);
  padding: 24px; text-align: center;
}
.timer-card .timer-label { font-size: 0.85rem; opacity: 0.85; margin-bottom: 8px; }
.timer-card .timer-value { font-size: 3rem; font-weight: 700; font-family: monospace; letter-spacing: 0.05em; }

.progress-bar-wrap { background: var(--gray-200); border-radius: 99px; height: 10px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 99px; background: var(--green); transition: width 0.5s; }
.progress-bar-fill.danger { background: var(--red); }

/* ── History page ── */
#page-history { gap: 0; }
.history-content { padding: 16px; flex: 1; overflow-y: auto; }
.history-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.history-table th {
  background: var(--gray-100); padding: 10px 8px;
  text-align: left; font-size: 0.75rem; text-transform: uppercase;
  color: var(--gray-500); border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}
.history-table td { padding: 10px 8px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.history-table tr:hover td { background: var(--gray-50); }
.status-pill {
  display: inline-block; border-radius: 99px; padding: 3px 10px;
  font-size: 0.75rem; font-weight: 600;
}
.status-pill.aberto { background: #fef3c7; color: #92400e; }
.status-pill.encerrado { background: #d1fae5; color: #065f46; }

/* ── Admin page ── */
#page-admin { gap: 0; }
.admin-tabs { display: flex; border-bottom: 2px solid var(--gray-200); background: #fff; overflow-x: auto; }
.admin-tab {
  padding: 12px 16px; font-size: 0.9rem; font-weight: 600; cursor: pointer;
  border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap;
  color: var(--gray-500);
}
.admin-tab.active { border-color: var(--blue); color: var(--blue); }
.admin-tab.tab-order-btn { margin-left: auto; color: var(--gray-500); border-left: 1px solid var(--gray-200); }
.admin-content { padding: 16px; flex: 1; overflow-y: auto; }
.admin-panel { display: none; }
.admin-panel.active { display: block; }

table.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
table.data-table th {
  background: var(--gray-100); padding: 10px 8px;
  text-align: left; font-size: 0.75rem; text-transform: uppercase;
  color: var(--gray-500); border-bottom: 2px solid var(--gray-200);
}
table.data-table td { padding: 10px 8px; border-bottom: 1px solid var(--gray-100); }
table.data-table tr:hover td { background: var(--gray-50); }

.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-group label { font-size: 0.85rem; font-weight: 600; color: var(--gray-700); }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 140px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.95rem; }
.checkbox-label input[type=checkbox] { width: 18px; height: 18px; cursor: pointer; }
/* Campos do Apontamento manual (15/09/2026). Eram style= com background:#fff, que deixava campo
   branco no tema escuro; sem o fundo fixo, vale a regra dos campos do tema escuro. */
.am-campo { border: 2px solid var(--gray-200); border-radius: var(--radius); padding: 8px 10px; color: inherit; }
.am-campo.am-sem-op { border-color: #fcd34d; background-color: #fffbeb; }
[data-theme="dark"] input.am-campo.am-sem-op { border-color: #b45309; background-color: #3a2a10; }

/* ── Numpad Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 999; padding: 0;
}
.modal-overlay.center { align-items: center; padding: 16px; }
/* O numpad pode abrir por cima de outro modal (ex.: editar apontamento/volumes) */
#numpad-modal { z-index: 1500; }
.modal-box {
  background: #fff; border-radius: 16px 16px 0 0;
  padding: 20px; width: 100%; max-width: 420px;
}
.modal-overlay.center .modal-box { border-radius: 16px; }
.modal-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 16px; text-align: center; }
.tab-order-row {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin-bottom: 8px;
  border: 1px solid var(--gray-200); border-radius: var(--radius); background: var(--gray-50); cursor: grab;
}
.tab-order-row:active { cursor: grabbing; }
.tab-order-grip { color: var(--gray-500); font-weight: 700; }

.numpad-display {
  background: var(--gray-100); border-radius: var(--radius);
  padding: 16px; text-align: right; font-size: 2rem;
  font-weight: 700; font-family: monospace;
  margin-bottom: 16px; min-height: 68px; word-break: break-all;
}
.numpad-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.numpad-key {
  background: var(--gray-100); border: none; border-radius: var(--radius);
  padding: 18px 0; font-size: 1.3rem; font-weight: 600;
  cursor: pointer; transition: background 0.1s;
}
.numpad-key:active { background: var(--gray-300); }
.numpad-key.danger { background: #fee2e2; color: var(--red); }
.numpad-key.wide { grid-column: span 2; }

/* ── Connection overlay ── */
#connection-overlay {
  position: fixed; inset: 0; background: rgba(17,24,39,0.85);
  display: none; align-items: center; justify-content: center;
  z-index: 9999; flex-direction: column; gap: 16px; color: #fff; text-align: center; padding: 24px;
}
#connection-overlay.visible { display: flex; }
#connection-overlay .icon { font-size: 3rem; }
#connection-overlay h2 { font-size: 1.3rem; }
#connection-overlay p { font-size: 0.9rem; opacity: 0.8; }

/* ── Toast ── */
#toast-container {
  position: fixed; top: 16px; right: 16px; z-index: 1000;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--gray-900); color: #fff;
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 0.875rem; box-shadow: var(--shadow-md);
  animation: slideIn 0.2s ease;
  max-width: 300px;
}
.toast.success { background: var(--green-dark); }
.toast.error   { background: var(--red-dark); }
.toast.warning { background: var(--orange); }
@keyframes slideIn { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform: none; } }

/* ── Misc ── */
.divider { border: none; border-top: 1px solid var(--gray-200); margin: 8px 0; }
.text-sm { font-size: 0.875rem; }
.text-muted { color: var(--gray-500); }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.text-center { text-align: center; }
.hidden { display: none !important; }
.w-full { width: 100%; }

.empty-state {
  text-align: center; padding: 48px 16px; color: var(--gray-400);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.95rem; }

@media (max-width: 480px) {
  .history-table { font-size: 0.78rem; }
  .history-table th, .history-table td { padding: 8px 4px; }
  .entry-info-grid { grid-template-columns: 1fr; }
}

/* ── Operator page header: stack on small screens ── */
@media (max-width: 560px) {
  #page-operator .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
  }
  #page-operator .header h1 {
    font-size: 1rem;
  }
  #page-operator .header > .flex {
    width: 100%;
    justify-content: flex-end;
    gap: 6px;
  }
  #page-operator .header .btn-sm {
    padding: 6px 10px;
    font-size: 0.8rem;
  }
  #page-operator .header .theme-toggle {
    font-size: 1rem;
    padding: 4px;
  }
}

/* ══════════════════════════════════
   RESPONSIVO — celular / tablet / notebook / TV
   ══════════════════════════════════ */

/* ── Celular (≤ 600px) ── */
@media (max-width: 600px) {
  body { font-size: 15px; }

  .header { padding: 10px 12px; }
  .header h1 { font-size: 1rem; }
  /* botões do cabeçalho compactos — evitam empilhar sobre o conteúdo */
  .header .btn-sm { padding: 7px 10px; font-size: 0.8rem; }

  .main-content { padding: 12px; gap: 12px; }
  #page-operator, #page-entry { padding: 12px; gap: 12px; }

  /* tiles e operadores menores cabem melhor na tela estreita */
  .operator-grid,
  .tile-grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 10px; }
  .tile-card { padding: 16px 8px 12px; }
  .tile-card .tile-icon { font-size: 2rem; }
  .operator-card { padding: 16px 10px; }
  .operator-card .avatar { width: 48px; height: 48px; font-size: 1.2rem; }

  .timer-card { padding: 18px; }
  .timer-card .timer-value { font-size: 2.4rem; }

  /* menu da tela inicial ocupa quase toda a largura, sem estourar */
  .hdr-menu-list { left: 8px; right: 8px; min-width: 0; }

  /* kanban da logística: colunas mais estreitas */
  .logi-col { flex-basis: 200px; min-width: 200px; }

  /* ── Barras de abas (Logística, PCP, Gerenciamento) ──
     São 13 abas numa faixa de 360px: rolam para o lado, mas com o padding de mesa cabiam
     três e a barrinha nativa aparecia por cima do texto. Aqui a aba encolhe, a barra some
     (o dedo arrasta direto) e a faixa ganha altura de toque. */
  .admin-tabs { -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .admin-tabs::-webkit-scrollbar { height: 0; }
  .admin-tab { padding: 11px 12px; font-size: 0.84rem; }
  .admin-tab.tab-order-btn { margin-left: 0; }   /* `auto` empurrava o botão para longe na barra rolável */
  .admin-content { padding: 12px; }

  /* Tela de login: um posto por linha fica com alvo de toque maior que dois espremidos. */
  .login-postos { grid-template-columns: 1fr 1fr; gap: 10px; }
  .login-wrap { padding: 18px 14px 28px; }
}

/* ── Celular pequeno (≤ 380px) ── */
@media (max-width: 380px) {
  .operator-grid,
  .tile-grid { grid-template-columns: repeat(auto-fill, minmax(94px, 1fr)); }
  .tile-card .tile-icon { font-size: 1.8rem; }
  .timer-card .timer-value { font-size: 2rem; }
}

/* ── TV / telas grandes (≥ 1600px): proporções maiores p/ leitura à distância ── */
@media (min-width: 1600px) {
  body { font-size: 19px; }

  .header { padding: 16px 28px; }
  .header h1 { font-size: 1.4rem; }

  .main-content { padding: 24px; gap: 22px; }

  .operator-grid,
  .tile-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 20px; }
  .tile-card { padding: 26px 16px 20px; }
  .tile-card .tile-icon { font-size: 3rem; }
  .operator-card .avatar { width: 68px; height: 68px; font-size: 1.7rem; }

  .timer-card .timer-value { font-size: 3.6rem; }
}

/* ── TV 4K (≥ 2560px) ── */
@media (min-width: 2560px) {
  body { font-size: 22px; }

  .operator-grid,
  .tile-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 26px; }
  .tile-card .tile-icon { font-size: 3.6rem; }
  .timer-card .timer-value { font-size: 4.4rem; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }

/* ══════════════════════════════════
   DARK THEME
   ══════════════════════════════════ */
[data-theme="dark"] {
  --gray-50:  #1f2937;
  --gray-100: #111827;
  --gray-200: #374151;
  --gray-300: #4b5563;
  --gray-400: #6b7280;
  --gray-500: #9ca3af;
  --gray-700: #d1d5db;
  --gray-900: #f9fafb;

  --ok: #63c58c;
  --warn: #e9ac5c;
  --danger: #f58a80;
  --info: #8ab4f8;

  /* Variáveis semânticas no tema escuro */
  --bg: #0f172a;
  --bg-card: #1e293b;
  --border: #334155;
}

[data-theme="dark"] body {
  background: #0f172a;
  color: #f1f5f9;
}

[data-theme="dark"] .card,
[data-theme="dark"] .tile-card {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
[data-theme="dark"] .tile-card:hover { border-color: var(--blue); }

[data-theme="dark"] .header {
  background: #122334;
  border-bottom: 3px solid var(--orange);
}

[data-theme="dark"] .top-bar {
  background: #1e293b;
  border-bottom: 1px solid #334155;
}

/* Campos no tema escuro.
   ⚠️ `background-color`, NUNCA o atalho `background`: o atalho apaga o background-image, e é ele
   que desenha a setinha dos selects do App RR Inox (SVG embutido) — no escuro o select ficava sem
   seta. A lista cobre também date/time/search/textarea (antes só text/number/password, então
   campo de data nascia branco no escuro) e o `color` é !important porque telas com regra própria
   (ex.: .gb-campo input do Gabarito) fixavam texto escuro sobre o fundo escuro. */
[data-theme="dark"] input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]):not([type=button]):not([type=submit]),
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background-color: #334155 !important;
  border-color: #475569 !important;
  color: #f1f5f9 !important;
}
/* Ícone nativo (calendário/relógio/limpar) é preto e some no campo escuro. */
[data-theme="dark"] input::-webkit-calendar-picker-indicator,
[data-theme="dark"] input::-webkit-search-cancel-button { filter: invert(1) opacity(.75); }

[data-theme="dark"] input::placeholder { color: #64748b; }

[data-theme="dark"] .category-btn {
  background: #1e293b;
  color: #f1f5f9;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
[data-theme="dark"] .category-btn:hover { background: #273549; }
[data-theme="dark"] .category-btn.active { background: var(--blue); color: #fff; }

[data-theme="dark"] .sector-btn {
  background: #334155;
  border-color: #475569;
  color: #f1f5f9;
}
[data-theme="dark"] .sector-btn:hover { background: #3d5068; border-color: var(--blue); }

[data-theme="dark"] .operator-card {
  background: #1e293b;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
[data-theme="dark"] .operator-card:hover { border-color: var(--blue); }

[data-theme="dark"] .admin-tabs {
  background: #1e293b;
  border-bottom-color: #334155;
}
[data-theme="dark"] .admin-tab { color: #94a3b8; }
[data-theme="dark"] .admin-tab.active { color: #f3934f; border-color: #f3934f; }

[data-theme="dark"] table.data-table th,
[data-theme="dark"] .history-table th {
  background: #1e293b;
  color: #94a3b8;
  border-bottom-color: #334155;
}
[data-theme="dark"] table.data-table td,
[data-theme="dark"] .history-table td {
  border-bottom-color: #1e293b;
}
[data-theme="dark"] table.data-table tr:hover td,
[data-theme="dark"] .history-table tr:hover td {
  background: #273549;
}

[data-theme="dark"] .btn-gray {
  background: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .btn-outline {
  border-color: #f3934f;
  color: #f3934f;
}

[data-theme="dark"] .numpad-display {
  background: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .numpad-key {
  background: #334155;
  color: #f1f5f9;
}
[data-theme="dark"] .numpad-key:active { background: #475569; }
[data-theme="dark"] .numpad-key.danger { background: #450a0a; color: #fca5a5; }

[data-theme="dark"] .modal-box {
  background: #1e293b;
  border: 1px solid #334155;
}

[data-theme="dark"] .progress-bar-wrap { background: #334155; }

[data-theme="dark"] #connection-overlay { background: rgba(0,0,0,0.92); }

[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #475569; }

/* Linha atrasada (tabelas de Prioridades etc.) — par claro/escuro legível */
.row-late { background: #fef2f2; }
[data-theme="dark"] .row-late { background: #3b1d1d; }

/* Theme toggle button */
.theme-toggle {
  background: none; border: none; cursor: pointer;
  font-size: 1.1rem; padding: 6px; border-radius: 6px;
  color: rgba(255,255,255,0.85);
  transition: background 0.15s;
}
.theme-toggle:hover { background: rgba(255,255,255,0.15); }

/* ── Requisition card (warehouse open panel) ── */
.req-card { transition: box-shadow 0.15s, border-color 0.15s; border: 2px solid var(--gray-200); }
.req-card.req-selected { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(21,41,58,0.22); }
/* Requisição aberta há mais de 10 min: pisca para sinalizar prioridade */
.req-card.req-blink { animation: req-blink 1s ease-in-out infinite; border-color: #dc2626; }
@keyframes req-blink {
  0%, 100% { box-shadow: 0 0 0 2px rgba(220,38,38,0.15); background: rgba(220,38,38,0.04); }
  50% { box-shadow: 0 0 0 4px rgba(220,38,38,0.55); background: rgba(220,38,38,0.14); }
}

/* ── Print layout ── */
#print-area { display: none; }

@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; }
  .slip-page { page-break-after: always; }
  .slip-page:last-child { page-break-after: auto; }

  /* Impressão é sempre em papel branco: força as variáveis do tema CLARO dentro do
     print-area, mesmo com o modo escuro ativo — senão markup compartilhado tela/impressão
     (ex.: relatórios do PCP, que copiam o HTML da tela) sairia com cores do tema escuro. */
  #print-area {
    --gray-50:  #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --bg: #fff;
    --bg-card: #fff;
    --text: #111827;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    /* Semânticas de aviso na versão clara: o relatório de estoque baixo e o romaneio pintam a
       coluna crítica com var(--warn) — no tema escuro ela sairia amarelo-claro no papel. */
    --ok: #15803d;
    --warn: #b45309;
    --danger: #b91c1c;
    --info: #1341a8;
    color: #111;
    background: #fff;
  }
}

/* Dashed cut line between slips */
.slip-cut {
  border: none;
  border-top: 1px dashed #aaa;
  margin: 4mm 0;
}

.req-slip {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #999;
  padding: 6mm 10mm;
  font-family: Arial, sans-serif;
  color: #111;
  background: #fff;
  /* Never break a single slip across pages */
  break-inside: avoid;
  page-break-inside: avoid;
}

/* ── Crachás (impressão + plastificação) ── */
.badge-sheet {
  display: flex;
  flex-wrap: wrap;
  gap: 4mm;
  align-content: flex-start;
}
.badge-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.badge-card {
  /* Cor de destaque (faixa do topo, cargo e rodapé). Trocar SÓ esta variável muda a
     identidade do crachá sem mexer no layout — .badge-laranja é a da Logística. */
  --badge-accent: var(--blue);
  width: 54mm;
  height: 86mm;
  box-sizing: border-box;
  border: 1px dashed #999;          /* guia de corte */
  border-radius: 3mm;
  overflow: hidden;
  background: #fff;
  color: #111;
  font-family: -apple-system, 'Segoe UI', Arial, sans-serif;
  display: flex;
  flex-direction: column;
  break-inside: avoid;
  page-break-inside: avoid;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.badge-laranja { --badge-accent: var(--orange); }
.badge-head {
  background: var(--badge-accent);
  color: #fff;
  padding: 2mm 2.5mm;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 2mm;
  min-height: 9mm;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.badge-logo {
  margin-left: auto;     /* sempre no canto superior direito */
  max-height: 7mm;
  max-width: 45%;
  width: auto;
  object-fit: contain;
}
.badge-company {
  font-weight: 700;
  font-size: 3.2mm;
  letter-spacing: 0.3px;
}
.badge-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3mm 3mm 2mm;
}
.badge-photo {
  width: 31mm;
  height: 37mm;
  border: 0.4mm solid var(--gray-300);
  border-radius: 1.5mm;
  margin: 1.5mm 0 2mm;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-linear-gradient(45deg, #fcfcfd, #fcfcfd 2mm, #f4f5f7 2mm, #f4f5f7 4mm);
}
.badge-photo span {
  color: var(--gray-400);
  font-size: 2.8mm;
  letter-spacing: 1.5px;
  font-weight: 600;
}
.badge-role {
  font-size: 2.3mm;
  letter-spacing: 2.5px;
  font-weight: 700;
  color: var(--badge-accent);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.badge-name {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  line-height: 1.05;
  margin: 0.8mm 0 auto;
  word-break: break-word;
}
.badge-first {
  font-size: 4.8mm;
  font-weight: 800;
  text-transform: uppercase;
  color: #000;
}
.badge-last {
  font-size: 4mm;
  font-weight: 700;
  text-transform: uppercase;
  color: #000;
  margin-top: 0.6mm;
}
.badge-name-sm .badge-first { font-size: 4mm; }
.badge-name-sm .badge-last { font-size: 3.4mm; }
.badge-barcode {
  width: 48mm;
  height: 14mm;
  margin-top: 1.5mm;
}
.badge-barcode .bc-svg { width: 100%; height: 100%; display: block; }
/* QR Code do crachá (substitui o Code39) */
.badge-qr-wrap {
  width: 18mm;
  height: 18mm;
  margin-top: 1.5mm;
}
.badge-qr { width: 100%; height: 100%; display: block; image-rendering: pixelated; }

/* Overlay do scanner de crachá (QR) */
.badge-scan-overlay {
  position: fixed; inset: 0; z-index: 4000;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.badge-scan-overlay.hidden { display: none; }
.badge-scan-box {
  background: var(--card-bg, #fff);
  border-radius: 14px;
  padding: 16px;
  width: 100%; max-width: 380px;
}
.badge-scan-title { font-weight: 700; text-align: center; margin-bottom: 10px; }
.badge-scan-stage {
  width: 100%; aspect-ratio: 1/1;
  background: #000; border-radius: 10px; overflow: hidden;
}
.badge-scan-stage video { width: 100%; height: 100%; object-fit: cover; }
.badge-scan-hint { text-align: center; font-size: 0.85rem; color: var(--text-muted, #667); margin-top: 8px; }
.badge-code {
  font-family: 'Courier New', monospace;
  font-size: 3.8mm;
  font-weight: 700;
  letter-spacing: 3px;
  margin-top: 1mm;
  text-align: center;
  color: #000;
}
.badge-foot {
  height: 3mm;
  background: var(--badge-accent);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

@media print {
  .badge-sheet { gap: 4mm; }
  .badge-card { border: 0.3mm dashed #bbb; }
}

/* ════════════ MÓDULO DE LOGÍSTICA ════════════ */
/* Cabeçalho empilhado: título centralizado, 🌙 à direita, ações embaixo */
.header.hdr-stacked {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.hdr-title-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  width: 100%;            /* ocupa a largura toda — menu (esq) e tema (dir) vão aos cantos */
}
.hdr-title-row .brand-logo { height: 32px; width: auto; }
.hdr-title-row h1 { margin: 0; text-align: center; padding: 0 46px; line-height: 1.2; }
.hdr-theme { position: absolute; right: 0; top: 50%; transform: translateY(-50%); }
.hdr-back {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; padding: 4px;
}
.hdr-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
}
.hdr-btn { background: rgba(255,255,255,0.15); color: #fff; }
.hdr-operator { font-weight: 700; font-size: 0.95rem; color: #fff; }

/* Menu da tela inicial */
.hdr-menu-btn {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; padding: 4px 8px;
}
.hdr-menu-list {
  position: fixed; top: 52px; left: 10px; z-index: 300;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, #ddd);
  border-radius: 10px;
  box-shadow: var(--shadow-md, 0 8px 24px rgba(0,0,0,0.18));
  display: flex; flex-direction: column; min-width: 230px;
  max-width: calc(100vw - 20px); overflow: hidden;
}
.hdr-menu-list button {
  background: none; border: none; text-align: left;
  padding: 14px 18px; font-size: 1rem; cursor: pointer;
  color: var(--text, #222); border-bottom: 1px solid var(--border, #eee);
}
.hdr-menu-list button:last-child { border-bottom: none; }
.hdr-menu-list button:active { background: var(--bg, #eef); }

/* Faixa/etiqueta de PRIORIDADE */
.prio-ribbon {
  display: inline-block; background: var(--red, #dc2626); color: #fff;
  font-size: 0.66rem; font-weight: 800; letter-spacing: 0.5px;
  padding: 2px 7px; border-radius: 4px; margin-right: 6px; text-transform: uppercase;
}
.logi-card.is-prio { border-left: 6px solid var(--red, #dc2626) !important; }
.exp-work-card.is-prio { border-left: 6px solid var(--red, #dc2626); }
.card.is-prio { border-left: 6px solid var(--red, #dc2626); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: grayscale(0.3); }

/* Cores por status */
:root {
  --st-ag_separacao: #f59e0b;
  --st-em_separacao: #3b82f6;
  --st-conferencia: #8b5cf6;
  --st-faturamento: #06b6d4;
  /* Faturado: NF emitida, falta levar à área da transportadora. Teal escuro, irmão do
     Ag. Faturamento — as duas colunas da etapa se leem juntas no kanban. */
  --st-faturado: #0e7490;
  --st-ag_transportadora: #f97316;
  --st-expedido: #22c55e;
  /* Origem da venda: azul marca a que nasceu no App RR Inox (a única que passa pelo
     faturamento). As cores acima continuam sendo da ETAPA — esta é do cartão. */
  --st-pipeline: #2563eb;
  /* Venda do Showroom (transportadora "Cliente Showroom"): ROXO. É a venda que o cliente está
     no balcão esperando levar — desde 18/08/2026 ela pinta o cartão INTEIRO (fundo + bordas),
     não só a fita lateral, para não se perder no meio da coluna.
     ⚠️ O tom é o MESMO do card do App RR Inox (--pl-purple / --pl-purple-soft / -bd em
     pipeline.css): o Guilherme quer os dois quadros falando a mesma cor. O `--st-showroom`
     é o cheio (fita e etiqueta, que levam texto BRANCO por cima — por isso ele fica saturado
     também no escuro, onde o --pl-purple é claro demais para receber branco). */
  --st-showroom: #7A4B86;
  --st-showroom-bg: #F0E6F2;
  --st-showroom-bd: #DCC9E0;
  --st-showroom-ink: #7A4B86;   /* texto de apoio SOBRE o fundo lilás (não serve para a fita) */
}
[data-theme="dark"] {
  --st-showroom: #8B5FA0;
  --st-showroom-bg: #2A1F30;
  --st-showroom-bd: #4A3654;
  --st-showroom-ink: #C7A3D2;   /* no escuro o texto inverte: lilás claro sobre roxo profundo */
}

/* Chips / pills */
.logi-chip {
  display: inline-block;
  background: var(--bg-card, #eef);
  border: 1px solid var(--border, #ccd);
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 0.72rem;
  margin: 1px 0;
}
.logi-pill {
  display: inline-block;
  border-radius: 10px;
  padding: 2px 9px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  background: #888;
  white-space: nowrap;
}
.logi-pill.st-ag_separacao { background: var(--st-ag_separacao); }
.logi-pill.st-em_separacao { background: var(--st-em_separacao); }
.logi-pill.st-conferencia { background: var(--st-conferencia); }
.logi-pill.st-faturamento { background: var(--st-faturamento); }
.logi-pill.st-faturado { background: var(--st-faturado); }
.logi-pill.st-ag_transportadora { background: var(--st-ag_transportadora); }
.logi-pill.st-expedido { background: var(--st-expedido); }

/* Kanban */
.logi-dash-toolbar { padding: 10px 12px 0; }
.logi-dash-toolbar input { width: 100%; max-width: 520px; }
.logi-kanban {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 12px 12px 6px;
  flex: 1;
  align-items: flex-start;
  /* A barra horizontal do próprio quadro fica ESCONDIDA: ela nasce no fim do conteúdo, que
     quando há muitos cards cai bem abaixo do que a pessoa está vendo. Quem rola o quadro para o
     lado é a barra flutuante abaixo (.hscroll-float), presa no rodapé da TELA. */
  scrollbar-width: none;
  padding-bottom: 26px;   /* espaço para a barra flutuante não cobrir o último card */
}
.logi-kanban::-webkit-scrollbar { height: 0; }

/* Barra de rolagem horizontal FLUTUANTE: fica sempre no rodapé da tela, alinhada com o quadro,
   e comanda o scroll dele (as duas pontas se sincronizam em dashboard.js). Grossa de propósito —
   a barra global do app tem 6px e é fina demais para arrastar com o dedo. */
.hscroll-float {
  position: fixed;
  bottom: 0;
  height: 18px;
  max-width: 100vw;   /* trava de segurança: barra mais larga que a janela dá scroll no body */
  overflow-x: auto;
  overflow-y: hidden;
  z-index: 60;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 6px rgba(0,0,0,0.10);
  scrollbar-width: auto;
  scrollbar-color: var(--gray-400) var(--gray-200);
  display: none;                 /* só aparece quando o quadro passa da largura */
}
.hscroll-float.on { display: block; }
.hscroll-float > div { height: 1px; }
.hscroll-float::-webkit-scrollbar { height: 18px; }
.hscroll-float::-webkit-scrollbar-track { background: var(--gray-200); }
.hscroll-float::-webkit-scrollbar-thumb {
  background: var(--gray-400);
  border: 3px solid var(--gray-200);
  border-radius: 9px;
  min-width: 60px;
}
.hscroll-float::-webkit-scrollbar-thumb:hover { background: var(--gray-500); }
[data-theme="dark"] .hscroll-float { scrollbar-color: #64748b #334155; }
[data-theme="dark"] .hscroll-float::-webkit-scrollbar-track { background: #334155; }
[data-theme="dark"] .hscroll-float::-webkit-scrollbar-thumb { background: #64748b; border-color: #334155; }

/* Barra de rolagem VERTICAL flutuante (vscroll.js): a irmã em pé da .hscroll-float, colada na
   direita da JANELA. Mesma grossura de 18px, pelo mesmo motivo — a barra global do app tem 6px e
   não se pega com o dedo. `bottom` é escrito pelo JS: sobe 18px quando a horizontal está aberta,
   para uma não cobrir a ponta da outra. */
.vscroll-float {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 18px;
  max-height: 100vh;   /* trava de segurança, igual à .hscroll-float */
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 60;         /* abaixo do cabeçalho (100), dos toasts (1000) e dos modais */
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  box-shadow: -2px 0 6px rgba(0,0,0,0.10);
  scrollbar-width: auto;
  scrollbar-color: var(--gray-400) var(--gray-200);
  display: none;                 /* só aparece quando a página passa da altura da janela */
}
.vscroll-float.on { display: block; }
.vscroll-float > div { width: 1px; }
.vscroll-float::-webkit-scrollbar { width: 18px; }
.vscroll-float::-webkit-scrollbar-track { background: var(--gray-200); }
.vscroll-float::-webkit-scrollbar-thumb {
  background: var(--gray-400);
  border: 3px solid var(--gray-200);
  border-radius: 9px;
  min-height: 60px;
}
.vscroll-float::-webkit-scrollbar-thumb:hover { background: var(--gray-500); }
[data-theme="dark"] .vscroll-float { scrollbar-color: #64748b #334155; }
[data-theme="dark"] .vscroll-float::-webkit-scrollbar-track { background: #334155; }
[data-theme="dark"] .vscroll-float::-webkit-scrollbar-thumb { background: #64748b; border-color: #334155; }
.logi-col {
  flex: 1 0 230px;
  min-width: 230px;
  background: var(--bg-card, #f6f7f9);
  border: 1px solid var(--border, #e2e5ea);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  max-height: 100%;
}
.logi-col-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  font-weight: 700;
  font-size: 0.82rem;
  color: #fff;
  border-radius: 10px 10px 0 0;
  background: #888;
}
.logi-col-head.st-ag_separacao { background: var(--st-ag_separacao); }
.logi-col-head.st-em_separacao { background: var(--st-em_separacao); }
.logi-col-head.st-conferencia { background: var(--st-conferencia); }
.logi-col-head.st-faturamento { background: var(--st-faturamento); }
.logi-col-head.st-faturado { background: var(--st-faturado); }
.logi-col-head.st-ag_transportadora { background: var(--st-ag_transportadora); }
.logi-col-head.st-expedido { background: var(--st-expedido); }
.logi-col-head.st-tratativa { background: #f97316; }
/* Coleta de Produção: P9 = âmbar, P3 = azul, Conferido = verde */
.logi-col-head.st-ag_coleta_p9 { background: #f59e0b; }
.logi-col-head.st-ag_coleta_p3 { background: #2563eb; }
.logi-col-head.st-conferido { background: #22c55e; }
/* Caminhão: A Buscar = âmbar, Coletado = verde */
.logi-col-head.st-pendente { background: #f59e0b; }
.logi-col-head.st-coletado { background: #22c55e; }
.logi-count {
  background: rgba(0,0,0,0.22);
  border-radius: 9px;
  padding: 0 8px;
  font-size: 0.78rem;
}
.logi-col-today {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--green-dark, #057a55);
  background: rgba(16,159,110,0.12);
  padding: 3px 10px;
  text-align: center;
}
.logi-col-body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}
.logi-empty { color: var(--text-muted, #999); text-align: center; padding: 8px; font-size: 0.85rem; }
.logi-card {
  background: var(--bg, #fff);
  border: 1px solid var(--border, #e2e5ea);
  border-left: 4px solid #888;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.82rem;
}
.logi-card.st-ag_separacao { border-left-color: var(--st-ag_separacao); }
.logi-card.st-em_separacao { border-left-color: var(--st-em_separacao); }
.logi-card.st-conferencia { border-left-color: var(--st-conferencia); }
.logi-card.st-faturamento { border-left-color: var(--st-faturamento); }
.logi-card.st-faturado { border-left-color: var(--st-faturado); }
.logi-card.st-ag_transportadora { border-left-color: var(--st-ag_transportadora); }
.logi-card.st-expedido { border-left-color: var(--st-expedido); }
/* Venda vinda do App RR Inox: fita azul escrita na LATERAL do cartão. O cartão em si não muda
   de cor — a cor dele continua sendo a da etapa (borda esquerda). A fita fica DENTRO da
   borda (posicionada sobre a caixa de padding), então as duas informações convivem. */
.logi-card.is-pipeline, .exp-work-card.is-pipeline, .card.is-pipeline,
.logi-card.is-showroom, .exp-work-card.is-showroom, .card.is-showroom {
  position: relative;
  padding-left: 26px;
}
.logi-fita {
  position: absolute; left: 0; top: 0; bottom: 0; width: 18px;
  background: var(--st-pipeline); color: #fff;
  display: flex; align-items: center; justify-content: center;
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-size: 9px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
  border-radius: 4px 0 0 4px;   /* acompanha os cantos do cartão pelo lado de fora */
  pointer-events: none;
}
/* Showroom: o cartão fica roxo POR INTEIRO — fundo, as quatro bordas, a barra da esquerda e a
   fita lateral. Vem DEPOIS das regras .logi-card.st-* e .is-prio de propósito: o Showroom manda
   na cor, porque ele já É a prioridade (nasce presencial na Logística) e uma barra vermelha de
   .is-prio no meio do cartão roxo brigava com a leitura da coluna.
   A fita continua escrita "App RR Inox" quando a venda nasceu no App (LOGI.fitaHtml) — quem
   anuncia o Showroom é a etiqueta de cima. */
.logi-fita.is-showroom { background: var(--st-showroom); }
.logi-card.is-showroom, .exp-work-card.is-showroom, .card.is-showroom {
  background: var(--st-showroom-bg);
  border-color: var(--st-showroom-bd);
  border-left: 6px solid var(--st-showroom) !important;
}
/* Textos do cartão roxo: no claro o cinza de legenda some sobre o lilás, então as duas linhas
   de apoio passam a usar o próprio roxo (e o título, a tinta normal do tema). */
.logi-card.is-showroom .logi-card-meta,
.logi-card.is-showroom .logi-card-prog,
.logi-card.is-showroom .logi-card-who,
.logi-card.is-showroom .logi-vol,
.exp-work-card.is-showroom .logi-card-meta,
.card.is-showroom .logi-card-meta { color: var(--st-showroom-ink); }
/* A etiqueta de prioridade do Showroom vem escrita SHOWROOM e em roxo (LOGI.prioHtml) —
   é ela, no ALTO do cartão, que diferencia a venda de showroom das outras do App. */
.prio-ribbon.show { background: var(--st-showroom); }
/* O aviso de PARADO usa margens negativas para colar no topo do cartão: com a fita, a margem
   esquerda tem de respeitar o espaço dela, senão o vermelho passa por cima da escrita. */
.logi-card.is-pipeline .logi-card-stopped,
.logi-card.is-showroom .logi-card-stopped { margin-left: -6px; }
.logi-card.st-ag_coleta_p9 { border-left-color: #f59e0b; }
.logi-card.st-ag_coleta_p3 { border-left-color: #2563eb; }
.logi-card.st-conferido { border-left-color: #22c55e; }
.logi-card-top { display: flex; justify-content: space-between; align-items: center; }
.logi-vol { font-size: 0.7rem; color: var(--text-muted, #888); }
.logi-card-client { font-weight: 600; margin-top: 2px; }
.logi-card-meta { font-size: 0.74rem; color: var(--text-muted, #777); margin-top: 1px; }
.logi-card-prog { font-size: 0.72rem; margin-top: 4px; color: var(--blue, #2563eb); }
.logi-card-who { font-size: 0.72rem; margin-top: 3px; color: var(--text-muted, #555); }
.logi-timer { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Card atrasado (>48h sem expedir) — pisca amarelo.
   ⚠️ O quadro "apagado" da piscada NÃO pode ser um fundo literal: no cartão do Showroom ele
   apagava o roxo e o cartão piscava amarelo↔branco. `--card-bg` é o fundo do próprio cartão,
   redefinido por quem tem cor própria — a keyframe resolve a variável no elemento animado. */
.logi-card { --card-bg: var(--bg, #fff); }
.logi-card.is-showroom { --card-bg: var(--st-showroom-bg); }
.logi-card.is-overdue { animation: blink-overdue 1.1s steps(1, end) infinite; }
@keyframes blink-overdue {
  0%, 49% { background: #fff7cc; border-left-color: #d97706 !important; box-shadow: 0 0 0 2px rgba(217,119,6,0.35); }
  50%, 100% { background: var(--card-bg); }
}

/* Card "Parado" no Dashboard */
.logi-card.is-stopped { border-left-color: var(--red, #dc2626) !important; background: rgba(220,38,38,0.06); }
.logi-card-stopped { margin: -8px -10px 6px; padding: 4px 10px; border-radius: 8px 8px 0 0; background: var(--red, #dc2626); color: #fff; }
.logi-stopped-top { font-weight: 800; font-size: 0.72rem; letter-spacing: 1px; }
.logi-stopped-reason { font-size: 0.78rem; font-weight: 600; }

/* Ag. Tratativa (11/09/2026): carga devolvida pelo App RR Inox, separação preservada */
.logi-card.is-tratativa { border-left-color: #f97316 !important; background: rgba(249,115,22,0.06); }
.logi-card-tratativa { margin: -8px -10px 6px; padding: 4px 10px; border-radius: 8px 8px 0 0; background: #f97316; color: #fff; }
.logi-card.is-pipeline .logi-card-tratativa,
.logi-card.is-showroom .logi-card-tratativa { margin-left: -6px; }
.logi-tratativa-origem { font-size: 0.72rem; opacity: 0.9; }
.logi-tag-reproc { display: inline-block; margin-right: 6px; padding: 1px 6px; border-radius: 999px; background: #f97316; color: #fff; font-size: 0.66rem; font-weight: 800; letter-spacing: 0.5px; vertical-align: middle; }

/* Card "Parado" na Expedição */
.exp-stopped-card { border: 2px solid var(--red, #dc2626); background: rgba(220,38,38,0.06); text-align: center; }
.exp-stopped-title { font-weight: 800; color: var(--red, #dc2626); letter-spacing: 1px; }
.exp-stopped-reason { font-size: 1rem; font-weight: 600; margin-top: 2px; }

/* Itens da Expedição (checklist) */
.exp-item-list { display: flex; flex-direction: column; gap: 6px; }
.exp-item {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 10px;
  border: 2px solid var(--gray-200, #e2e5ea);
  border-radius: 10px;
  cursor: pointer;
}
.exp-item input[type=checkbox] { width: 22px; height: 22px; }
.exp-item.done { background: rgba(34,197,94,0.10); border-color: var(--st-expedido); }
.exp-item-qty { font-weight: 700; white-space: nowrap; }
.exp-item-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.exp-item-code { font-size: 0.78rem; font-weight: 700; color: var(--text-muted, #667); }
.exp-item-desc { font-size: 0.9rem; }
/* Origem do item: OP que produziu (verde = já liberada, âmbar = ainda na fábrica) ou estoque */
.exp-item-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.exp-item-tag {
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.25;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: normal;
}
.exp-item-tag.is-op-ok { background: rgba(34,197,94,0.14); border-color: rgba(34,197,94,0.45); color: #15803d; }
.exp-item-tag.is-op-wip { background: rgba(234,179,8,0.16); border-color: rgba(234,179,8,0.5); color: #92600a; }
.exp-item-tag.is-estoque { background: rgba(37,99,235,0.12); border-color: rgba(37,99,235,0.4); color: #1d4ed8; }
/* Caixas do item e sugestão de volumes (09/10/2026, services/volumes-saida.js) */
.exp-item-tag.is-caixa { background: rgba(100,116,139,0.12); border-color: rgba(100,116,139,0.4); color: #334155; }
.exp-item-tag.is-caixa-alerta { background: rgba(220,38,38,0.10); border-color: rgba(220,38,38,0.45); color: #b91c1c; }
.exp-vol-sug { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; font-size: 0.88rem; color: var(--text-muted, #667); }
.exp-vol-sug > span { flex: 1; min-width: 200px; }
.exp-vol-sug b { color: var(--text, #1f2937); }

/* Expedição — leitura dos volumes por câmera */
.exp-scan-progress { text-align: center; font-weight: 700; margin: 8px 0; font-size: 1.05rem; }
.exp-scan-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 8px; }
.exp-vol-chip { font-size: 0.85rem; padding: 4px 10px; border-radius: 999px; border: 2px solid var(--gray-200, #e2e5ea); color: var(--text-muted, #667); }
.exp-vol-chip.on { background: rgba(34,197,94,0.15); border-color: var(--st-expedido, #22c55e); color: #15803d; font-weight: 700; }
/* No tema escuro o fundo translúcido dessas etiquetas cai sobre carta escura: o texto tem de
   clarear junto, senão vira verde-escuro sobre cinza-escuro (era o caso na Separação). */
[data-theme="dark"] .exp-item-tag.is-op-ok  { color: #6ee7a8; }
[data-theme="dark"] .exp-item-tag.is-op-wip { color: #f5c77e; }
[data-theme="dark"] .exp-item-tag.is-estoque { color: #8ab4f8; }
[data-theme="dark"] .exp-item-tag.is-caixa { color: #cbd5e1; }
[data-theme="dark"] .exp-item-tag.is-caixa-alerta { color: #fca5a5; }
[data-theme="dark"] .exp-vol-sug b { color: #f1f5f9; }
[data-theme="dark"] .exp-vol-chip.on { color: #6ee7a8; }
.exp-scan-stage { position: relative; width: 100%; max-width: 360px; margin: 0 auto; aspect-ratio: 1 / 1; background: #000; border-radius: 12px; overflow: hidden; }
.exp-scan-stage video { width: 100%; height: 100%; object-fit: cover; }
.exp-scan-hint { text-align: center; font-size: 0.85rem; color: var(--text-muted, #667); margin-top: 8px; }

/* Worklist da Expedição */
.exp-worklist { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.exp-work-card {
  background: var(--bg, #fff);
  border: 1px solid var(--border, #e2e5ea);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
}
.exp-work-card:active { transform: scale(0.99); }

/* Cronômetro da Expedição */
.exp-timer-card { margin-bottom: 12px; }

/* Fotos da conferência */
.exp-photo-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.exp-photo-thumb {
  width: 72px; height: 72px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--border, #ccd);
  display: block;
}
.exp-photo-wrap { position: relative; display: inline-block; }
.exp-photo-del {
  position: absolute; top: -6px; right: -6px;
  width: 22px; height: 22px; border-radius: 50%;
  border: none; background: var(--red, #dc2626); color: #fff;
  font-size: 13px; line-height: 22px; text-align: center; padding: 0;
  cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.4);
}

/* Etiqueta de remetente: não há mais markup de etiqueta no navegador — a reimpressão
   chama o servidor (print-label.ps1), o mesmo motor da impressão automática. */

/* Lista de vendas adicionadas na inclusão (juntar 2+ vendas) */
.logi-venda-list { display: flex; flex-direction: column; gap: 6px; }
.logi-venda-chip { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; background: var(--surface-2, #f3f4f6); border: 1px solid var(--border, #e5e7eb); border-radius: 6px; padding: 6px 10px; font-size: 0.9rem; }

/* ════════════ MÓDULO PCP ════════════ */
.pcp-toolbar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin-bottom: 12px;
}
.pcp-toolbar input[type="text"], .pcp-toolbar input[type="date"], .pcp-toolbar input[type="month"],
.pcp-toolbar select {
  border: 2px solid var(--gray-200); border-radius: var(--radius);
  padding: 8px 10px; font-size: 0.88rem; background: var(--card-bg, #fff); color: inherit;
}
.pcp-chk { display: inline-flex; align-items: center; gap: 4px; font-size: 0.85rem; cursor: pointer; }

.pcp-table-wrap { overflow-x: auto; }
.pcp-table { min-width: 1100px; }
.pcp-table td { white-space: nowrap; }
.pcp-desc { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcp-mini { font-size: 0.72rem; }
.pcp-inp {
  border: 1px solid var(--gray-200); border-radius: 6px; padding: 4px 6px;
  font-size: 0.82rem; background: transparent; color: inherit; max-width: 150px;
}

.pcp-du { display: inline-block; min-width: 26px; text-align: center; padding: 2px 6px; border-radius: 999px; font-weight: 700; font-size: 0.8rem; }
.pcp-du-late { background: #fee2e2; color: #b91c1c; }
.pcp-du-warn { background: #fef3c7; color: #b45309; }
.pcp-du-ok { background: var(--gray-100, #f3f4f6); color: var(--gray-600, #4b5563); }
[data-theme="dark"] .pcp-du-late { background: #7f1d1d; color: #fecaca; }
[data-theme="dark"] .pcp-du-warn { background: #78350f; color: #fde68a; }
[data-theme="dark"] .pcp-du-ok { background: #374151; color: #d1d5db; }

.pcp-cap-bar { height: 10px; border-radius: 999px; background: var(--gray-100, #eef1f4); overflow: hidden; margin-top: 8px; }
.pcp-cap-fill { height: 100%; border-radius: 999px; background: #22c55e; transition: width 0.3s; }
.pcp-cap-fill.over { background: #ef4444; }

.pcp-seq-btn {
  border: none; background: none; cursor: pointer; font-size: 0.7rem; padding: 1px 3px;
  color: var(--gray-500, #6b7280);
}
.pcp-seq-btn:hover { color: var(--blue, #2563eb); }

.pcp-status { padding: 2px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; text-transform: capitalize; }
.pcp-st-aberto { background: #dbeafe; color: #1d4ed8; }
.pcp-st-enviado { background: #fef3c7; color: #b45309; }
.pcp-st-retornado { background: #dcfce7; color: #15803d; }
[data-theme="dark"] .pcp-st-aberto { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .pcp-st-enviado { background: #78350f; color: #fde68a; }
[data-theme="dark"] .pcp-st-retornado { background: #14532d; color: #86efac; }

/* PCP Cadastros */
.pcp-cad-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 14px; align-items: start; }
.pcp-cad-menu { position: sticky; top: 0; display: flex; flex-direction: column; gap: 6px; background: var(--card-bg, #fff); border: 1px solid var(--gray-200, #e5e7eb); border-radius: var(--radius, 10px); padding: 10px; }
.pcp-cad-menu button { text-align: left; border: 0; background: transparent; padding: 9px 10px; border-radius: 8px; cursor: pointer; font-weight: 700; color: var(--text, #111827); }
.pcp-cad-menu button:hover { background: var(--gray-100, #f3f4f6); }
.pcp-cad-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pcp-cad-card { scroll-margin-top: 12px; }
.pcp-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 14px; }
@media (max-width: 800px) { .pcp-cad-layout { grid-template-columns: 1fr; } .pcp-cad-menu { position: static; } }

/* Impressões do PCP (folha de programação + romaneio) */
.pcp-print-sheet { font-family: Arial, sans-serif; color: #000; padding: 6mm; }
.pcp-print-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4mm; border-bottom: 2px solid #000; padding-bottom: 2mm; }
.pcp-print-title { font-size: 14pt; font-weight: 800; }
.pcp-print-table { width: 100%; border-collapse: collapse; font-size: 9pt; }
.pcp-print-table th, .pcp-print-table td { border: 0.4pt solid #444; padding: 2pt 4pt; text-align: left; }
.pcp-print-table th { background: #eee; }
.pcp-print-sign { display: flex; justify-content: space-between; margin-top: 14mm; font-size: 10pt; }

/* ════════════ ROMANEIO DE ENVIO (identidade RR, paisagem) ════════════ */
/* Impresso via #print-area; @page landscape é injetado inline no printRomaneio(). */
.rr-romaneio { font-family: Arial, Helvetica, sans-serif; color: #1a1a1a; padding: 0; }

.rr-rom-band {
  display: flex; align-items: center; gap: 16px;
  border-bottom: 3px solid #15293a; padding-bottom: 8px; margin-bottom: 10px;
}
.rr-rom-logo { height: 46px; width: auto; }
.rr-rom-titlewrap { flex: 1; text-align: center; }
.rr-rom-title { font-size: 20pt; font-weight: 800; color: #15293a; letter-spacing: 1px; line-height: 1; }
.rr-rom-sub { font-size: 11pt; font-weight: 700; color: #5a6b7a; margin-top: 3px; letter-spacing: 3px; }
.rr-rom-lote {
  background: #15293a; color: #fff; border-radius: 8px; padding: 6px 16px; text-align: center; min-width: 84px;
}
.rr-rom-lote-lbl { font-size: 8pt; letter-spacing: 2px; opacity: 0.85; }
.rr-rom-lote-num { font-size: 22pt; font-weight: 800; line-height: 1; }

.rr-rom-meta {
  display: flex; flex-wrap: wrap; gap: 8px 26px; margin-bottom: 10px; padding: 6px 10px;
  background: #f0f3f6; border-radius: 6px; border: 0.5pt solid #d3dae1;
}
.rr-rom-meta > div { display: flex; flex-direction: column; }
.rr-rom-meta span { font-size: 7.5pt; text-transform: uppercase; letter-spacing: 0.5px; color: #6b7885; }
.rr-rom-meta strong { font-size: 11pt; color: #15293a; }
.rr-rom-obs { flex: 1; min-width: 200px; }

.rr-rom-table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
.rr-rom-table th {
  background: #15293a; color: #fff; padding: 5pt 6pt; text-align: left;
  font-size: 8.5pt; letter-spacing: 0.4px; border: 0.5pt solid #15293a;
}
.rr-rom-table td { padding: 4pt 6pt; border: 0.5pt solid #b9c2cc; }
.rr-rom-table tbody tr:nth-child(even) { background: #f4f7fa; }
.rr-rom-table .c-seq { width: 26px; text-align: center; color: #6b7885; }
.rr-rom-table .c-op { width: 60px; font-weight: 700; }
.rr-rom-table .c-cod { width: 74px; }
.rr-rom-table .c-cor { width: 78px; }
.rr-rom-table .c-qtd { width: 48px; text-align: right; font-weight: 700; }
.rr-rom-table .c-cx { width: 120px; }
.rr-rom-table .c-ret { width: 96px; }
.rr-rom-table td.c-ret { background: #fbfbfb; }
.rr-rom-table .rr-rom-total td {
  background: #dde4ea; font-weight: 800; color: #15293a; font-size: 10pt; border-color: #15293a;
}
.rr-rom-table .rr-rom-total td:first-child { text-align: right; letter-spacing: 1px; }

.rr-rom-sign { display: flex; justify-content: space-between; gap: 40px; margin-top: 20mm; }
.rr-rom-sign > div { flex: 1; text-align: center; font-size: 9pt; color: #5a6b7a; }
.rr-rom-sign-line { border-top: 1pt solid #333; margin-bottom: 4px; }

/* Colunas específicas da folha de PROGRAMAÇÃO (reusa .rr-rom-table) */
.rr-rom-table .c-prazo { width: 78px; }
.rr-rom-table .c-ok { width: 90px; }
.rr-rom-table td.c-ok { background: #fbfbfb; }

/* Cabeçalho de seção por dia nas folhas de programação semanal (Será Levado / PXA / Prolongador) */
.rr-rom-daygroup { page-break-inside: avoid; margin-top: 12px; }
.rr-rom-daygroup:first-child { margin-top: 0; }
.rr-rom-daysec {
  background: #15293a; color: #fff; font-weight: 800; font-size: 10pt;
  letter-spacing: 0.5px; padding: 5pt 10pt; border-radius: 5px 5px 0 0;
}
.rr-rom-daygroup .rr-rom-table { margin-top: 0; }

/* ─── Programação semanal (PXA / Será Levado) ─── */
.pcp-week-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
@media (max-width: 900px) { .pcp-week-grid { grid-template-columns: 1fr; } }
.pcp-week-col { background: var(--bg-card, #f6f7f9); border: 1px solid var(--border, #e2e5ea); border-radius: 10px; display: flex; flex-direction: column; min-height: 120px; }
.pcp-week-head { padding: 8px 10px; border-bottom: 2px solid var(--blue, #15293a); font-weight: 700; font-size: 0.85rem; border-radius: 10px 10px 0 0; }
.pcp-week-date { font-weight: 400; font-size: 0.72rem; color: var(--gray-500, #6b7280); margin-left: 6px; }
.pcp-week-sub { font-size: 0.74rem; font-weight: 600; color: var(--gray-500, #6b7280); margin-top: 2px; }
.pcp-week-body { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.pcp-week-card { background: var(--card-bg, #fff); border: 1px solid var(--gray-200, #e5e7eb); border-radius: 8px; padding: 7px 8px; }
.pcp-week-card-top { display: flex; align-items: center; gap: 6px; }
.pcp-week-card-top strong { flex: 1; font-size: 0.85rem; }
.pcp-week-qty { font-weight: 700; font-size: 0.9rem; }
.pcp-week-parte { font-size: 0.68rem; font-weight: 600; color: var(--gray-500, #6b7280); background: var(--gray-100, #f3f4f6); border-radius: 6px; padding: 1px 6px; }
.pcp-lote-row td { font-size: 0.8rem; padding-top: 3px !important; padding-bottom: 3px !important; background: var(--gray-50, #f9fafb); }
.pcp-lote-op { padding-left: 18px !important; font-weight: 600; color: var(--gray-600, #4b5563); white-space: nowrap; }
.pcp-lote-btn { border: 1px solid var(--gray-300, #d1d5db); background: var(--gray-50, #f9fafb); border-radius: 6px; font-size: 0.7rem; font-weight: 600; padding: 0 6px; cursor: pointer; color: var(--gray-600, #4b5563); white-space: nowrap; }
.pcp-lote-btn:hover { background: var(--gray-100, #f3f4f6); }
.pcp-lote-cancelado td { text-decoration: line-through; opacity: .6; }
.pcp-week-desc { font-size: 0.74rem; color: var(--gray-600, #4b5563); margin: 3px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcp-week-foot { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pcp-week-move { display: flex; gap: 2px; flex: 1; }
.pcp-week-del { padding: 1px 6px !important; font-size: 0.7rem !important; }
.pcp-star { background: none; border: none; cursor: pointer; font-size: 1rem; color: var(--gray-400, #9ca3af); padding: 0; }
.pcp-star.on { color: #f59e0b; }
.pcp-sale-cell { display: flex; align-items: center; gap: 6px; }
.pcp-sale-dot {
  display: inline-block; width: 10px; height: 10px; min-width: 10px;
  border-radius: 50%; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
}
.pcp-sale-dot-green { background: #22c55e; }
.pcp-sale-dot-yellow { background: #facc15; }
.pcp-tipo { padding: 1px 7px; border-radius: 999px; font-size: 0.68rem; font-weight: 700; }
.pcp-tipo-redondo { background: #dbeafe; color: #1d4ed8; }
.pcp-tipo-bc { background: #fef3c7; color: #b45309; }
[data-theme="dark"] .pcp-tipo-redondo { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .pcp-tipo-bc { background: #78350f; color: #fde68a; }

/* ── Check "cliente presencial" na inclusão de venda (Logística + Financeiro) ── */
/* Usa as variáveis semânticas do tema: cor fixa clara sumiria no dark mode. */
.vi-presencial-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  cursor: pointer;
  line-height: 1.35;
}
.vi-presencial-box input[type="checkbox"] {
  width: auto;
  margin-top: 2px;
  flex: none;
  transform: scale(1.3);
  cursor: pointer;
}
.vi-presencial-box:hover { border-color: var(--red, #dc2626); }
.vi-presencial-box:has(input:checked) {
  border-style: solid;
  border-color: var(--red, #dc2626);
  background: rgba(220, 38, 38, 0.07);
}

/* ── Endereço de entrega (redespacho) na inclusão de venda ── */
.vi-entrega-box {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--bg-card);
}
/* Ativo = a etiqueta vai sair com outro endereço; precisa saltar aos olhos. */
.vi-entrega-box.is-on {
  border-style: solid;
  border-color: #d97706;
  background: rgba(217, 119, 6, 0.08);
}
.vi-entrega-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: #fef3c7;
  color: #b45309;
}

/* ══════════ Tela de login (raiz do app) ══════════ */
/* Substituiu a grade de tiles de módulo em 17/08/2026: quem entra é a PESSOA (login do App
   Teste) ou o POSTO (apontamento/expedição, que se identificam por crachá lá dentro). */
.login-wrap {
  flex: 1; overflow-y: auto; padding: 24px 16px 32px;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
}
.login-card { width: 100%; max-width: 360px; }
.login-card select,
.login-card input[type=password] {
  width: 100%; font-family: inherit; font-size: 15px; padding: 10px 12px;
  border: 2px solid var(--gray-200); border-radius: 8px;
  background: var(--bg-card); color: var(--text);
}
.login-card .btn-block { margin-top: 4px; }
.login-sep {
  width: 100%; max-width: 360px; display: flex; align-items: center; gap: 10px;
  color: var(--text-muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em;
}
.login-sep::before, .login-sep::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.login-postos {
  width: 100%; max-width: 360px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}

/* ── Produção individual dos Indicadores da Logística (04/09/2026) ──
   Era uma barra por operador com o TOTAL. O total soma trabalhos diferentes: quem separa não é
   quem confere. Agora cada faixa traz o nome, o total, a barra de volume relativo e a quebra
   por etapa embaixo. */
.logi-prod { display: flex; flex-direction: column; gap: 10px; }
.logi-prod-linha { display: flex; flex-direction: column; gap: 3px; }
.logi-prod-topo { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.logi-prod-nome { font-weight: 600; font-size: 0.9rem; color: var(--text, #333); }
.logi-prod-total { font-weight: 800; font-size: 1rem; color: var(--green, #16a34a); font-variant-numeric: tabular-nums; }
.logi-prod-barra { height: 7px; border-radius: 4px; background: var(--border, #e3e6ea); overflow: hidden; }
.logi-prod-barra > span { display: block; height: 100%; background: var(--green, #16a34a); border-radius: 4px; }
.logi-prod-etapas { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.logi-prod-et { font-size: 0.76rem; color: var(--text-muted, #777); white-space: nowrap; }
.logi-prod-et b { color: var(--text, #333); font-variant-numeric: tabular-nums; }

/* ══════════════ Bipar saída — tela imersiva (02/09/2026) ══════════════
 *
 * Esta tela é usada de CELULAR, no corredor, com uma mão segurando a caixa. O layout de
 * duas colunas que ela tinha era desenho de computador: a câmera ficava do tamanho de um
 * selo, os campos pediam mira e o resumo empurrava o botão de "Dar saída" para fora da tela.
 *
 * Aqui a câmera ocupa TUDO e o resto é uma folha que sobe por cima dela. No celular a tela
 * vira `fixed` de verdade — sem as abas do painel, sem a barra de navegação do app —, e no
 * computador ela fica contida no painel, para quem confere sentado não perder o contexto.
 *
 * Cores fixas escuras de propósito: é imagem de câmera atrás. O par fundo+texto está sempre
 * completo, que é a exceção que a convenção de tema já prevê. A FOLHA, essa sim, usa as
 * variáveis — ela é interface, não visor. */
.almox-bip {
  position: relative;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  height: min(72vh, 640px);
  display: flex;
  flex-direction: column;
}
.almox-bip video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
/* Escurece as bordas e deixa o meio limpo: o olho vai para onde o QR tem de entrar. */
.almox-bip .mira {
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 62% 38% at 50% 44%, transparent 55%, rgba(0,0,0,.55) 100%);
}
.almox-bip .mira i {
  position: absolute;
  width: 26px; height: 26px;
  border: 3px solid rgba(255,255,255,.9);
  border-radius: 4px;
}
.almox-bip .mira i:nth-child(1) { top: 22%; left: 16%; border-right: 0; border-bottom: 0; }
.almox-bip .mira i:nth-child(2) { top: 22%; right: 16%; border-left: 0; border-bottom: 0; }
.almox-bip .mira i:nth-child(3) { bottom: 26%; left: 16%; border-right: 0; border-top: 0; }
.almox-bip .mira i:nth-child(4) { bottom: 26%; right: 16%; border-left: 0; border-top: 0; }

.almox-bip .topo {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: linear-gradient(rgba(0,0,0,.72), rgba(0,0,0,0));
  color: #fff;
}
.almox-bip .topo .quem { flex: 1; min-width: 0; }
.almox-bip .topo .quem b { display: block; font-size: 1rem; line-height: 1.2; }
.almox-bip .topo .quem span { font-size: .78rem; color: rgba(255,255,255,.72); }
.almox-bip .tbtn {
  flex: 0 0 auto;
  min-width: 44px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px;
  background: rgba(0,0,0,.42);
  color: #fff;
  font: inherit; font-size: .85rem;
  cursor: pointer;
}
.almox-bip .tbtn.on { background: #fff; color: #111; border-color: #fff; }

.almox-bip .dica {
  position: relative; z-index: 2;
  margin: auto auto 0;
  padding: 6px 14px 0;
  color: rgba(255,255,255,.9);
  font-size: .85rem;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
}

/* A folha: tudo que é interface mora aqui, e ela usa as variáveis do tema. */
.almox-bip .folha {
  position: relative; z-index: 3;
  background: var(--bg-card);
  color: var(--text);
  border-top-left-radius: 16px; border-top-right-radius: 16px;
  box-shadow: 0 -8px 30px rgba(0,0,0,.35);
  padding: 12px 14px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  max-height: 78%;
  overflow-y: auto;
}
.almox-bip .folha .puxador {
  width: 40px; height: 4px; border-radius: 2px;
  background: var(--gray-300);
  margin: 0 auto 10px;
}

/* Alvos de toque: 48px é o mínimo para dedo, e o teclado numérico do celular só aparece
 * com inputmode="decimal" — type=number sozinho abre o teclado inteiro em vários Android. */
.almox-bip .qtd {
  display: flex; align-items: stretch; gap: 8px;
}
.almox-bip .qtd button {
  flex: 0 0 56px; height: 56px;
  font-size: 1.6rem; font-weight: 700;
  border: 2px solid var(--gray-200); border-radius: 12px;
  background: var(--bg-card); color: var(--text);
  cursor: pointer;
}
.almox-bip .qtd input {
  flex: 1; min-width: 0; height: 56px;
  text-align: center;
  font: inherit; font-size: 1.7rem; font-weight: 800;
  border: 2px solid var(--gray-200); border-radius: 12px;
  background: var(--bg-card); color: var(--text);
}
.almox-bip .acao {
  width: 100%; min-height: 56px; margin-top: 10px;
  font: inherit; font-size: 1.05rem; font-weight: 700;
  border: 0; border-radius: 12px;
  background: var(--danger); color: #fff;
  cursor: pointer;
}
.almox-bip .acao.sec { background: var(--gray-200); color: var(--text); min-height: 48px; }

/* No celular a tela é a tela inteira: as abas do painel e o cabeçalho do almoxarifado
 * roubariam ~140px de altura justamente da imagem da câmera. */
@media (max-width: 700px) {
  .almox-bip {
    position: fixed; inset: 0; z-index: 4000;
    height: 100%; border-radius: 0;
  }
}

/* ══ Dashboard da Logística: cartão compacto (30/09/2026) ══════════════════════════════════════
   Fechado: bolinha de origem, OMIE / SH, cliente, transportadora e data. O toque abre o resto.
   Cores: azul = App RR Inox, roxo = Showroom, vermelho = incluída à mão; presencial pinta o
   cartão de laranja e showroom de roxo (as mesmas variáveis --st-* do resto do app). */
#page-logistics-dashboard, #page-collections {
  --lgd-card: #ffffff;
  --lgd-ink: #1d1d1f;
  --lgd-muted: #636366;
  --lgd-line: rgba(0, 0, 0, 0.08);
  --lgd-manual: #d93025;
  --lgd-pres: #c2410c;
  --lgd-pres-bg: #fff1e6;
  --lgd-pres-bd: #f5c7a3;
  --lgd-trat: #c2410c;
  --lgd-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.05), 0 8px 18px -14px rgba(0, 0, 0, 0.35);
}
[data-theme="dark"] #page-logistics-dashboard, [data-theme="dark"] #page-collections {
  --lgd-card: #1b1d22;
  --lgd-ink: #f5f5f7;
  --lgd-muted: #a1a1a6;
  --lgd-line: rgba(255, 255, 255, 0.09);
  --lgd-manual: #ff6b5f;
  --lgd-pres: #f3934f;
  --lgd-pres-bg: #33220f;
  --lgd-pres-bd: #5c3a18;
  --lgd-trat: #f3934f;
  --lgd-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.07), 0 8px 18px -14px rgba(0, 0, 0, 0.8);
}
#page-logistics-dashboard .lgd-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
#page-logistics-dashboard .lgd-legenda { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 0.78rem; color: var(--lgd-muted); }
#page-logistics-dashboard .lgd-legenda span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
#page-logistics-dashboard .lgd-dica { font-style: italic; }
.lgd-dot, .lgd-dot-l { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--lgd-manual); }
.lgd-dot-l.o-pipeline, .lgd-card.o-pipeline .lgd-dot { background: var(--st-pipeline); }
.lgd-dot-l.o-showroom, .lgd-card.o-showroom .lgd-dot { background: var(--st-showroom); }
.lgd-dot-l.o-manual, .lgd-card.o-manual .lgd-dot { background: var(--lgd-manual); }
.lgd-quad { display: inline-block; width: 12px; height: 10px; border-radius: 3px; }
.lgd-quad.pres { background: var(--lgd-pres-bg); box-shadow: inset 0 0 0 1px var(--lgd-pres-bd); }

.lgd-card {
  --card-bg: var(--lgd-card);
  background: var(--lgd-card);
  color: var(--lgd-ink);
  border-radius: 10px;
  box-shadow: var(--lgd-shadow);
  padding: 8px 10px 9px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: box-shadow 150ms ease, transform 100ms ease;
}
.lgd-card:active { transform: scale(0.985); }
.lgd-card.aberto { box-shadow: var(--lgd-shadow), 0 0 0 1.5px var(--lgd-line); }
.lgd-card.o-showroom { --card-bg: var(--st-showroom-bg); background: var(--st-showroom-bg); box-shadow: var(--lgd-shadow), inset 0 0 0 1px var(--st-showroom-bd); }
.lgd-card.is-presencial { --card-bg: var(--lgd-pres-bg); background: var(--lgd-pres-bg); box-shadow: var(--lgd-shadow), inset 0 0 0 1px var(--lgd-pres-bd); }
.lgd-card.is-stopped { box-shadow: var(--lgd-shadow), inset 3px 0 0 var(--red, #dc2626); }
.lgd-card.is-tratativa { box-shadow: var(--lgd-shadow), inset 3px 0 0 var(--lgd-trat); }
.lgd-card.is-overdue { animation: blink-overdue 1.1s steps(1, end) infinite; }
.lgd-l1 { display: flex; align-items: center; gap: 7px; min-width: 0; }
.lgd-ref { font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.lgd-barra { color: var(--lgd-muted); font-weight: 400; margin: 0 1px; }
.lgd-prio { margin-left: auto; flex: none; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: #fff; background: var(--red, #dc2626); border-radius: 999px; padding: 1px 6px; }
.lgd-prio.pres { background: var(--lgd-pres); }
.lgd-prio.show { background: var(--st-showroom); }
.lgd-marcas { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.lgd-tag { font-size: 0.64rem; font-weight: 700; border-radius: 999px; padding: 1px 7px; color: #fff; background: var(--lgd-muted); }
.lgd-tag.trat, .lgd-tag.reproc { background: var(--lgd-trat); }
.lgd-tag.parado { background: var(--red, #dc2626); }
.lgd-cli { font-weight: 500; margin-top: 3px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lgd-l3 { display: flex; justify-content: space-between; gap: 8px; margin-top: 3px; font-size: 0.72rem; color: var(--lgd-muted); }
.lgd-transp { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lgd-data { flex: none; font-variant-numeric: tabular-nums; }
.o-showroom .lgd-l3, .o-showroom .lgd-sub, .o-showroom .lgd-linha span { color: var(--st-showroom-ink); }
.lgd-mais { margin-top: 8px; padding-top: 8px; border-top: 0.5px solid var(--lgd-line); display: grid; gap: 4px; cursor: default; }
.lgd-linha { display: flex; justify-content: space-between; gap: 10px; font-size: 0.74rem; }
.lgd-linha span { color: var(--lgd-muted); }
.lgd-linha b { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.lgd-sub { font-size: 0.7rem; color: var(--lgd-muted); }
.lgd-caixa { border-radius: 8px; padding: 6px 8px; font-size: 0.74rem; line-height: 1.35; color: #fff; }
.lgd-caixa.trat { background: var(--lgd-trat); }
.lgd-caixa.parado { background: var(--red, #dc2626); }
.lgd-caixa .lgd-sub { color: rgba(255, 255, 255, 0.85); }
.lgd-acoes { display: flex; gap: 6px; margin-top: 4px; }
.lgd-btn { flex: 1; border: 0; border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 0.74rem; font-weight: 600; cursor: pointer;
  background: var(--red, #dc2626); color: #fff; }
.lgd-btn.leve { flex: none; background: transparent; color: var(--lgd-muted); font-weight: 500; }
.lgd-btn:active { transform: scale(0.97); }
@media (prefers-reduced-motion: reduce) { .lgd-card:active, .lgd-btn:active { transform: none; } }

/* Coleta de produção no mesmo cartão (30/09/2026): OP e quantidade, descrição, caixas e quem. */
.lgd-card.coleta { cursor: default; }
.lgd-card.coleta:active { transform: none; }
.lgd-qtd { margin-left: auto; flex: none; font-size: 0.72rem; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--lgd-line); color: var(--lgd-ink); border-radius: 999px; padding: 1px 8px; }
.lgd-desc { margin-top: 3px; line-height: 1.3; font-weight: 500; }
.lgd-card.coleta.conferido { box-shadow: var(--lgd-shadow), inset 3px 0 0 var(--st-expedido, #16a34a); }
/* Colunas do Dashboard e da Coleta (30/09/2026): o cabeçalho continua a faixa colorida cheia de
   sempre — a Logística pediu para manter as cores de antes; só os cartões mudaram. */

/* Transportadora e data sempre à vista no cartão fechado (30/09/2026, Guilherme). */
.lgd-info { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 0.78rem; font-weight: 500; color: var(--lgd-ink); min-width: 0; }
.lgd-ico { flex: none; width: 1.1em; text-align: center; font-size: 0.8rem; }
.lgd-info-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; font-variant-numeric: tabular-nums; }
.o-showroom .lgd-info { color: var(--st-showroom-ink); }
