:root {
  --verde: #2e7d32;
  --verde-claro: #4caf50;
  --verde-bg: #e8f5e9;
  --laranja: #f57c00;
  --laranja-claro: #ff9800;
  --vermelho: #c62828;
  --azul: #1565c0;
  --cinza: #616161;
  --cinza-claro: #f5f5f5;
  --branco: #ffffff;
  --sombra: 0 2px 8px rgba(0,0,0,0.12);
  --radius: 10px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--cinza-claro);
  color: #333;
  font-size: 15px;
}

/* ---- LOGIN ---- */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--verde) 0%, var(--verde-claro) 100%);
  padding: 20px;
}

.login-box {
  background: var(--branco);
  border-radius: var(--radius);
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--sombra);
}

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

.login-logo h1 {
  font-size: 1.6rem;
  color: var(--verde);
  margin-top: 8px;
}

.login-logo p {
  color: var(--cinza);
  font-size: 0.85rem;
}

/* ---- FORMULARIO ---- */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
  transition: border-color 0.2s;
  background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--verde-claro);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

/* ---- BOTOES ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 20px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary { background: var(--verde); color: white; }
.btn-primary:hover { background: #1b5e20; }
.btn-secondary { background: #e0e0e0; color: #333; }
.btn-secondary:hover { background: #bdbdbd; }
.btn-danger { background: var(--vermelho); color: white; }
.btn-warning { background: var(--laranja); color: white; }
.btn-full { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 13px; }

/* ---- HEADER ---- */
.header {
  background: var(--verde);
  color: white;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--sombra);
}

.header h1 {
  font-size: 1.1rem;
  font-weight: 700;
}

.header-user {
  font-size: 0.85rem;
  opacity: 0.9;
  text-align: right;
}

.header-user span {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
}

/* ---- TABS ---- */
.tabs {
  display: flex;
  background: white;
  border-bottom: 2px solid #e0e0e0;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  flex: 1;
  min-width: 100px;
  padding: 14px 10px;
  border: none;
  background: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--cinza);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}

.tab-btn.active {
  color: var(--verde);
  border-bottom-color: var(--verde);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---- CARDS ---- */
.page-content { padding: 16px; max-width: 900px; margin: 0 auto; }

.card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--sombra);
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--verde);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- CARDS DE INDICADORES ---- */
.indicadores-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

@media (min-width: 600px) {
  .indicadores-grid { grid-template-columns: repeat(4, 1fr); }
}

.indicador-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--sombra);
  border-top: 4px solid var(--verde);
}

.indicador-card.laranja { border-top-color: var(--laranja); }
.indicador-card.azul { border-top-color: var(--azul); }
.indicador-card.vermelho { border-top-color: var(--vermelho); }
.indicador-card.roxo { border-top-color: #9c27b0; }

/* ---- SEÇÃO DO DASHBOARD ---- */
.dash-secao {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--verde);
  margin: 22px 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid #e0e0e0;
}
.dash-secao:first-of-type { margin-top: 8px; }

.indicador-valor {
  font-size: 1.8rem;
  font-weight: 700;
  color: #333;
  line-height: 1;
}

.indicador-label {
  font-size: 0.78rem;
  color: var(--cinza);
  margin-top: 6px;
}

/* ---- LISTA DE CHEGADAS ---- */
.chegada-item {
  background: white;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  border-left: 4px solid var(--verde-claro);
}

.chegada-item.pendente { border-left-color: var(--laranja); }
.chegada-item.classificado { border-left-color: var(--verde); }

.chegada-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.chegada-titulo {
  font-weight: 700;
  font-size: 1rem;
}

.chegada-info {
  font-size: 0.85rem;
  color: var(--cinza);
  line-height: 1.6;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-pendente { background: #fff3e0; color: var(--laranja); }
.badge-classificado { background: var(--verde-bg); color: var(--verde); }

/* ---- FOTO PREVIEW ---- */
.foto-preview {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 8px;
  margin-top: 8px;
  display: none;
}

/* ---- CLASSIFICACAO ---- */
.destino-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
  padding: 14px;
  background: #f9fafb;
  border-radius: 10px;
  border: 1.5px solid #e0e0e0;
}

.destino-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.destino-row-header span {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--verde);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.destino-row .form-group { margin-bottom: 0; }

.destino-row select,
.destino-row input[type="number"] {
  font-size: 16px; /* evita zoom no iOS */
}

.destino-total {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--cinza);
  text-align: right;
  margin-top: 4px;
  padding: 8px 12px;
  background: #f5f5f5;
  border-radius: 8px;
}

.destino-total.erro { color: var(--vermelho); background: #ffebee; }

/* ---- MULTI-FOTO UPLOAD ---- */
.fotos-upload-area {
  border: 2px dashed #ccc;
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
}

.fotos-upload-area:hover { border-color: var(--verde-claro); }

.fotos-upload-area input[type="file"] {
  display: none;
}

.fotos-upload-btn {
  display: inline-block;
  padding: 8px 18px;
  background: var(--verde-bg);
  color: var(--verde);
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  margin-bottom: 6px;
}

.fotos-upload-hint {
  font-size: 0.8rem;
  color: var(--cinza);
}

.fotos-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.foto-preview-item {
  position: relative;
  width: 80px;
  height: 80px;
}

.foto-preview-item img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid #ddd;
}

.foto-preview-item .remover-foto {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  background: var(--vermelho);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ---- CLASSIFICACAO HISTORICO ITEM ---- */
.classif-detalhes {
  margin-top: 10px;
  padding: 10px;
  background: var(--verde-bg);
  border-radius: 8px;
  font-size: 0.82rem;
}

.classif-detalhes-titulo {
  font-weight: 700;
  color: var(--verde);
  margin-bottom: 6px;
}

.classif-destino-item {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.classif-destino-item:last-child { border-bottom: none; }

/* ---- TABELA ---- */
.tabela-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th {
  background: var(--verde-bg);
  color: var(--verde);
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
  white-space: nowrap;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
}

tr:hover td { background: #fafafa; }

/* ---- FILTROS ---- */
.filtros {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 16px;
}

.filtros .form-group {
  margin-bottom: 0;
  flex: 1;
  min-width: 140px;
}

/* ---- ALERT ---- */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 0.9rem;
}

.alert-sucesso { background: var(--verde-bg); color: var(--verde); }
.alert-erro { background: #ffebee; color: var(--vermelho); }

/* ---- MODAL ---- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.aberto { display: flex; }

.modal {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal-titulo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--verde);
  margin-bottom: 20px;
}

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

/* ---- GRAFICO ---- */
.graficos-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 700px) {
  .graficos-grid { grid-template-columns: 1fr 1fr; }
}

.grafico-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--sombra);
}

.grafico-titulo {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--cinza);
  margin-bottom: 12px;
}

/* ---- NOTIFICACAO TEMPO REAL ---- */
.notif-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--verde);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: var(--sombra);
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
}

.notif-toast.visivel {
  transform: translateY(0);
  opacity: 1;
}

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--cinza);
}

.empty-state-icon { font-size: 3rem; margin-bottom: 12px; }

/* ---- SPINNER ---- */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ---- FOTO THUMB ---- */
.foto-thumb {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
}

/* ---- PAGAMENTO ROW ---- */
.pag-chegada-pago {
  background: #f1f8e9 !important;
  transition: background 0.3s;
}
.pag-chegada-nao-pago {
  background: #fff !important;
  transition: background 0.3s;
}

