/* app.css — Painel Gestão Fresh Food */

:root {
  --verde:      #1a7a4a;
  --verde-dark: #145c37;
  --verde-light:#e8f5ee;
  --verde-mid:  #2ea866;
  --amarelo:    #f5c842;
  --vermelho:   #dc3545;
  --vermelho-light: #fdecea;
  --cinza-bg:   #f4f6f8;
  --cinza-borda:#dde1e7;
  --cinza-texto:#6b7280;
  --texto:      #1a1f2e;
  --branco:     #ffffff;
  --card-shadow: 0 1px 4px rgba(0,0,0,.08);
  --radius:     10px;
  --sidebar-w:  220px;
  --font:       'Segoe UI', system-ui, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--cinza-bg);
  color: var(--texto);
  font-size: 14px;
  line-height: 1.5;
}

/* Evita scroll horizontal acidental no mobile (qualquer elemento largo) */
html, body { max-width: 100%; overflow-x: hidden; }

/* ── UTILITÁRIOS ─────────────────────────────────────────── */
.hidden { display: none !important; }

.app-version {
  position: fixed;
  bottom: 8px;
  right: 12px;
  font-size: 11px;
  color: var(--cinza-texto);
  opacity: .7;
  z-index: 50;
  pointer-events: none;
}
.mt     { margin-top: 16px; }

/* ── LOGIN ───────────────────────────────────────────────── */
#view-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--verde-dark) 0%, var(--verde) 100%);
}

.login-wrap {
  background: var(--branco);
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.logo-fresh {
  font-size: 28px;
  font-weight: 800;
  color: var(--verde);
  letter-spacing: -1px;
}

.logo-food {
  font-size: 28px;
  font-weight: 300;
  color: var(--texto);
  letter-spacing: -1px;
}

.logo-sub {
  display: block;
  font-size: 12px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--cinza-texto);
  margin-top: 4px;
}

.login-form .field {
  margin-bottom: 16px;
}

.login-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--cinza-texto);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}

.login-form input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--cinza-borda);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}

.login-form input:focus {
  border-color: var(--verde);
}

.form-erro {
  background: var(--vermelho-light);
  color: var(--vermelho);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 12px;
}

.form-info {
  background: var(--verde-light);
  color: var(--verde-dark);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 12px;
}

/* ── BOTÕES ──────────────────────────────────────────────── */
.btn-primary {
  background: var(--verde);
  color: var(--branco);
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background .15s;
}

.btn-primary:hover { background: var(--verde-dark); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 14px; font-size: 13px; }

.btn-secondary {
  background: var(--branco);
  color: var(--texto);
  border: 1.5px solid var(--cinza-borda);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  cursor: pointer;
  transition: border-color .15s;
}

.btn-secondary:hover { border-color: var(--verde); }

.btn-link {
  background: none;
  border: none;
  color: var(--cinza-texto);
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  text-decoration: underline;
}

.btn-back {
  background: none;
  border: 1.5px solid var(--cinza-borda);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--cinza-texto);
}

.btn-back:hover { border-color: var(--verde); color: var(--verde); }

/* ── SHELL / SIDEBAR ─────────────────────────────────────── */
#shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--verde-dark);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
}

.nav-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.nav-logo .logo-fresh { font-size: 20px; }
.nav-logo .logo-food  { font-size: 20px; }

.nav-links {
  list-style: none;
  padding: 12px 0;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: 14px;
  transition: all .15s;
  border-left: 3px solid transparent;
}

.nav-link svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
}

.nav-link:hover,
.nav-link.active {
  color: var(--branco);
  background: rgba(255,255,255,.08);
  border-left-color: var(--amarelo);
}

.nav-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(255,255,255,.6);
}

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 28px;
  min-height: 100vh;
}

/* ── PAGE HEADER ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--texto);
  flex: 1;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.input-busca, .input-date {
  padding: 8px 14px;
  border: 1.5px solid var(--cinza-borda);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  background: var(--branco);
  transition: border-color .15s;
}

.input-busca { width: 200px; }
.input-busca:focus, .input-date:focus { border-color: var(--verde); }

.select-sm {
  padding: 8px 12px;
  border: 1.5px solid var(--cinza-borda);
  border-radius: 8px;
  font-size: 13px;
  background: var(--branco);
  outline: none;
  cursor: pointer;
}

/* ── FILTRO DE PERÍODO (datas agrupadas) ─────────────────── */
.filtro-periodo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--branco);
  border: 1.5px solid var(--cinza-borda);
  border-radius: 8px;
  padding: 3px 10px;
}
.filtro-periodo:focus-within { border-color: var(--verde); }
.filtro-periodo .input-date {
  border: none;
  padding: 5px 2px;
  border-radius: 0;
}
.filtro-periodo .input-date:focus { border: none; }
.filtro-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--cinza-texto);
}
.filtro-sep { font-size: 12px; color: var(--cinza-texto); }

/* Campo de data que abre o calendário ao clicar (sem digitação manual) */
.input-date-pick { cursor: pointer; }
.input-date-pick::-webkit-calendar-picker-indicator { cursor: pointer; }

/* ── CARDS ───────────────────────────────────────────────── */
.card {
  background: var(--branco);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--card-shadow);
}

.card h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--texto);
  margin-bottom: 16px;
}

.card-desc {
  font-size: 13px;
  color: var(--cinza-texto);
  margin-bottom: 16px;
}

.card-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.card-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.card-head-row h2 { margin-bottom: 0; }

/* ── RESUMO CARDS (métricas) ─────────────────────────────── */
.resumo-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.metrica {
  background: var(--branco);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--card-shadow);
  border-left: 4px solid var(--verde);
}

.metrica-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--cinza-texto);
  margin-bottom: 6px;
}

.metrica-valor {
  font-size: 26px;
  font-weight: 800;
  color: var(--texto);
  line-height: 1;
}

.metrica-sub {
  font-size: 11px;
  color: var(--cinza-texto);
  margin-top: 4px;
}

.metrica.alerta { border-left-color: var(--vermelho); }
.metrica.aviso  { border-left-color: var(--amarelo); }

/* ── LISTA DE LOJAS (linha horizontal) ───────────────────── */
/* Grid de colunas compartilhado entre o cabeçalho e cada linha.
   [Nome+Cidade] [Gerente] [Coordenador] [Atendente] [Vagas] [Fat/Colab] [Fat 30d] */
.lojas-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--branco);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.loja-row-grid {
  display: grid;
  grid-template-columns: minmax(180px, 2.2fr) 92px 110px 100px 80px 110px 120px;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
}

.lojas-head {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--verde-dark);
  color: rgba(255,255,255,.92);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.lojas-head .col-num { text-align: center; }

.loja-row {
  cursor: pointer;
  border-bottom: 1px solid var(--cinza-borda);
  transition: background .12s;
  border-left: 3px solid transparent;
}
.loja-row:last-child { border-bottom: none; }
.loja-row:hover { background: var(--verde-light); }
.loja-row.vagas-abertas { border-left-color: var(--vermelho); }

.loja-row .col-nome { line-height: 1.25; }
.loja-row-nome {
  font-size: 13px;
  font-weight: 700;
  color: var(--texto);
}
.loja-row-cidade {
  font-size: 11px;
  color: var(--cinza-texto);
}

.col-num {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--texto);
}
.col-num .ri-real  { color: var(--texto); }
.col-num .ri-sep   { color: var(--cinza-texto); font-weight: 400; margin: 0 1px; }
.col-num .ri-ideal { color: var(--cinza-texto); font-weight: 600; }
.col-num.deficit .ri-real { color: var(--vermelho); }

/* Rótulo de coluna inline — só aparece no layout mobile colapsado */
.col-cap { display: none; }

/* Badge de vagas na lista */
.vagas-badge {
  display: inline-block;
  background: var(--vermelho);
  color: var(--branco);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 20px;
  min-width: 28px;
  text-align: center;
}
.vagas-zero { color: var(--cinza-texto); font-weight: 600; }

.col-fat { font-size: 13px; font-weight: 700; color: var(--texto); }
.col-fat.sub { font-weight: 600; color: var(--cinza-texto); }

.excedente-badge {
  display: inline-block;
  background: #fff3e0;
  color: #b45309;
  border: 1px solid #f0c27a;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  margin-left: 6px;
}

/* ── RANKING FATURAMENTO ─────────────────────────────────── */
.rank-table td { vertical-align: middle; }
.rank-sub { font-size: 11px; color: var(--cinza-texto); }
.rank-bar {
  position: relative;
  background: var(--cinza-bg);
  border-radius: 4px;
  height: 22px;
  min-width: 110px;
  overflow: hidden;
}
.rank-bar-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; opacity: .45; }
.rank-bar span { position: relative; z-index: 1; font-size: 12px; font-weight: 600; padding: 0 6px; line-height: 22px; white-space: nowrap; }
.bar-dia   { background: var(--verde-mid); }
.bar-noite { background: #f5a623; }
.bar-tot   { background: #4a90d9; }

.q-val { font-weight: 700; }
.q-sep { color: var(--cinza-texto); font-weight: 400; }
.q-diff {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
}
.q-falta { background: var(--vermelho-light); color: var(--vermelho); }
.q-sobra { background: #fff3e0;               color: #b45309; }
.q-ok    { background: var(--verde-light);    color: var(--verde-dark); }

.rank-total td {
  background: var(--verde-light);
  font-weight: 700;
  border-top: 2px solid var(--verde);
  border-bottom: 2px solid var(--verde);
  position: sticky;
  top: 0;
  z-index: 2;
}

/* ── TABELAS ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

/* Cabeçalho de turno com totais embutidos (Real/Ideal/Vaga) */
.row-turno-head td {
  background: var(--cinza-bg);
  font-weight: 700;
  border-top: 1px solid var(--cinza-borda);
}
.row-turno-head .td-turno {
  text-transform: uppercase;
  letter-spacing: .5px;
  font-size: 12px;
}
.row-total-geral td {
  background: var(--verde-light);
  color: var(--verde-dark);
  font-weight: 800;
  border-top: 2px solid var(--verde);
}
.row-turno-head td:hover, .row-total-geral td:hover { background: inherit; }

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

th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--cinza-texto);
  border-bottom: 2px solid var(--cinza-borda);
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--cinza-borda);
  color: var(--texto);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--cinza-bg); }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-trabalhando  { background: var(--verde-light);   color: var(--verde-dark); }
.badge-ferias       { background: #e8f0ff;               color: #2563eb; }
.badge-doenca       { background: #fff8e1;               color: #b45309; }
.badge-doencaLonga  { background: var(--vermelho-light); color: var(--vermelho); }
.badge-admin        { background: var(--verde-light);     color: var(--verde-dark); }
.badge-viewer       { background: var(--cinza-bg);        color: var(--cinza-texto); border: 1px solid var(--cinza-borda); }

.senha-temp-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--cinza-bg);
  border: 1px solid var(--cinza-borda);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.senha-temp-box code {
  flex: 1;
  font-size: 18px;
  letter-spacing: 1px;
  font-weight: 700;
  color: var(--verde-dark);
}

.turno-auto { font-size: 10px; color: var(--cinza-texto); font-style: italic; }
.turno-sel { padding: 2px 6px; min-width: 78px; }
.esc-input { padding: 2px 6px; width: 110px; border: 1px solid var(--cinza-borda); border-radius: 6px; font-size: 13px; }
.esc-input:focus { border-color: var(--verde); outline: none; }
.row-naoconta { opacity: .55; }

/* ── DETALHE LOJA ────────────────────────────────────────── */
.loja-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 900px) {
  .loja-grid { grid-template-columns: 1fr; }
}

.chart-wrap {
  position: relative;
  height: 260px;
}

/* ── MAPA DE CALOR (canvas puro) ─────────────────────────── */
.heatmap-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
}
.heatmap-wrap canvas { display: block; max-width: 100%; }

.heatmap-tooltip {
  position: absolute;
  z-index: 300;
  background: rgba(26,31,46,.95);
  color: #fff;
  font-size: 12px;
  line-height: 1.35;
  padding: 6px 10px;
  border-radius: 6px;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

.heatmap-legenda {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--cinza-texto);
}
.heatmap-legenda .leg-item { display: inline-flex; align-items: center; gap: 6px; }
.heatmap-legenda .leg-box {
  width: 14px; height: 14px; border-radius: 3px;
  background: var(--branco);
}
.heatmap-legenda .leg-sobrecarga { border: 2px solid var(--vermelho); }
.heatmap-legenda .leg-ociosidade { border: 2px solid #4a90d9; }

.demanda-info {
  margin-top: 10px;
  font-size: 13px;
  color: var(--cinza-texto);
}
.demanda-info strong { color: var(--texto); }
.demanda-obs { font-size: 12px; font-style: italic; }

/* ── AVISO DE FLAGS ──────────────────────────────────────── */
.flags-aviso {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffc107;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ── SYNC ────────────────────────────────────────────────── */
.sync-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#sync-status-box {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

#sync-ultimo {
  flex: 1;
  font-size: 13px;
  color: var(--cinza-texto);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--cinza-borda);
  border-top-color: var(--verde);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

#sync-progress {
  text-align: center;
  color: var(--cinza-texto);
  font-size: 13px;
}

.sync-row {
  display: grid;
  grid-template-columns: 140px 100px 80px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--cinza-borda);
  font-size: 13px;
  align-items: center;
}

.sync-row:last-child { border-bottom: none; }

.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.status-sucesso { background: var(--verde-light); color: var(--verde-dark); }
.status-erro    { background: var(--vermelho-light); color: var(--vermelho); }
.status-em_andamento { background: #fff8e1; color: #b45309; }

.btn-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* ── ADMIN ───────────────────────────────────────────────── */
.flag-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--cinza-borda);
}

.flag-row:last-child { border-bottom: none; }

.flag-info { flex: 1; }
.flag-label { font-size: 14px; font-weight: 500; }
.flag-desc  { font-size: 12px; color: var(--cinza-texto); }

/* Toggle switch */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input { display: none; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--cinza-borda);
  border-radius: 24px;
  cursor: pointer;
  transition: background .2s;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  top: 3px;
  left: 3px;
  background: var(--branco);
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.toggle input:checked + .toggle-slider { background: var(--verde); }
.toggle input:checked + .toggle-slider::after { transform: translateX(20px); }

.turno-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--cinza-borda);
}

.turno-row:last-child { border-bottom: none; }

.turno-nome { font-size: 14px; font-weight: 600; width: 100px; }

.hora-input {
  width: 70px;
  padding: 6px 10px;
  border: 1.5px solid var(--cinza-borda);
  border-radius: 6px;
  font-size: 14px;
  text-align: center;
}

/* ── MODAL ───────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-box {
  background: var(--branco);
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
}

.modal-box h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 20px;
}

.modal-box .field {
  margin-bottom: 14px;
}

.modal-box label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--cinza-texto);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 5px;
}

.modal-box input,
.modal-box select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--cinza-borda);
  border-radius: 7px;
  font-size: 14px;
  outline: none;
}

.modal-box input:focus,
.modal-box select:focus { border-color: var(--verde); }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ── ESTADO VAZIO ────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--cinza-texto);
}

.empty-state p { font-size: 14px; margin-top: 8px; }

/* ── ELEMENTOS MOBILE (ocultos no desktop) ───────────────── */
.mobile-topbar { display: none; }
.sidebar-backdrop { display: none; }
.col-quadro-mobile { display: none; }

.hamburger {
  width: 38px;
  height: 38px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 8px;
}
.hamburger span {
  display: block;
  height: 2px;
  width: 22px;
  background: var(--branco);
  border-radius: 2px;
}

.mobile-brand .logo-fresh,
.mobile-brand .logo-food { font-size: 18px; }

/* ── RESPONSIVIDADE: TABLET (≤ 768px) ────────────────────── */
@media (max-width: 768px) {
  /* Barra superior fixa com hamburguer */
  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 52px;
    padding: 0 12px;
    background: var(--verde-dark);
    z-index: 150;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
  }

  /* Sidebar vira drawer deslizante (oculta por padrão) */
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 160;
    box-shadow: 2px 0 16px rgba(0,0,0,.3);
  }
  #shell.sidebar-open .sidebar { transform: translateX(0); }

  /* Backdrop por trás do drawer aberto */
  #shell.sidebar-open .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 140;
  }

  /* Conteúdo ocupa toda a largura, abaixo da topbar */
  .main-content {
    margin-left: 0;
    padding: 64px 14px 24px;
  }

  /* Filtros do header em 100% da largura, empilhados */
  .header-actions { width: 100%; flex-direction: column; align-items: stretch; }
  .header-actions .input-busca,
  .header-actions .select-sm { width: 100%; }
  .page-header h1 { flex: 1 1 100%; }
  /* Grupo de período ocupa a largura toda; datas dividem a linha */
  .filtro-periodo { width: 100%; flex-wrap: wrap; }
  .filtro-periodo .input-date { flex: 1 1 38%; min-width: 120px; }
  /* Seletor de mês do detalhe da loja (fora de .header-actions) */
  .page-header > .select-sm { width: 100%; }

  /* Detalhe da loja: cards empilham */
  .loja-grid { grid-template-columns: 1fr; }

  /* ── Lista do dashboard vira CARDS com tiles 2×2 ──
     Cada loja é um card: nome no topo (linha inteira) + 4 indicadores
     (Quadro, Vagas, Fat/Colab, Fat 30d) em mini-tiles de 2 colunas. */
  .lojas-head { display: none; }

  .lojas-grid {
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
    gap: 10px;
  }

  .loja-row {
    background: var(--branco);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    border-bottom: none;
    border-left: 4px solid transparent;
  }
  .loja-row.vagas-abertas { border-left-color: var(--vermelho); }

  .loja-row-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 14px;
  }

  .col-nome { grid-column: 1 / -1; margin-bottom: 2px; min-width: 0; }
  .loja-row-nome   { font-size: 15px; }
  .loja-row-cidade { font-size: 12px; }

  .loja-row .col-cargo { display: none; }

  /* Mini-tiles: rótulo em cima, valor embaixo */
  .loja-row .col-quadro-mobile,
  .loja-row-grid > .col-num:not(.col-cargo),
  .loja-row-grid > .col-fat {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    background: var(--cinza-bg);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 15px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .col-fat.sub { color: var(--cinza-texto); }

  .col-cap {
    display: block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--cinza-texto);
  }

  .loja-row .vagas-badge { font-size: 15px; padding: 1px 10px; }
  .loja-row .vagas-zero  { font-size: 15px; }

  /* ── Tabelas densas viram cards empilhados (1 card por linha) ──
     Cada <td data-label="..."> mostra o rótulo à esquerda e o valor à direita.
     Evita o "encolhe e corta" das tabelas largas no celular. */
  .table-wrap { overflow-x: visible; }

  table.rtable,
  table.rtable tbody,
  table.rtable tr,
  table.rtable td { display: block; width: 100%; }

  table.rtable thead { display: none; }

  table.rtable tr {
    background: var(--branco);
    border: 1px solid var(--cinza-borda);
    border-radius: 10px;
    padding: 4px 12px;
    margin-bottom: 10px;
    box-shadow: var(--card-shadow);
  }
  table.rtable tr:hover td { background: transparent; }

  table.rtable td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 8px 0;
    border-bottom: 1px solid var(--cinza-borda);
    text-align: right;
  }
  table.rtable tr td:last-child { border-bottom: none; }

  table.rtable td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--cinza-texto);
    text-align: left;
  }
  table.rtable td[data-label=""]::before,
  table.rtable td:not([data-label])::before { content: none; }

  /* Selects (turno/escala) preenchem o lado direito */
  table.rtable td .select-sm { width: auto; min-width: 130px; max-width: 60%; }

  /* Linha de seção (turno) — faixa de destaque, sem rótulo */
  table.rtable td.row-section {
    background: var(--verde-light);
    color: var(--verde-dark);
    justify-content: flex-start;
    font-weight: 800;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin: 2px -12px 6px;
    padding: 8px 12px;
    border-bottom: none;
    border-radius: 0;
  }
  table.rtable td.row-section::before { content: none; }

  /* Coluna "#" do ranking é dispensável no card mobile */
  table.rtable td.col-rank { display: none; }

  /* Total da rede no ranking: sem sticky no mobile, destaque verde */
  table.rtable .rank-total td { position: static; background: var(--verde-light); }

  /* Barras do ranking ocupam o lado direito sem largura fixa */
  table.rtable .rank-bar { min-width: 130px; max-width: 60%; }

  /* Gráficos um pouco menores */
  .chart-wrap { height: 240px; }
}

/* ── RESPONSIVIDADE: MOBILE PEQUENO (≤ 480px) ────────────── */
@media (max-width: 480px) {
  .main-content { padding: 60px 10px 20px; }
  .card { padding: 14px; }
  .page-header h1 { font-size: 19px; }
  .resumo-cards { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .metrica { padding: 12px 14px; }
  .metrica-valor { font-size: 22px; }
  .chart-wrap { height: 220px; }
}

/* ── PORTAL (home de soluções) ───────────────────────────── */
#view-portal {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--cinza-bg);
}
.portal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: var(--branco);
  border-bottom: 1px solid var(--cinza-borda);
}
.portal-brand .logo-fresh,
.portal-brand .logo-food { font-size: 22px; }
.portal-brand .logo-sub { display: inline; margin-left: 8px; }
.portal-back {
  text-decoration: none;
  color: var(--cinza-texto);
  font-size: 22px;
  line-height: 1;
  margin-right: 4px;
}
.portal-back:hover { color: var(--texto); }
.portal-user {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--cinza-texto);
}
.portal-main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 28px;
}
.portal-title { font-size: 24px; font-weight: 700; }
.portal-subtitle { color: var(--cinza-texto); margin-bottom: 28px; }
.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.portal-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  background: var(--branco);
  border: 1px solid var(--cinza-borda);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 24px;
  cursor: pointer;
  font-family: var(--font);
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.portal-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
  border-color: var(--verde-mid);
}
.portal-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--verde-light);
}
.portal-card-icon svg {
  width: 24px; height: 24px;
  stroke: var(--verde); fill: none; stroke-width: 2;
}
.portal-card-titulo { font-size: 16px; font-weight: 700; color: var(--texto); }
.portal-card-desc { font-size: 13px; color: var(--cinza-texto); line-height: 1.5; }

/* Link "Portal" na sidebar do quadro */
.nav-portal {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  transition: color .15s, background .15s;
}
.nav-portal svg {
  width: 16px; height: 16px;
  stroke: currentColor; fill: none; stroke-width: 2;
}
.nav-portal:hover { color: var(--branco); background: rgba(255,255,255,.08); }

@media (max-width: 480px) {
  .portal-main { padding: 28px 16px; }
  .portal-topbar { padding: 14px 16px; }
}

/* ── Changelog (sino + painel lateral) ──────────────────── */
.btn-changelog {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 4px 8px;
}
.changelog-badge {
  position: absolute;
  top: 0; right: 0;
  background: var(--vermelho);
  color: #fff;
  border-radius: 50%;
  font-size: 0.62rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  box-sizing: border-box;
}
.changelog-panel {
  position: fixed;
  top: 0; right: 0;
  width: 380px;
  max-width: 100vw;
  height: 100vh;
  background: var(--branco);
  box-shadow: -4px 0 24px rgba(0,0,0,0.12);
  z-index: 1000;
  display: flex;
  flex-direction: column;
}
.changelog-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--cinza-borda);
  font-weight: 600;
  color: var(--texto);
}
.changelog-panel-header button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--cinza-texto);
  line-height: 1;
}
.changelog-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}
.changelog-item {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--cinza-borda);
}
.changelog-item:last-child { border-bottom: none; }
.changelog-item-header {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.changelog-version { font-weight: 600; font-size: 0.85rem; color: var(--cinza-texto); }
.changelog-date { font-size: 0.8rem; color: var(--cinza-texto); }
.changelog-prefix {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
}
.changelog-prefix-user { background: #c6f6d5; color: #276749; }
.changelog-prefix-fix  { background: #fefcbf; color: #744210; }
.changelog-prefix-tech { background: #e2e8f0; color: #4a5568; }
.changelog-message { font-size: 0.9rem; line-height: 1.5; color: var(--texto); }
.changelog-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 999;
}
.changelog-loading { color: var(--cinza-texto); font-size: 0.9rem; }

/* ─────────────────────────────────────────────────────────
   Módulo Colaboradores (solução /colaboradores)
   ───────────────────────────────────────────────────────── */

/* Botão de ação destrutiva (desligamento) */
.btn-danger {
  background: var(--vermelho);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: filter .15s;
}
.btn-danger:hover { filter: brightness(.93); }

/* Barra de filtros */
.filtros-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.filtros-bar .input-busca { width: 280px; max-width: 100%; }

/* Resumo (contadores por status) */
.colab-resumo {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--cinza-borda);
  color: var(--cinza-texto);
}
.colab-stat { display: inline-flex; align-items: center; gap: 6px; }
.colab-stat strong { color: var(--texto); font-size: 16px; }
.colab-vazio { color: var(--cinza-texto); padding: 18px 4px; text-align: center; }

/* Tabela de colaboradores */
.colab-table { width: 100%; border-collapse: collapse; }
.colab-table th, .colab-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--cinza-borda);
}
.colab-table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--cinza-texto);
}
.colab-table tbody tr { cursor: pointer; transition: background .12s; }
.colab-table tbody tr:hover { background: var(--verde-light); }
.tag-vaga {
  font-size: 11px;
  background: var(--amarelo);
  color: #5c4a00;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
}

/* Badges de status */
.badge-status {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 12px;
  line-height: 1.5;
}
.badge-ativo     { background: var(--verde-light); color: var(--verde-dark); }
.badge-ferias    { background: #e6f0fb; color: #1d4e89; }
.badge-afastado  { background: #fdf3e0; color: #92600a; }
.badge-desligado { background: var(--vermelho-light); color: var(--vermelho); }

/* Painel lateral da ficha */
.ficha-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 60;
}
.ficha-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 480px; max-width: 92vw;
  background: var(--branco);
  box-shadow: -4px 0 18px rgba(0,0,0,.14);
  z-index: 61;
  display: flex;
  flex-direction: column;
}
.ficha-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--cinza-borda);
  font-weight: 700; font-size: 16px;
}
.ficha-panel-header button {
  background: none; border: none; font-size: 18px;
  cursor: pointer; color: var(--cinza-texto);
}
.ficha-body { padding: 18px 20px; overflow-y: auto; flex: 1; }

.ficha-acoes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.ficha-secao { margin-bottom: 22px; }
.ficha-secao h3 {
  font-size: 14px; margin-bottom: 10px;
  padding-bottom: 6px; border-bottom: 1px solid var(--cinza-borda);
}
.ficha-secao h3 .badge-status { float: right; }
.ficha-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.ficha-item { display: flex; flex-direction: column; }
.ficha-label { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--cinza-texto); }
.ficha-valor { font-size: 14px; word-break: break-word; }

/* Timeline (histórico / transferências) */
.ficha-timeline-item {
  border-left: 2px solid var(--cinza-borda);
  padding: 0 0 12px 12px;
  margin-left: 4px;
}
.ficha-timeline-item .tl-top { display: flex; justify-content: space-between; gap: 8px; }
.ficha-timeline-item .tl-data { font-size: 12px; color: var(--cinza-texto); white-space: nowrap; }
.ficha-timeline-item .tl-mudanca { font-size: 13px; color: var(--texto); margin-top: 2px; }
.ficha-timeline-item .tl-motivo { font-size: 12px; color: var(--cinza-texto); margin-top: 2px; }
.ficha-timeline-item .tl-carencia { font-size: 12px; color: var(--verde-dark); margin-top: 2px; }

/* Formulário na ficha */
.form-secao {
  font-size: 13px; text-transform: uppercase; letter-spacing: .03em;
  color: var(--cinza-texto); margin: 16px 0 8px;
}
.form-secao:first-child { margin-top: 0; }
.field-ajuda { display: block; font-size: 11px; color: var(--cinza-texto); margin-top: 3px; }
.field-check label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.field-check input { width: auto; }

@media (max-width: 560px) {
  .ficha-grid { grid-template-columns: 1fr; }
  .filtros-bar .input-busca, .filtros-bar .select-sm { width: 100%; }
}

/* Importação em massa (painel da ficha) */
.imp-result { margin-top: 10px; }
.imp-ok {
  background: var(--verde-light); color: var(--verde-dark);
  border: 1px solid var(--verde-mid); border-radius: 8px;
  padding: 8px 12px; font-size: 13px;
}
.imp-erro {
  background: var(--vermelho-light); color: var(--vermelho);
  border: 1px solid var(--vermelho); border-radius: 8px;
  padding: 8px 12px; font-size: 13px;
}
.imp-resumo { font-size: 13px; margin: 10px 0 6px; }
.imp-erro-txt { color: var(--vermelho); font-weight: 600; }
.imp-erros-lista {
  list-style: none; margin: 4px 0; padding: 8px 12px;
  background: var(--cinza-bg); border-radius: 8px;
  max-height: 180px; overflow-y: auto;
  font-size: 12px; color: var(--cinza-texto);
}
.imp-erros-lista li { padding: 2px 0; }
input[type="file"] { font-size: 13px; }

/* Importação — preview de atualizações (diff) */
.imp-upd-head { font-size: 13px; font-weight: 600; margin: 12px 0 6px; }
.imp-upd-item {
  border: 1px solid var(--cinza-borda); border-radius: 8px;
  padding: 8px 10px; margin-bottom: 8px;
}
.imp-upd-top { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.imp-upd-top input { width: auto; }
.imp-cpf { color: var(--cinza-texto); font-size: 12px; }
.tag-flag {
  font-size: 11px; background: #fdf3e0; color: #92600a;
  padding: 1px 7px; border-radius: 10px; font-weight: 600;
}
.imp-mudancas { list-style: none; margin: 6px 0 0; padding: 0 0 0 26px; font-size: 12px; }
.imp-mudancas li { padding: 1px 0; color: var(--texto); }
.imp-mudancas .m-de { color: var(--cinza-texto); text-decoration: line-through; }
.imp-mudancas .m-para { color: var(--verde-dark); font-weight: 600; }
