/* Painel de navegação do mapa: cabeçalho/filtros/rodapé fixos, lista rolável. */
#panel { width: 360px; padding: 0; display: flex; flex-direction: column; overflow: visible; position: relative; background: var(--surface); }
#fence-panel-collapse { position: absolute; top: 16px; right: -20px; margin: 0; z-index: 500; box-shadow: var(--shadow-sm); }
#map .leaflet-top.leaflet-left { top: 64px; }
.fence-browser-header { padding: 20px 30px 16px 18px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.fence-browser-header h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 21px; text-transform: none; letter-spacing: -.4px; color: var(--navy); }
.fence-browser-header .count-badge { font-size: 12px; padding: 3px 8px; }
.fence-browser-header p, .fence-create-heading p { color: var(--text-muted); font-size: 12px; margin: 6px 0 12px; line-height: 1.5; }
#fence-new { width: auto; height: 36px; padding: 0 12px; font-size: 13px; border-radius: 8px; margin: 0; }
#fence-new[hidden] { display: none; }
#fence-feedback { flex-shrink: 0; margin: 0; padding: 10px 18px; font-size: 12px; }
#fence-feedback:empty { display: none; }
#fence-browser { display: flex; flex-direction: column; flex: 1; min-height: 0; }
#fence-browser.hidden { display: none; }
.fence-browser-filters { flex-shrink: 0; padding: 14px 18px 4px; max-height: 45%; overflow-y: auto; }
#panel input:not([type="checkbox"]), #panel select { box-sizing: border-box; width: 100%; min-width: 0; height: 40px; margin: 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background-color: var(--surface); color: var(--text); font: inherit; font-size: 13px; }
#panel select { appearance: none; padding-right: 30px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235e6e7e' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center; }
#panel input:focus, #panel select:focus { outline: none; border-color: var(--green-deep); box-shadow: 0 0 0 3px rgba(126,217,87,.18); }
.fence-filter-details { margin: 10px 0; border: 0; background: transparent; }
.fence-filter-details summary { cursor: pointer; font-size: 12px; color: var(--text-muted); padding: 5px 0; }
.fence-filter-fields { display: grid; gap: 10px; padding-top: 10px; }
.fence-filter-fields label { display: grid; gap: 5px; font-size: 12px; color: var(--text-muted); }
.fence-bubble-toggle { display: flex; align-items: center; justify-content: space-between; position: relative; gap: 10px; padding: 5px 0; font-size: 12px; cursor: pointer; }
.fence-bubble-toggle input { position: absolute; right: 0; width: 38px; height: 24px; opacity: 0; cursor: pointer; }
.fence-bubble-track { width: 36px; height: 22px; border-radius: 20px; padding: 3px; background: var(--border-strong); flex-shrink: 0; }
.fence-bubble-track::after { content: ''; display: block; width: 16px; height: 16px; border-radius: 50%; background: white; box-shadow: var(--shadow-sm); transition: transform .15s; }
.fence-bubble-toggle input:checked + .fence-bubble-track { background: var(--green); }
.fence-bubble-toggle input:checked + .fence-bubble-track::after { transform: translateX(14px); }
.fence-bubble-toggle input:focus-visible + .fence-bubble-track { outline: 2px solid var(--navy); outline-offset: 3px; }
#fence-list-status { flex-shrink: 0; margin: 0; padding: 6px 18px 10px; font-size: 11px; }
#fence-list-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 10px; scrollbar-width: thin; }
#fence-list li { padding: 0; margin: 0 0 6px; }
#fence-list .fence-list-item { display: block; width: 100%; padding: 12px 10px; margin: 0; border: 0; background: transparent; text-align: left; color: var(--text); border-radius: 6px; font-size: 13px; font-weight: 500; }
#fence-list li.active { background: #f1faec; box-shadow: none; }
.fence-row-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; font-weight: 650; overflow-wrap: anywhere; }
.fence-status { font-size: 10px; border-radius: 20px; padding: 2px 6px; background: var(--surface-sunken); color: var(--text-muted); flex-shrink: 0; }
.fence-status.is-active { background: #e7f7df; color: #257135; }
#fence-list .meta { line-height: 1.5; margin-top: 4px; }
#fence-list .fence-empty { padding: 20px 10px; color: var(--text-muted); font-size: 13px; cursor: default; line-height: 1.5; }
#fence-pagination { flex: 0 0 auto; margin: 0; padding: 10px 12px; border: 0; border-top: 1px solid var(--border); border-radius: 0; box-shadow: none; gap: 8px; display: flex; flex-direction: column; align-items: stretch; }
#fence-pagination[hidden] { display: none; }
#fence-pagination .pagination-summary { font-size: 11px; }
#fence-pagination .pagination-actions { flex-direction: column; align-items: stretch; gap: 8px; }
#fence-pagination .page-size-control { justify-content: space-between; font-size: 12px; }
#fence-pagination select { width: 76px; height: 32px; }
#fence-pagination .page-controls { justify-content: center; gap: 3px; }
#fence-pagination .page-numbers { gap: 3px; }
#fence-pagination .page-button { width: 28px; min-width: 28px; height: 30px; min-height: 30px; padding: 0; font-size: 12px; }
#fence-create-form { padding: 18px; min-height: 0; overflow-y: auto; }
.fence-create-heading h3 { margin: 0; font-size: 18px; }
#fence-coords { padding: 12px; font-size: 12px; line-height: 1.5; border: 1px dashed var(--border-strong); background: var(--bg); border-radius: 8px; margin: 0 0 16px; }
.fence-create-actions { display: flex; gap: 8px; }
.fence-create-actions button { flex: 1; width: auto; font-size: 13px; padding: 10px; }
#detail-panel { position: relative; width: var(--detail-panel-width, clamp(360px, 34vw, 560px)); display: flex; flex-direction: column; min-height: 0; overflow: visible; }
#detail-panel.hidden { display: none; }
#detail-panel-resize { position: absolute; top: 50%; left: -12px; transform: translateY(-50%); z-index: 501; width: 24px; height: 52px; margin: 0; padding: 0; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--text-subtle); cursor: ew-resize; touch-action: none; user-select: none; }
#detail-panel-resize span { width: 6px; height: 16px; border-left: 2px solid currentColor; border-right: 2px solid currentColor; border-radius: 1px; }
#detail-panel-resize:hover, #detail-panel-resize.is-dragging { color: var(--text-muted); border-color: var(--border-strong); background: var(--surface-sunken); }
#detail-panel-resize:focus-visible { outline: 2px solid var(--green-deep); outline-offset: 3px; }
body.detail-panel-resizing, body.detail-panel-resizing * { cursor: ew-resize !important; user-select: none !important; }
@media (pointer: coarse) { #detail-panel-resize { width: 44px; left: -22px; } }
#detail-header { position: static; flex-shrink: 0; align-items: flex-start; padding: 20px 16px 18px 28px; }
.detail-heading { display: flex; flex-direction: column; min-width: 0; gap: 6px; }
.detail-eyebrow { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text-subtle); }
#detail-title { font-size: 19px; white-space: normal; overflow-wrap: anywhere; }
#detail-endereco { font-size: 12px; line-height: 1.5; margin: 0; }
#fence-detail { flex: 1; min-height: 0; overflow-y: auto; padding: 18px; scrollbar-width: thin; }
#fence-detail > .card { margin-bottom: 16px; }
#fence-detail > h2 { margin-top: 22px; font-size: 12px; }
#detail-panel-collapse { position: absolute; top: 16px; left: -20px; z-index: 500; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin: 0; padding: 0; border: 1px solid var(--border-strong); border-radius: 50%; background: var(--surface); color: var(--text-muted); box-shadow: var(--shadow-sm); cursor: pointer; }
#detail-panel-collapse:hover { color: var(--text); border-color: var(--green-deep); }
#detail-panel.is-collapsed { width: 0; min-width: 0; padding: 0; border: 0; box-shadow: none; }
#detail-panel.is-collapsed > :not(#detail-panel-collapse) { display: none; }
#detail-panel.is-collapsed #detail-panel-collapse { left: auto; right: 16px; }
@media (max-width: 960px) {
  #panel { width: 100%; height: 52vh; max-height: 52vh; min-height: 0; }
  .fence-browser-header { padding: 12px 64px 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .fence-browser-header p { display: none; }
  #fence-panel-collapse { right: 14px; top: 12px; }
  #fence-new { white-space: nowrap; }
  .fence-browser-filters { padding: 8px 16px 0; }
  .fence-filter-details { margin: 3px 0; }
  #fence-pagination .pagination-summary, #fence-pagination .page-size-control { display: none; }
  #fence-pagination { padding: 6px; }
  #fence-pagination .page-button { height: 40px; width: 36px; min-width: 36px; }
  .fence-creating #panel { height: 58vh; max-height: 58vh; }
  #map { min-height: 25vh; }
  #map .leaflet-top.leaflet-left { top: 10px; }
  #detail-panel { width: 100%; }
  #detail-panel-resize { display: none; }
  #detail-header { padding-left: 64px; }
  #detail-panel-collapse { left: 14px; top: 16px; }
  #detail-panel.is-collapsed { position: absolute; top: 0; right: 0; height: 0; z-index: 500; }
  #detail-panel.is-collapsed #detail-panel-collapse { top: calc(52vh + 16px); }
  #view-cercas.fence-panel-collapsed #detail-panel.is-collapsed #detail-panel-collapse { top: 16px; }
}
.fence-creating #map,
.fence-creating #map .leaflet-interactive,
.fence-creating #map .leaflet-marker-icon {
  cursor: url("assets/cursor-pin.svg") 16 39, crosshair;
}
