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

body { font-family: 'Segoe UI', sans-serif; font-size: 14px; background: #f0f2f5; color: #222; height: 100vh; display: flex; flex-direction: column; }

header { background: #1a5276; color: white; padding: 10px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-shrink: 0; }
header h1 { font-size: 18px; font-weight: 600; }
.header-actions { display: flex; gap: 8px; }

.layout { display: flex; flex: 1; overflow: hidden; }

aside#painel-lista { width: 340px; background: white; border-right: 1px solid #ddd; display: flex; flex-direction: column; overflow: hidden; flex-shrink: 0; }
.filtros { padding: 10px; display: flex; flex-direction: column; gap: 6px; border-bottom: 1px solid #eee; }
.filtros input, .filtros select { border: 1px solid #ccc; border-radius: 4px; padding: 6px 8px; font-size: 13px; }
#lista-artigos { flex: 1; overflow-y: auto; }
#resumo { padding: 8px 12px; font-size: 12px; color: #666; border-top: 1px solid #eee; background: #fafafa; }

.artigo-item { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; cursor: pointer; transition: background 0.15s; }
.artigo-item:hover { background: #f5f8ff; }
.artigo-item.ativo { background: #e8f0fe; border-left: 3px solid #1a5276; }
.artigo-item .artigo-titulo { font-weight: 600; font-size: 13px; }
.artigo-item .artigo-sub { font-size: 12px; color: #666; margin-top: 2px; }
.artigo-item .badges { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }

main { flex: 1; position: relative; }
#mapa { width: 100%; height: 100%; }

/* Badges estado */
.badge { display: inline-block; padding: 2px 7px; border-radius: 10px; font-size: 11px; font-weight: 500; }
.badge-registado { background: #d5f5e3; color: #1e8449; }
.badge-sem_bupi { background: #fde8e8; color: #c0392b; }
.badge-outro_proprietario { background: #fef3cd; color: #d68910; }
.badge-geo { background: #dbeafe; color: #1d4ed8; }

/* Botões */
button, .btn { border: none; padding: 7px 14px; border-radius: 5px; cursor: pointer; font-size: 13px; font-weight: 500; transition: 0.15s; }
button { background: #1a5276; color: white; }
button:hover { background: #154360; }
.btn-secondary { background: #2980b9; color: white; }
.btn-secondary:hover { background: #1f6391; }
.btn-outline { background: transparent; border: 1px solid #aaa; color: #444; }
.btn-outline:hover { background: #f0f0f0; }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-close { background: transparent; color: white; font-size: 20px; padding: 0 6px; line-height: 1; }
.btn-close:hover { background: rgba(255,255,255,0.2); }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; align-items: flex-start; justify-content: center; padding-top: 40px; overflow-y: auto; }
.modal.hidden { display: none; }
.modal-content { background: white; border-radius: 8px; width: 700px; max-width: 95vw; margin-bottom: 40px; }
.modal-sm { width: 500px; }
.modal-header { background: #1a5276; color: white; padding: 14px 18px; border-radius: 8px 8px 0 0; display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { font-size: 16px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 18px 18px 0; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group.full { grid-column: span 2; }
.form-group label { font-size: 12px; font-weight: 600; color: #555; text-transform: uppercase; letter-spacing: 0.4px; }
.form-group input, .form-group select, .form-group textarea { border: 1px solid #ccc; border-radius: 4px; padding: 7px 9px; font-size: 13px; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: #1a5276; }

#secao-mapa-form { margin: 14px 18px 0; }
.mapa-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: #555; text-transform: uppercase; letter-spacing: 0.4px; }
.mapa-header div { display: flex; gap: 6px; flex-wrap: wrap; }
#mapa-form { height: 260px; border: 1px solid #ccc; border-radius: 4px; }
#geo-info { font-size: 12px; color: #555; margin-top: 4px; min-height: 18px; }

.form-actions { padding: 14px 18px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid #eee; margin-top: 14px; }

#pdf-resultado { padding: 14px 18px; font-size: 13px; }
#pdf-resultado pre { background: #f5f5f5; padding: 10px; border-radius: 4px; font-size: 11px; overflow-x: auto; max-height: 200px; }
.campo-pdf { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.campo-pdf label { width: 130px; font-weight: 600; color: #555; font-size: 12px; }
.campo-pdf input { flex: 1; border: 1px solid #ccc; border-radius: 4px; padding: 5px 8px; font-size: 13px; }

/* Leaflet popup */
.leaflet-popup-content { font-size: 13px; line-height: 1.6; }
.leaflet-popup-content b { color: #1a5276; }
.popup-actions { margin-top: 8px; display: flex; gap: 6px; }
.popup-actions button { font-size: 12px; padding: 4px 10px; }
