/* SlimFitness Produção — design system mobile-first */
:root {
  --cortador: #2563EB;   --cortador-dark: #1E40AF;
  --oficina: #059669;    --oficina-dark: #047857;
  --recebimento: #EA580C;--recebimento-dark: #C2410C;
  --estoque: #7C3AED;    --estoque-dark: #5B21B6;
  --admin: #1F2937;      --admin-dark: #111827;
  --bg: #FFFFFF; --card: #F3F4F6;
  --danger: #DC2626; --success: #16A34A; --warning: #F59E0B;
  --text: #111827; --text-light: #6B7280;
  --papel: var(--admin); --papel-dark: var(--admin-dark);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 15px; background: var(--bg); color: var(--text);
  min-height: 100vh; padding-bottom: 72px;
}
body.papel-cortador   { --papel: var(--cortador);    --papel-dark: var(--cortador-dark); }
body.papel-oficina    { --papel: var(--oficina);     --papel-dark: var(--oficina-dark); }
body.papel-recebimento{ --papel: var(--recebimento); --papel-dark: var(--recebimento-dark); }
body.papel-estoque    { --papel: var(--estoque);     --papel-dark: var(--estoque-dark); }
body.papel-admin      { --papel: var(--admin);       --papel-dark: var(--admin-dark); }

/* header — compacto (48px) */
header.topo {
  position: sticky; top: 0; z-index: 100;
  background: var(--papel); color: #fff;
  padding: 0 14px; min-height: 48px; font-size: 16px; font-weight: 700;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
header.topo .topo-esq { display: flex; align-items: center; gap: 10px; min-width: 0; }
header.topo .logo-slm { font-weight: 900; letter-spacing: 3px; font-size: 18px; }
header.topo .topo-txt { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
header.topo .sub { font-size: 12px; font-weight: 400; opacity: .85; }
header.topo button {
  min-height: 32px; width: auto; margin: 0; padding: 5px 12px;
  background: rgba(255,255,255,.18); color: #fff; border: none;
  border-radius: 8px; font-size: 13px; font-weight: 600;
}

main { padding: 12px; max-width: 480px; margin: 0 auto; }

h2.titulo { font-size: 18px; margin-bottom: 12px; }
.muted { color: var(--text-light); font-size: 13px; }
.centro { text-align: center; }
.mt { margin-top: 12px; } .mb { margin-bottom: 12px; }

/* botões */
button, .btn {
  display: block; width: 100%; min-height: 48px;
  border: none; border-radius: 10px; margin-bottom: 8px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  background: #EEF0F3; color: var(--text);
  text-decoration: none; text-align: center;
  padding: 10px 14px; line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
}
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; position: relative; }
button:active, .btn:active { transform: scale(.98); }
.btn-papel   { background: var(--papel); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #111; }
.btn-outline { background: #fff; border: 2px solid var(--papel); color: var(--papel); }
.btn-menu { justify-content: space-between; min-height: 54px; font-size: 16px; background: #fff;
            border: 1px solid #E5E7EB; border-left: 4px solid var(--papel); }
.btn-menu .cnt { background: var(--papel); color: #fff; border-radius: 999px; font-size: 13px;
                 font-weight: 700; min-width: 24px; height: 24px; display: inline-flex;
                 align-items: center; justify-content: center; padding: 0 7px; }
.btn-mini { min-height: 36px; width: auto; display: inline-flex; padding: 6px 14px; font-size: 13px; margin: 0 6px 6px 0; }
button:disabled { opacity: .5; }

/* cards — brancos, borda esquerda colorida (sem fundo cinza pesado) */
.card {
  background: #fff; border: 1px solid #E5E7EB; border-left: 4px solid var(--papel);
  border-radius: 10px; padding: 12px; margin-bottom: 8px;
}
.card.alerta-vermelho { border-left-color: var(--danger); background: #FEF2F2; }
.card.alerta-amarelo  { border-left-color: var(--warning); background: #FFFBEB; }
.card.atrasado { border-left-color: var(--danger); border-left-width: 5px; }
.card h3 { font-size: 15px; margin-bottom: 4px; }
.card .linha { display: flex; justify-content: space-between; gap: 8px; margin: 2px 0; font-size: 13px; }
.card .linha span { color: var(--text-light); }
.card .linha b { font-size: 14px; text-align: right; }

/* inputs */
input, select, textarea {
  width: 100%; height: 44px; border-radius: 8px; font-size: 16px;
  border: 2px solid #E5E7EB; padding: 0 10px; background: #fff;
  margin-bottom: 10px; color: var(--text);
}
textarea { height: auto; min-height: 64px; padding: 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--papel); }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--text); }
input[readonly] { background: var(--card); color: var(--text-light); }

/* grid de tamanhos — compacto (40px) */
.grid-tam { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 6px; }
.grid-tam .celula label { text-align: center; font-size: 12px; margin-bottom: 2px; }
.grid-tam .celula input { text-align: center; height: 40px; margin-bottom: 0; padding: 0 2px; }

.bloco-cor { background: #fff; border: 2px solid #E5E7EB; border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.bloco-cor .cabeca { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.bloco-cor .cabeca input, .bloco-cor .cabeca select { margin-bottom: 0; flex: 1; }
.bloco-cor .cabeca button { width: 44px; min-height: 44px; margin: 0; background: #FEE2E2; color: var(--danger); font-size: 20px; }
.subtotal { font-size: 14px; font-weight: 600; text-align: right; color: var(--text-light); }
.total-geral { font-size: 18px; font-weight: 700; text-align: center; padding: 12px; background: var(--card); border-radius: 12px; margin-bottom: 12px; }

/* toast — menor, canto superior direito */
.toast {
  position: fixed; top: 12px; right: 12px; left: auto; max-width: 82vw; z-index: 9999;
  padding: 10px 14px; border-radius: 10px; color: #fff; font-weight: 600; font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,.2); opacity: .97;
}
.toast.sucesso { background: var(--success); }
.toast.erro { background: var(--danger); }

/* badge contador */
.tem-badge { position: relative; }
.badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: #fff; border-radius: 999px;
  font-size: 12px; font-weight: 700; min-width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 6px;
}
.btn .badge { top: 8px; right: 8px; }

/* status badges */
.status {
  display: inline-block; border-radius: 20px; padding: 4px 12px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.status-cortado   { background: #DBEAFE; color: #1D4ED8; }
.status-retirado  { background: #FEF3C7; color: #B45309; }
.status-pronto    { background: #DCFCE7; color: #15803D; }
.status-agendado  { background: #EDE9FE; color: #6D28D9; }
.status-entregue  { background: #FFEDD5; color: #C2410C; }
.status-conferido { background: #E5E7EB; color: #374151; }
.status-outro     { background: #F3F4F6; color: #6B7280; }

/* loading */
#loading {
  position: fixed; inset: 0; background: rgba(0,0,0,.3);
  z-index: 9998; display: none; align-items: center; justify-content: center;
}
#loading .spinner {
  width: 48px; height: 48px; border-radius: 50%;
  border: 5px solid #fff; border-top-color: transparent;
  animation: girar .8s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

/* nav bottom — 52px */
nav.rodape {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: #fff; border-top: 1px solid #E5E7EB; min-height: 52px;
  display: flex; justify-content: space-around; padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
}
nav.rodape a {
  flex: 1; text-align: center; text-decoration: none; color: var(--text-light);
  font-size: 11px; font-weight: 600; padding: 4px 2px; border-radius: 8px;
}
nav.rodape a .ico { display: block; font-size: 20px; line-height: 1.2; }
nav.rodape a.ativo { color: var(--papel); }

/* tabela compacta (tela aprovar) */
.tab-sug { width: 100%; border-collapse: collapse; font-size: 13px; }
.tab-sug th { text-align: left; font-size: 11px; color: var(--text-light); padding: 4px 6px; border-bottom: 2px solid #E5E7EB; }
.tab-sug td { padding: 6px; border-bottom: 1px solid #F3F4F6; vertical-align: middle; }
.tab-sug .acoes { display: flex; gap: 4px; }
.tab-sug .acoes button { width: 34px; min-height: 34px; margin: 0; padding: 0; font-size: 15px; border-radius: 8px; }
.tab-sug .num { text-align: right; font-variant-numeric: tabular-nums; }
.tab-sug tr.sem-tecido { background: #FEF2F2; }
.chip-tec-ok { color: var(--success); font-weight: 700; white-space: nowrap; }
.chip-tec-no { color: var(--danger); font-weight: 700; white-space: nowrap; }

/* tabs */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tabs button { flex: 1; min-height: 44px; margin: 0; background: var(--card); font-size: 15px; }
.tabs button.ativo { background: var(--papel); color: #fff; }

/* toggle qualidade */
.toggle2 { display: flex; gap: 8px; margin-bottom: 12px; }
.toggle2 button { flex: 1; margin: 0; border: 2px solid #E5E7EB; background: #fff; }
.toggle2 button.sel-ok { border-color: var(--success); background: #DCFCE7; }
.toggle2 button.sel-defeito { border-color: var(--danger); background: #FEE2E2; }

/* divergência */
.divergencia { color: var(--danger); font-weight: 700; font-size: 14px; }

/* área câmera / QR */
.area-camera { background: #111; border-radius: 12px; overflow: hidden; margin-bottom: 12px; min-height: 220px; position: relative; }
.area-camera video, .area-camera > div { width: 100% !important; }
.foto-preview { width: 100%; border-radius: 12px; margin-bottom: 12px; }

/* modal simples */
.modal-fundo { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 9000; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-caixa { background: #fff; border-radius: 16px; padding: 24px; width: 100%; max-width: 380px; }
.modal-caixa h3 { margin-bottom: 12px; }
.senha-grande { font-size: 28px; font-weight: 800; letter-spacing: 2px; text-align: center; background: var(--card); border-radius: 12px; padding: 16px; margin: 12px 0; }
