* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#app {
  display: flex;
  height: 100vh;
}

#panel {
  width: 320px;
  flex: 0 0 320px;
  display: flex;
  flex-direction: column;
  padding: 14px 14px 0;
  border-right: 1px solid #ddd;
  background: #fafafa;
  overflow: hidden;
}

#map {
  flex: 1;
  height: 100%;
}

h1 {
  font-size: 16px;
  margin: 0 0 2px;
}

.sub {
  margin: 0 0 10px;
  color: #555;
  font-size: 13px;
}

.sub #count { font-weight: 700; color: #2ca02c; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: #444;
  margin-bottom: 10px;
}

.legend span { display: inline-flex; align-items: center; gap: 4px; }

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  display: inline-block;
}
.swatch.asc { background: #1f77b4; }
.swatch.dsc { background: #d62728; }
.swatch.sel { background: #2ca02c; }

.filter {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  font-size: 12px;
  color: #444;
  margin-bottom: 10px;
}
.filter-label { font-weight: 600; }
.filter label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}
.filter b { font-weight: 700; }

.buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.buttons button {
  padding: 7px 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
}
.buttons button:hover { background: #f0f0f0; }
.buttons button.primary {
  background: #2ca02c;
  border-color: #2ca02c;
  color: #fff;
  font-weight: 600;
}
.buttons button.primary:hover { background: #258a25; }

.list {
  flex: 1;
  overflow-y: auto;
  border-top: 1px solid #e3e3e3;
  font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 4px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
}
.row:hover { background: #eef6ff; }
.row.selected { background: #e6f5e6; }

.fid { flex: 1; }
.size {
  color: #666;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sub #selsize { font-weight: 700; color: #2ca02c; }

.dir {
  width: 16px;
  text-align: center;
  border-radius: 3px;
  color: #fff;
  font-weight: 700;
}
.dir-A { background: #1f77b4; }
.dir-D { background: #d62728; }

.error {
  padding: 12px;
  color: #b00;
  font-size: 13px;
  line-height: 1.4;
}
.error code {
  background: #f3f3f3;
  padding: 1px 4px;
  border-radius: 3px;
}

@media (max-width: 640px) {
  #app { flex-direction: column; }
  #panel { width: 100%; flex: 0 0 auto; height: 45vh; }
  #map { height: 55vh; }
}
