:root{
  /* ===== Tema Claro (clean / sem neon) ===== */
  --bg: #f4f6fb;           /* fundo da página */
  --surface: #ffffff;      /* cards */
  --surface2: #ffffff;     /* cards internos */
  --border: #e6e9f2;       /* bordas */
  --border2: #dfe4ef;

  --text: #1f2937;         /* texto principal */
  --muted: #6b7280;        /* texto secundário */

  --primary: #2e59d9;      /* azul SB Admin 2 */
  --primaryHover: #2446ad;

  --success: #1cc88a;      /* sucesso (moderado, não neon) */
  --danger: #e74a3b;       /* erro */
  --warning: #f6c23e;      /* aviso */

  /* sombra leve (sem brilho) */
  --shadow: 0 6px 18px rgba(17, 24, 39, 0.08);

  --radius: 14px;
}

*{ box-sizing:border-box; font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial; }

body{
  margin:0;
  background: var(--bg);     /* ✅ sem gradiente */
  color: var(--text);
  min-height: 100vh;
  padding: 26px;
}

.container{ max-width: 1500px; margin:0 auto; }

header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  margin-bottom: 14px;
}

.title h1{
  margin:0;
  font-size: 20px;
  letter-spacing: .2px;
  font-weight: 900;
}
.title p{
  margin:6px 0 0 0;
  color: var(--muted);
  font-size: 13px;
}

.top-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
  justify-content:flex-end;
}

.chip{
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 9px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  display:flex;
  gap:8px;
  align-items:center;
  box-shadow: var(--shadow);
}

/* ===== Toolbar ===== */
.toolbar{
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  display:flex;
  gap:10px;
  flex-wrap: wrap;
  align-items:center;
  justify-content:space-between;
}

.form{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
  flex:1;
}
.form-right{
  justify-content:flex-end;
  flex:1;
}

.input,
.select{
  background: #ffffff;
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  min-width: 200px;
}
.select{ min-width: 180px; }

.input::placeholder{ color: #9aa3b2; }

.small{ font-size: 12px; color: var(--muted); }

.check{
  display:flex;
  align-items:center;
  gap:8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border2);
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  user-select:none;
}
.check input{ transform: scale(1.05); }

/* ===== Buttons ===== */
button{ cursor:pointer; border:none; outline:none; }

.btn{
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 850;
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--border2);
  transition: 0.12s ease;
  white-space: nowrap;
}
.btn:hover{ background: #f7f8fc; }

.btn-primary{
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
}
.btn-primary:hover{
  background: var(--primaryHover);
  border-color: var(--primaryHover);
}

.btn-soft{
  background: var(--success);
  color:#fff;
  border: 1px solid var(--success);
}
.btn-soft:hover{ filter: brightness(0.92); }

.btn-danger{
  background: var(--danger);
  color:#fff;
  border: 1px solid var(--danger);
}
.btn-danger:hover{ filter: brightness(0.92); }

/* ===== Board ===== */
.board{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 16px;
}
@media(max-width: 1100px){ .board{ grid-template-columns: 1fr; } }
@media(max-width: 650px){ body{ padding:16px; } }

.column{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
  display:flex;
  flex-direction:column;
  min-height: 430px;
}

.col-header{
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  background: #fbfcff;
}

.col-header .name{
  font-weight: 900;
  font-size: 14px;
  display:flex;
  align-items:center;
  gap:8px;
}

.badge{
  background: #f2f4fb;
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
}

.col-body{
  padding: 12px;
  display:flex;
  flex-direction:column;
  gap:10px;
  flex:1;
}

/* Dots simples (sem brilho) */
.dot{ width:10px; height:10px; border-radius:999px; display:inline-block; }
.dot.corte{ background: #2e59d9; }
.dot.costura{ background: #6f42c1; }
.dot.montagem{ background: #1cc88a; }
.dot.tap{ background: #f6c23e; }

.order{
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
}

.order:hover{
  border-color: #d6dbe8;
  background: #ffffff;
}

.order-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}

.order-title{
  font-weight: 950;
  font-size: 13px;
  margin:0;
  line-height: 1.2;
}

.meta{
  margin-top: 8px;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  color: var(--muted);
  font-size: 12px;
}

.pill{
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f7f8fc;
}

.actions{
  display:flex;
  gap:6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.pill-warn{
  border-color: rgba(231,74,59,0.35);
  background: rgba(231,74,59,0.10);
  color: #7a1c13;
  font-weight: 900;
}

/* ===== Tapeçaria ===== */
.card-full{
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}

.card-head{
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  background: #fbfcff;
  flex-wrap: wrap;
}

.card-title{
  font-weight: 950;
  font-size: 14px;
  display:flex;
  align-items:center;
  gap:8px;
}

/* ===== Table ===== */
.table-wrap{
  border-top: 1px solid var(--border);
  background: #ffffff;
}

.table-scroll{
  max-height: 520px;
  overflow: auto;
}

table{
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

thead th{
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f2f4fb;
  color: #223045;
  text-align: left;
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  font-weight: 950;
  white-space: nowrap;
}

tbody td{
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tbody tr:hover{ background: #f8f9fd; }

.nowrap{ white-space: nowrap; }
.th-right{ text-align:right; }
.muted{ color: var(--muted); }

/* Status pills sem neon */
.status-pill{
  display:inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f7f8fc;
  font-weight: 950;
  white-space: nowrap;
}

.s-fila{
  border-color: rgba(46,89,217,0.25);
  background: rgba(46,89,217,0.08);
  color: #1f3f9a;
}
.s-andamento{
  border-color: rgba(28,200,138,0.25);
  background: rgba(28,200,138,0.10);
  color: #0f6c4a;
}
.s-finalizado{
  border-color: rgba(246,194,62,0.35);
  background: rgba(246,194,62,0.16);
  color: #7a5a0f;
}

.row-actions{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.btn-mini{
  padding: 6px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 950;
}

.scanner{
  min-width: 320px;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: .15px;
}

/* Highlight bem leve */
.highlight{
  outline: 2px solid rgba(46,89,217,0.25);
  outline-offset: -2px;
  background: rgba(46,89,217,0.06) !important;
}

/* Toast do app (não usa .toast do Bootstrap) */
.app-toast{
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 13px;
  min-width: 260px;

  display: none;
  opacity: 1 !important; /* garante que não fica invisível por causa do Bootstrap */
  z-index: 99999;
}

.app-toast strong{
  display: block;
  margin-bottom: 4px;
}

.s-faltando{
  border-color: rgba(231,74,59,0.35);
  background: rgba(231,74,59,0.12);
  color: #7a1c13;
}



/* ===== Histórico de Bip ===== */
.history-panel{
  display:none;
  margin-top: 14px;
}
.history-panel.is-open{
  display:block;
}
.hist-row{
  cursor:pointer;
}
.hist-row:hover{
  background: rgba(46, 89, 217, 0.06);
}


.pill.ok{ background:#e9f7ef; border-color:#bfe6cf; }
.pill.pend{ background:#fff7e6; border-color:#ffe1a3; }


/* ===== Camera Scanner Modal ===== */
.cam-modal{position:fixed;inset:0;background:rgba(0,0,0,.55);display:flex;align-items:center;justify-content:center;padding:16px;z-index:9999;}
.cam-card{width:min(720px,100%);background:#fff;border-radius:14px;box-shadow:0 12px 40px rgba(0,0,0,.25);overflow:hidden;}
.cam-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 14px;border-bottom:1px solid rgba(0,0,0,.08);}
.cam-title{font-weight:700;}
.cam-body{padding:14px;}
.cam-hint{font-size:13px;opacity:.8;margin-bottom:10px;}
.cam-reader{width:100%;border-radius:12px;overflow:hidden;background:#000;}
.cam-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:10px;flex-wrap:wrap;}
@media (prefers-color-scheme: dark){
  .cam-card{background:#121212;color:#f2f2f2;}
  .cam-head{border-bottom:1px solid rgba(255,255,255,.12);}
  .cam-hint{opacity:.85;}
}


/* ===== Modo Leitura (Tela cheia / Kiosk) ===== */
body.fs-tap header,
body.fs-tap .toolbar,
body.fs-tap .board,
body.fs-tap #opSection{
  display:none !important;
}

body.fs-op header,
body.fs-op .toolbar,
body.fs-op .board,
body.fs-op .card-full:not(#opSection):not(#bipHistoryPanel),
.fs-panel{
  position: fixed;
  inset: 0;
  margin: 0 !important;
  border-radius: 0 !important;
  z-index: 9998;
  background: #fff;
}

.fs-panel .table-scroll{
  max-height: calc(100vh - 140px);
}

body.fs-tap #scanInput,
body.fs-op #opScanInput{
  font-size: 18px;
  padding: 14px 14px;
}

body.fs-tap #btnTapFull,
body.fs-op #btnOPFull{
  background: #111;
  color: #fff;
}

@media (prefers-color-scheme: dark){
  .fs-panel{ background:#0f0f0f; }
}


/* AdminLTE: não limitar largura */
.container{max-width:none !important; width:100% !important;}

/* ===== Tapeçaria: ações embaixo (expandir ao clicar na linha) ===== */
tr.tap-details-row { display: none; }
tr.tap-details-row.is-open { display: table-row; }

.tap-action-panel{
  padding: 10px 12px;
}
.tap-action-panel .btn{
  margin: 6px 6px 0 0;
}
.tap-actions-hint{
  font-size: 12px;
  opacity: .75;
}


/* ===== Histórico: aparecer automático no Modo Leitura (Tapeçaria) ===== */
body.fs-tap.tap-reading #bipHistoryPanel{
  display: block !important;
  margin-top: 0 !important;
  /* fica acima do painel fullscreen */
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 10000;
  max-height: 38vh;
  overflow: auto;
}

/* opcional: no modo leitura, não precisa do botão "Histórico" */
body.fs-tap.tap-reading #btnToggleHistory{
  display: none !important;
}

/* ===== Histórico (Modo Leitura): dock no rodapé e expande só ao clicar ===== */
body.fs-tap.tap-reading #bipHistoryPanel{
  display: block !important;
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 10050; /* acima do .fs-panel */
  margin: 0 !important;
  box-shadow: var(--shadow);
}

/* fechado: só barra */
body.fs-tap.tap-reading #bipHistoryPanel{
  max-height: 56px;
  overflow: hidden;
}

/* aberto: expande e mostra tabela */
body.fs-tap.tap-reading #bipHistoryPanel.is-open{
  max-height: 45vh;
  overflow: auto;
}

/* quando fechado, esconde a tabela */
body.fs-tap.tap-reading #bipHistoryPanel .table-wrap{
  display: none;
}
body.fs-tap.tap-reading #bipHistoryPanel.is-open .table-wrap{
  display: block;
}

/* deixa o cabeçalho com cara de clicável */
body.fs-tap.tap-reading #bipHistoryPanel .card-head{
  cursor: pointer;
}


/* ===== Histórico (Modo Leitura - OP/REQ): dock no rodapé e expande só ao clicar ===== */
body.fs-op.op-reading #bipHistoryPanel{
  display: block !important;
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 10050; /* acima do .fs-panel */
  margin: 0 !important;
  box-shadow: var(--shadow);
  max-height: 56px; /* fechado: só barra */
  overflow: hidden;
}

body.fs-op.op-reading #bipHistoryPanel.is-open{
  max-height: 45vh;
  overflow: auto;
}

body.fs-op.op-reading #bipHistoryPanel .table-wrap{ display:none; }
body.fs-op.op-reading #bipHistoryPanel.is-open .table-wrap{ display:block; }
body.fs-op.op-reading #bipHistoryPanel .card-head{ cursor:pointer; }


/* ===== OP/REQ: ações embaixo (expandir ao clicar na linha) ===== */
tr.op-details-row{ display:none; }
tr.op-details-row.is-open{ display:table-row; }
.op-action-panel{ padding:10px 12px; }
.op-action-panel .btn{ margin:6px 6px 0 0; }
.op-actions-hint{ font-size:12px; opacity:.75; }


/* ===== Topo (Corte/Costura/Montagem): ações ocultas e expandir ao clicar ===== */
.order{ cursor:pointer; }
.order .top-expand{ display:none; margin-top:10px; padding-top:10px; border-top:1px solid var(--border); }
.order.is-open .top-expand{ display:block; }
.order .top-expand .btn{ margin:6px 6px 0 0; }
.order .top-items{ margin-top:10px; display:none; }
.order.show-items .top-items{ display:block; }
.order .top-items ul{ margin:8px 0 0 0; padding-left:18px; }
.order .top-items li{ margin:4px 0; color: var(--muted); font-size:12px; }

/* Sidebar encolhida: não mostrar o formulário dentro do submenu */
body.sidebar-collapse #menuImport #importSubmenu{
  display: none !important;
}


