:root{
  --topbar-h: 48px;
}

body{
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.topbar{
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: rgba(255,255,255,0.95);
  border-bottom: 1px solid rgba(0,0,0,0.12);
  z-index: 9999;
}

.topbar__left{
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.topbar__brand{
  font-weight: 800;
  letter-spacing: 0.02em;
}

.topbar__title{
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60vw;
}

.topbar__btn{
  border: 1px solid rgba(0,0,0,0.18);
  background: white;
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
}

.map-wrap{
  position: absolute;
  top: var(--topbar-h);
  left: 0;
  right: 0;
  bottom: 0;
}

#map{
  position: absolute;
  inset: 0;
}

.ui-left{
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 10;
  width: 420px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.panel{
  pointer-events: auto;
  background: rgba(255,255,255,0.95);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  border-radius: 8px;
  padding: 12px;
}

.panel-header h3 {
  margin: 0;
  line-height: 1;
}

.panel-title{
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 800;
}

.panel-subtitle{
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 800;
}

.toggle-group{
  display: inline-flex;
  border-radius: 999px;
  overflow: hidden;
  background-color: #e0e0e0;
  width: 100%;
  max-width: 160px;
}

.toggle-button{
  flex: 1;
  padding: 10px 0;
  border: none;
  background: transparent;
  color: #333;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s ease-in-out;
}

.toggle-button.active{
  background-color: #333;
  color: white;
}

.date-box{
  margin-top: 10px;
  padding: 6px 10px;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 10px;
  display: inline-block;
  font-size: 0.95em;
  background: #fff;
}

.table-wrap{
  /* max-height: 220px; */
  overflow-y: auto;
}

#top-filers{
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

#top-filers th,
#top-filers td{
  padding: 6px 4px;
  border-bottom: 1px solid #ddd;
}

#top-filers tr.active{
  background-color: #f0f0f0;
  font-weight: bold;
}

.map-overlay{
  position: absolute;
  font: 12px/20px "Helvetica Neue", Arial, Helvetica, sans-serif;
  padding: 10px;
  z-index: 10;
}

.map-overlay.top-right{
  top: 12px;
  right: 12px;
  left: auto;
  width: 300px;
  background: rgba(255,255,255,0.95);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  border-radius: 8px;
}

.mapboxgl-popup.filing-popup{
  background: transparent;
  box-shadow: none;
  pointer-events: none;
}

.mapboxgl-popup-content{
  background: none;
  color: black;
  font-size: 13px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 4px;
}

.mapboxgl-popup-tip{
  display: none;
}

/* Modal */
.modal{
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
}

.modal.is-open{
  display: block;
}

.modal__backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.25);
}

.modal__dialog{
  position: relative;
  width: min(820px, calc(100vw - 40px));
  max-height: calc(100vh - 80px);
  overflow: auto;
  margin: 70px auto;
  background: #f7fafc;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.22);
  padding: 22px 22px 18px;
}

.modal__close{
  position: absolute;
  top: 10px;
  right: 12px;
  border: 0;
  background: transparent;
  font-size: 26px;
  cursor: pointer;
  line-height: 1;
}

.table-wrap {
  max-height: 200px;
  overflow-y: auto;
  transition: max-height 0.2s ease;
}

.table-wrap.collapsed {
  max-height: 0;
  overflow: hidden;
}

@media (max-width: 650px){
  .ui-left{
    width: calc(100vw - 24px);
  }
    #time-panel {
    font-size: 11px;
  }
  .modal__dialog {
    font-size: 13px;
    padding: 16px;
  }
  .modal__dialog h2,
  .modal__dialog p,
  .modal__dialog a {
    font-size: 13px; 
  }
}
